OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2009 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
364 } // namespace | 364 } // namespace |
365 | 365 |
366 static void adjustAmountOfExternalAllocatedMemory(int64_t diff) { | 366 static void adjustAmountOfExternalAllocatedMemory(int64_t diff) { |
367 #if DCHECK_IS_ON() | 367 #if DCHECK_IS_ON() |
368 DEFINE_THREAD_SAFE_STATIC_LOCAL(int64_t, processTotal, new int64_t(0)); | 368 DEFINE_THREAD_SAFE_STATIC_LOCAL(int64_t, processTotal, new int64_t(0)); |
369 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); | 369 DEFINE_THREAD_SAFE_STATIC_LOCAL(Mutex, mutex, new Mutex); |
370 { | 370 { |
371 MutexLocker locker(mutex); | 371 MutexLocker locker(mutex); |
372 | 372 |
373 processTotal += diff; | 373 processTotal += diff; |
374 DCHECK_GE(processTotal, 0) << "total amount = " << processTotal | 374 DCHECK_GE(processTotal, 0) |
375 << ", diff = " << diff; | 375 << "total amount = " << processTotal << ", diff = " << diff; |
376 } | 376 } |
377 #endif | 377 #endif |
378 | 378 |
379 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(diff); | 379 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(diff); |
380 } | 380 } |
381 | 381 |
382 void V8Initializer::initializeMainThread() { | 382 void V8Initializer::initializeMainThread() { |
383 ASSERT(isMainThread()); | 383 ASSERT(isMainThread()); |
384 | 384 |
385 WTF::ArrayBufferContents::initialize(adjustAmountOfExternalAllocatedMemory); | 385 WTF::ArrayBufferContents::initialize(adjustAmountOfExternalAllocatedMemory); |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
514 v8::Isolate::kMessageLog); | 514 v8::Isolate::kMessageLog); |
515 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 515 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
516 | 516 |
517 uint32_t here; | 517 uint32_t here; |
518 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - | 518 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here) - |
519 kWorkerMaxStackSize); | 519 kWorkerMaxStackSize); |
520 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 520 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
521 } | 521 } |
522 | 522 |
523 } // namespace blink | 523 } // namespace blink |
OLD | NEW |