Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(49)

Side by Side Diff: third_party/WebKit/Source/core/workers/WorkerBackingThread.cpp

Issue 2841443005: [Bindings] Create and use V8 context snapshots (Closed)
Patch Set: Rebase Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/V8ContextSnapshot.h"
9 #include "bindings/core/v8/V8GCController.h" 10 #include "bindings/core/v8/V8GCController.h"
10 #include "bindings/core/v8/V8IdleTaskRunner.h" 11 #include "bindings/core/v8/V8IdleTaskRunner.h"
11 #include "bindings/core/v8/V8Initializer.h" 12 #include "bindings/core/v8/V8Initializer.h"
12 #include "core/inspector/WorkerThreadDebugger.h" 13 #include "core/inspector/WorkerThreadDebugger.h"
13 #include "core/workers/WorkerBackingThreadStartupData.h" 14 #include "core/workers/WorkerBackingThreadStartupData.h"
14 #include "platform/CrossThreadFunctional.h" 15 #include "platform/CrossThreadFunctional.h"
15 #include "platform/RuntimeEnabledFeatures.h" 16 #include "platform/RuntimeEnabledFeatures.h"
16 #include "platform/WebThreadSupportingGC.h" 17 #include "platform/WebThreadSupportingGC.h"
17 #include "platform/bindings/V8PerIsolateData.h" 18 #include "platform/bindings/V8PerIsolateData.h"
18 #include "platform/wtf/PtrUtil.h" 19 #include "platform/wtf/PtrUtil.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
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::InitializeOnBackingThread( 62 void WorkerBackingThread::InitializeOnBackingThread(
62 const WorkerBackingThreadStartupData& startup_data) { 63 const WorkerBackingThreadStartupData& startup_data) {
63 DCHECK(backing_thread_->IsCurrentThread()); 64 DCHECK(backing_thread_->IsCurrentThread());
64 backing_thread_->InitializeOnThread(); 65 backing_thread_->InitializeOnThread();
65 66
66 DCHECK(!isolate_); 67 DCHECK(!isolate_);
68 // TODO(peria): Replace GetReferenceTable with nullptr.
69 // (http://crbug.com/v8/6448)
67 isolate_ = V8PerIsolateData::Initialize( 70 isolate_ = V8PerIsolateData::Initialize(
68 backing_thread_->PlatformThread().GetWebTaskRunner()); 71 backing_thread_->PlatformThread().GetWebTaskRunner(),
72 V8ContextSnapshot::GetReferenceTable(),
73 V8PerIsolateData::V8ContextSnapshotMode::kDontUseSnapshot);
69 AddWorkerIsolate(isolate_); 74 AddWorkerIsolate(isolate_);
70 V8Initializer::InitializeWorker(isolate_); 75 V8Initializer::InitializeWorker(isolate_);
71 76
72 ThreadState::Current()->RegisterTraceDOMWrappers( 77 ThreadState::Current()->RegisterTraceDOMWrappers(
73 isolate_, V8GCController::TraceDOMWrappers, 78 isolate_, V8GCController::TraceDOMWrappers,
74 ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque, 79 ScriptWrappableVisitor::InvalidateDeadObjectsInMarkingDeque,
75 ScriptWrappableVisitor::PerformCleanup); 80 ScriptWrappableVisitor::PerformCleanup);
76 if (RuntimeEnabledFeatures::V8IdleTasksEnabled()) 81 if (RuntimeEnabledFeatures::V8IdleTasksEnabled())
77 V8PerIsolateData::EnableIdleTasks( 82 V8PerIsolateData::EnableIdleTasks(
78 isolate_, WTF::WrapUnique(new V8IdleTaskRunner( 83 isolate_, WTF::WrapUnique(new V8IdleTaskRunner(
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 128
124 // static 129 // static
125 void WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates( 130 void WorkerBackingThread::SetRAILModeOnWorkerThreadIsolates(
126 v8::RAILMode rail_mode) { 131 v8::RAILMode rail_mode) {
127 MutexLocker lock(IsolatesMutex()); 132 MutexLocker lock(IsolatesMutex());
128 for (v8::Isolate* isolate : Isolates()) 133 for (v8::Isolate* isolate : Isolates())
129 isolate->SetRAILMode(rail_mode); 134 isolate->SetRAILMode(rail_mode);
130 } 135 }
131 136
132 } // namespace blink 137 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/exported/WebV8ContextSnapshot.cpp ('k') | third_party/WebKit/Source/modules/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698