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 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
344 } | 344 } |
345 | 345 |
346 void Free(void* data, size_t size) override | 346 void Free(void* data, size_t size) override |
347 { | 347 { |
348 WTF::ArrayBufferContents::freeMemory(data, size); | 348 WTF::ArrayBufferContents::freeMemory(data, size); |
349 } | 349 } |
350 }; | 350 }; |
351 | 351 |
352 } // namespace | 352 } // namespace |
353 | 353 |
| 354 static void adjustAmountOfExternalAllocatedMemory(int size) |
| 355 { |
| 356 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); |
| 357 } |
| 358 |
354 void V8Initializer::initializeMainThread() | 359 void V8Initializer::initializeMainThread() |
355 { | 360 { |
356 ASSERT(isMainThread()); | 361 ASSERT(isMainThread()); |
357 | 362 |
| 363 WTF::ArrayBufferContents::initialize(adjustAmountOfExternalAllocatedMemory); |
| 364 |
358 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); | 365 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); |
359 auto v8ExtrasMode = RuntimeEnabledFeatures::experimentalV8ExtrasEnabled() ?
gin::IsolateHolder::kStableAndExperimentalV8Extras : gin::IsolateHolder::kStable
V8Extras; | 366 auto v8ExtrasMode = RuntimeEnabledFeatures::experimentalV8ExtrasEnabled() ?
gin::IsolateHolder::kStableAndExperimentalV8Extras : gin::IsolateHolder::kStable
V8Extras; |
360 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, v8ExtrasM
ode, &arrayBufferAllocator); | 367 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, v8ExtrasM
ode, &arrayBufferAllocator); |
361 | 368 |
362 v8::Isolate* isolate = V8PerIsolateData::initialize(); | 369 v8::Isolate* isolate = V8PerIsolateData::initialize(); |
363 | 370 |
364 initializeV8Common(isolate); | 371 initializeV8Common(isolate); |
365 | 372 |
366 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); | 373 isolate->SetFatalErrorHandler(reportFatalErrorInMainThread); |
367 isolate->AddMessageListener(messageHandlerInMainThread); | 374 isolate->AddMessageListener(messageHandlerInMainThread); |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
447 | 454 |
448 isolate->AddMessageListener(messageHandlerInWorker); | 455 isolate->AddMessageListener(messageHandlerInWorker); |
449 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); | 456 isolate->SetFatalErrorHandler(reportFatalErrorInWorker); |
450 | 457 |
451 uint32_t here; | 458 uint32_t here; |
452 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); | 459 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi
ze / sizeof(uint32_t*))); |
453 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 460 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
454 } | 461 } |
455 | 462 |
456 } // namespace blink | 463 } // namespace blink |
OLD | NEW |