Chromium Code Reviews| Index: third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp |
| diff --git a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp |
| index 49e0f585a19e248eab694781569c82fcd660ff48..8cd5a6cc3282ebde92267efb98d530865669af5e 100644 |
| --- a/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp |
| +++ b/third_party/WebKit/Source/bindings/core/v8/V8Initializer.cpp |
| @@ -40,6 +40,7 @@ |
| #include "bindings/core/v8/V8ErrorHandler.h" |
| #include "bindings/core/v8/V8GCController.h" |
| #include "bindings/core/v8/V8IdleTaskRunner.h" |
| +#include "bindings/core/v8/V8SnapshotUtil.h" |
| #include "bindings/core/v8/WorkerOrWorkletScriptController.h" |
| #include "core/dom/Document.h" |
| #include "core/dom/ExecutionContext.h" |
| @@ -380,6 +381,9 @@ static void InitializeV8Common(v8::Isolate* isolate) { |
| isolate->SetUseCounterCallback(&UseCounterCallback); |
| isolate->SetWasmModuleCallback(WasmModuleOverride); |
| isolate->SetWasmInstanceCallback(WasmInstanceOverride); |
| + |
| + v8::HandleScope handle_scope(isolate); |
| + V8SnapshotUtil::EnsureInterfaceTemplates(isolate); |
| } |
| namespace { |
| @@ -434,14 +438,21 @@ void V8Initializer::InitializeMainThread() { |
| v8_extras_mode, &array_buffer_allocator); |
| // NOTE: Some threads (namely utility threads) don't have a scheduler. |
| - WebScheduler* scheduler = Platform::Current()->CurrentThread()->Scheduler(); |
| + Platform* platform = Platform::Current(); |
| + WebThread* thread = platform->CurrentThread(); |
| + WebScheduler* scheduler = thread ? thread->Scheduler() : nullptr; |
|
Yuki
2017/06/20 14:20:11
Why |thread| can be null?
peria
2017/06/21 07:19:16
In taking snapshot process, we have no implementat
|
| + |
| // When timer task runner is used for PerIsolateData, GC tasks are getting |
| // throttled and memory usage goes up. For now we're using loading task queue |
| // to prevent this. |
| // TODO(altimin): Consider switching to timerTaskRunner here. |
| v8::Isolate* isolate = V8PerIsolateData::Initialize( |
| scheduler ? scheduler->LoadingTaskRunner() |
| - : Platform::Current()->CurrentThread()->GetWebTaskRunner()); |
| + : thread ? thread->GetWebTaskRunner() : nullptr, |
| + V8SnapshotUtil::GetReferenceTable(), |
| + platform->IsToTakeV8Snapshot() |
| + ? V8PerIsolateData::V8ContextMode::kTakeSnapshot |
| + : V8PerIsolateData::V8ContextMode::kUseSnapshot); |
| InitializeV8Common(isolate); |