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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
380 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :DontInitialize, data); | 380 WTF::ArrayBufferContents::allocateMemory(size, WTF::ArrayBufferContents: :DontInitialize, data); |
381 return data; | 381 return data; |
382 } | 382 } |
383 | 383 |
384 virtual void Free(void* data, size_t size) override | 384 virtual void Free(void* data, size_t size) override |
385 { | 385 { |
386 WTF::ArrayBufferContents::freeMemory(data, size); | 386 WTF::ArrayBufferContents::freeMemory(data, size); |
387 } | 387 } |
388 }; | 388 }; |
389 | 389 |
390 void arrayBufferContentsAllocationListener(int size) | |
391 { | |
392 v8::Isolate::GetCurrent()->AdjustAmountOfExternalAllocatedMemory(size); | |
393 } | |
394 | |
390 } // namespace | 395 } // namespace |
391 | 396 |
392 void V8Initializer::initializeMainThreadIfNeeded() | 397 void V8Initializer::initializeMainThreadIfNeeded() |
393 { | 398 { |
394 ASSERT(isMainThread()); | 399 ASSERT(isMainThread()); |
395 | 400 |
396 static bool initialized = false; | 401 static bool initialized = false; |
397 if (initialized) | 402 if (initialized) |
398 return; | 403 return; |
399 initialized = true; | 404 initialized = true; |
400 | 405 |
401 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); | 406 DEFINE_STATIC_LOCAL(ArrayBufferAllocator, arrayBufferAllocator, ()); |
402 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, &arrayBuf ferAllocator); | 407 gin::IsolateHolder::Initialize(gin::IsolateHolder::kNonStrictMode, &arrayBuf ferAllocator); |
408 WTF::ArrayBufferContents::setAllocationListener(arrayBufferContentsAllocatio nListener); | |
haraken
2015/06/15 17:33:29
I'd move this to initializeWithoutV8 in WebKit.cpp
binji
2015/06/15 19:19:46
Done.
| |
403 | 409 |
404 v8::Isolate* isolate = V8PerIsolateData::initialize(); | 410 v8::Isolate* isolate = V8PerIsolateData::initialize(); |
405 | 411 |
406 initializeV8Common(isolate); | 412 initializeV8Common(isolate); |
407 | 413 |
408 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); | 414 v8::V8::SetFatalErrorHandler(reportFatalErrorInMainThread); |
409 v8::V8::AddMessageListener(messageHandlerInMainThread); | 415 v8::V8::AddMessageListener(messageHandlerInMainThread); |
410 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain Thread); | 416 v8::V8::SetFailedAccessCheckCallbackFunction(failedAccessCheckCallbackInMain Thread); |
411 v8::V8::SetAllowCodeGenerationFromStringsCallback(codeGenerationCheckCallbac kInMainThread); | 417 v8::V8::SetAllowCodeGenerationFromStringsCallback(codeGenerationCheckCallbac kInMainThread); |
412 | 418 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
474 | 480 |
475 v8::V8::AddMessageListener(messageHandlerInWorker); | 481 v8::V8::AddMessageListener(messageHandlerInWorker); |
476 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); | 482 v8::V8::SetFatalErrorHandler(reportFatalErrorInWorker); |
477 | 483 |
478 uint32_t here; | 484 uint32_t here; |
479 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); | 485 isolate->SetStackLimit(reinterpret_cast<uintptr_t>(&here - kWorkerMaxStackSi ze / sizeof(uint32_t*))); |
480 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); | 486 isolate->SetPromiseRejectCallback(promiseRejectHandlerInWorker); |
481 } | 487 } |
482 | 488 |
483 } // namespace blink | 489 } // namespace blink |
OLD | NEW |