Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "core/workers/WorkerBackingThread.h" | 5 #include "core/workers/WorkerBackingThread.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include "bindings/core/v8/V8BindingForCore.h" | 8 #include "bindings/core/v8/V8BindingForCore.h" |
| 9 #include "bindings/core/v8/V8GCController.h" | 9 #include "bindings/core/v8/V8GCController.h" |
| 10 #include "bindings/core/v8/V8IdleTaskRunner.h" | 10 #include "bindings/core/v8/V8IdleTaskRunner.h" |
| 11 #include "bindings/core/v8/V8Initializer.h" | 11 #include "bindings/core/v8/V8Initializer.h" |
| 12 #include "bindings/core/v8/V8SnapshotCreator.h" | |
| 12 #include "core/inspector/WorkerThreadDebugger.h" | 13 #include "core/inspector/WorkerThreadDebugger.h" |
| 13 #include "platform/CrossThreadFunctional.h" | 14 #include "platform/CrossThreadFunctional.h" |
| 14 #include "platform/RuntimeEnabledFeatures.h" | 15 #include "platform/RuntimeEnabledFeatures.h" |
| 15 #include "platform/WebThreadSupportingGC.h" | 16 #include "platform/WebThreadSupportingGC.h" |
| 16 #include "platform/bindings/V8PerIsolateData.h" | 17 #include "platform/bindings/V8PerIsolateData.h" |
| 17 #include "platform/wtf/PtrUtil.h" | 18 #include "platform/wtf/PtrUtil.h" |
| 18 #include "public/platform/Platform.h" | 19 #include "public/platform/Platform.h" |
| 19 #include "public/platform/WebTraceLocation.h" | 20 #include "public/platform/WebTraceLocation.h" |
| 20 | 21 |
| 21 namespace blink { | 22 namespace blink { |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 55 : backing_thread_(WebThreadSupportingGC::CreateForThread(thread)), | 56 : backing_thread_(WebThreadSupportingGC::CreateForThread(thread)), |
| 56 is_owning_thread_(false), | 57 is_owning_thread_(false), |
| 57 should_call_gc_on_shutdown_(should_call_gc_on_shutdown) {} | 58 should_call_gc_on_shutdown_(should_call_gc_on_shutdown) {} |
| 58 | 59 |
| 59 WorkerBackingThread::~WorkerBackingThread() {} | 60 WorkerBackingThread::~WorkerBackingThread() {} |
| 60 | 61 |
| 61 void WorkerBackingThread::Initialize() { | 62 void WorkerBackingThread::Initialize() { |
| 62 DCHECK(!isolate_); | 63 DCHECK(!isolate_); |
| 63 backing_thread_->Initialize(); | 64 backing_thread_->Initialize(); |
| 64 isolate_ = V8PerIsolateData::Initialize( | 65 isolate_ = V8PerIsolateData::Initialize( |
| 65 backing_thread_->PlatformThread().GetWebTaskRunner()); | 66 backing_thread_->PlatformThread().GetWebTaskRunner(), |
| 67 V8SnapshotCreator::GetReferenceTable(), gin::IsolateHolder::kUseSnapshot); | |
|
haraken
2017/05/20 19:10:03
gin::IsolateHolder::kUseSnapshot won't make sense
peria
2017/05/30 08:25:44
Done.
| |
| 66 AddWorkerIsolate(isolate_); | 68 AddWorkerIsolate(isolate_); |
| 67 V8Initializer::InitializeWorker(isolate_); | 69 V8Initializer::InitializeWorker(isolate_); |
| 68 | 70 |
| 69 ThreadState::Current()->RegisterTraceDOMWrappers( | 71 ThreadState::Current()->RegisterTraceDOMWrappers( |
| 70 isolate_, V8GCController::TraceDOMWrappers, | 72 isolate_, V8GCController::TraceDOMWrappers, |
| 71 ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque, | 73 ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque, |
| 72 ScriptWrappableVisitor::PerformCleanup); | 74 ScriptWrappableVisitor::PerformCleanup); |
| 73 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) | 75 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) |
| 74 V8PerIsolateData::EnableIdleTasks( | 76 V8PerIsolateData::EnableIdleTasks( |
| 75 isolate_, WTF::WrapUnique(new V8IdleTaskRunner( | 77 isolate_, WTF::WrapUnique(new V8IdleTaskRunner( |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 108 | 110 |
| 109 // static | 111 // static |
| 110 void WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates( | 112 void WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates( |
| 111 v8::RAILMode rail_mode) { | 113 v8::RAILMode rail_mode) { |
| 112 MutexLocker lock(IsolatesMutex()); | 114 MutexLocker lock(IsolatesMutex()); |
| 113 for (v8::Isolate* isolate : Isolates()) | 115 for (v8::Isolate* isolate : Isolates()) |
| 114 isolate->SetRAILMode(rail_mode); | 116 isolate->SetRAILMode(rail_mode); |
| 115 } | 117 } |
| 116 | 118 |
| 117 } // namespace blink | 119 } // namespace blink |
| OLD | NEW |