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

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

Issue 2703183002: Factor out gin::IsolateHolder's constructor
Patch Set: fix WorkerBackingThread Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "bindings/core/v8/V8Binding.h" 7 #include "bindings/core/v8/V8Binding.h"
8 #include "bindings/core/v8/V8GCController.h" 8 #include "bindings/core/v8/V8GCController.h"
9 #include "bindings/core/v8/V8IdleTaskRunner.h" 9 #include "bindings/core/v8/V8IdleTaskRunner.h"
10 #include "bindings/core/v8/V8Initializer.h" 10 #include "bindings/core/v8/V8Initializer.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 bool shouldCallGCOnShutdown) 54 bool shouldCallGCOnShutdown)
55 : m_backingThread(WebThreadSupportingGC::createForThread(thread)), 55 : m_backingThread(WebThreadSupportingGC::createForThread(thread)),
56 m_isOwningThread(false), 56 m_isOwningThread(false),
57 m_shouldCallGCOnShutdown(shouldCallGCOnShutdown) {} 57 m_shouldCallGCOnShutdown(shouldCallGCOnShutdown) {}
58 58
59 WorkerBackingThread::~WorkerBackingThread() {} 59 WorkerBackingThread::~WorkerBackingThread() {}
60 60
61 void WorkerBackingThread::initialize() { 61 void WorkerBackingThread::initialize() {
62 DCHECK(!m_isolate); 62 DCHECK(!m_isolate);
63 m_backingThread->initialize(); 63 m_backingThread->initialize();
64 m_isolate = V8PerIsolateData::initialize( 64 WebTaskRunner* taskRunner =
65 m_backingThread->platformThread().getWebTaskRunner()); 65 backingThread().platformThread().getWebTaskRunner();
66 m_isolate = V8PerIsolateData::initialize(WTF::makeUnique<gin::IsolateHolder>(
67 taskRunner ? taskRunner->toSingleThreadTaskRunner() : nullptr));
66 addWorkerIsolate(m_isolate); 68 addWorkerIsolate(m_isolate);
67 V8Initializer::initializeWorker(m_isolate); 69 V8Initializer::initializeWorker(m_isolate);
68 70
69 ThreadState::current()->registerTraceDOMWrappers( 71 ThreadState::current()->registerTraceDOMWrappers(
70 m_isolate, V8GCController::traceDOMWrappers, 72 m_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 m_isolate, WTF::wrapUnique(new V8IdleTaskRunner( 77 m_isolate, WTF::wrapUnique(new V8IdleTaskRunner(
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 110
109 // static 111 // static
110 void WorkerBackingThread::setRAILModeOnWorkerThreadIsolates( 112 void WorkerBackingThread::setRAILModeOnWorkerThreadIsolates(
111 v8::RAILMode railMode) { 113 v8::RAILMode railMode) {
112 MutexLocker lock(isolatesMutex()); 114 MutexLocker lock(isolatesMutex());
113 for (v8::Isolate* isolate : isolates()) 115 for (v8::Isolate* isolate : isolates())
114 isolate->SetRAILMode(railMode); 116 isolate->SetRAILMode(railMode);
115 } 117 }
116 118
117 } // namespace blink 119 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/bindings/core/v8/V8PerIsolateData.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698