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 "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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 WebThreadSupportingGC::createForThread(thread, | 57 WebThreadSupportingGC::createForThread(thread, |
58 BlinkGC::PerThreadHeapMode)), | 58 BlinkGC::PerThreadHeapMode)), |
59 m_isOwningThread(false), | 59 m_isOwningThread(false), |
60 m_shouldCallGCOnShutdown(shouldCallGCOnShutdown) {} | 60 m_shouldCallGCOnShutdown(shouldCallGCOnShutdown) {} |
61 | 61 |
62 WorkerBackingThread::~WorkerBackingThread() {} | 62 WorkerBackingThread::~WorkerBackingThread() {} |
63 | 63 |
64 void WorkerBackingThread::initialize() { | 64 void WorkerBackingThread::initialize() { |
65 DCHECK(!m_isolate); | 65 DCHECK(!m_isolate); |
66 m_backingThread->initialize(); | 66 m_backingThread->initialize(); |
67 m_isolate = V8PerIsolateData::initialize(); | 67 m_isolate = V8PerIsolateData::initialize( |
| 68 m_backingThread->platformThread().getWebTaskRunner()); |
68 addWorkerIsolate(m_isolate); | 69 addWorkerIsolate(m_isolate); |
69 V8Initializer::initializeWorker(m_isolate); | 70 V8Initializer::initializeWorker(m_isolate); |
70 | 71 |
71 std::unique_ptr<V8IsolateInterruptor> interruptor = | 72 std::unique_ptr<V8IsolateInterruptor> interruptor = |
72 WTF::makeUnique<V8IsolateInterruptor>(m_isolate); | 73 WTF::makeUnique<V8IsolateInterruptor>(m_isolate); |
73 ThreadState::current()->addInterruptor(std::move(interruptor)); | 74 ThreadState::current()->addInterruptor(std::move(interruptor)); |
74 ThreadState::current()->registerTraceDOMWrappers( | 75 ThreadState::current()->registerTraceDOMWrappers( |
75 m_isolate, V8GCController::traceDOMWrappers, nullptr, nullptr); | 76 m_isolate, V8GCController::traceDOMWrappers, nullptr, nullptr); |
76 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) | 77 if (RuntimeEnabledFeatures::v8IdleTasksEnabled()) |
77 V8PerIsolateData::enableIdleTasks( | 78 V8PerIsolateData::enableIdleTasks( |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 | 112 |
112 // static | 113 // static |
113 void WorkerBackingThread::setRAILModeOnWorkerThreadIsolates( | 114 void WorkerBackingThread::setRAILModeOnWorkerThreadIsolates( |
114 v8::RAILMode railMode) { | 115 v8::RAILMode railMode) { |
115 MutexLocker lock(isolatesMutex()); | 116 MutexLocker lock(isolatesMutex()); |
116 for (v8::Isolate* isolate : isolates()) | 117 for (v8::Isolate* isolate : isolates()) |
117 isolate->SetRAILMode(railMode); | 118 isolate->SetRAILMode(railMode); |
118 } | 119 } |
119 | 120 |
120 } // namespace blink | 121 } // namespace blink |
OLD | NEW |