Chromium Code Reviews| Index: Source/core/workers/WorkerThread.cpp |
| diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp |
| index f38d97ce27cd31d69c1de723267a6bb3e6cd1235..6011f90977e6e6cd99aff39b8a5a0920357ae8b3 100644 |
| --- a/Source/core/workers/WorkerThread.cpp |
| +++ b/Source/core/workers/WorkerThread.cpp |
| @@ -29,8 +29,6 @@ |
| #include "core/workers/WorkerThread.h" |
| #include "bindings/core/v8/ScriptSourceCode.h" |
| -#include "bindings/core/v8/V8GCController.h" |
| -#include "bindings/core/v8/V8Initializer.h" |
| #include "core/dom/Microtask.h" |
| #include "core/inspector/InspectorInstrumentation.h" |
| #include "core/inspector/WorkerInspectorController.h" |
| @@ -220,7 +218,7 @@ void WorkerThread::initialize(PassOwnPtr<WorkerThreadStartupData> startupData) |
| m_microtaskRunner = adoptPtr(new WorkerMicrotaskRunner(this)); |
| backingThread().addTaskObserver(m_microtaskRunner.get()); |
| - backingThread().initialize(); |
| + initializeBackingThread(); |
| m_isolate = initializeIsolate(); |
| m_workerGlobalScope = createWorkerGlobalScope(startupData); |
| @@ -274,7 +272,7 @@ void WorkerThread::shutdown() |
| m_workerGlobalScope = nullptr; |
| backingThread().removeTaskObserver(m_microtaskRunner.get()); |
| - backingThread().shutdown(); |
| + shutdownBackingThread(); |
| destroyIsolate(); |
| m_microtaskRunner = nullptr; |
| @@ -355,6 +353,16 @@ void WorkerThread::didStopRunLoop() |
| Platform::current()->didStopWorkerRunLoop(); |
| } |
| +void WorkerThread::initializeBackingThread() |
| +{ |
| + backingThread().initialize(); |
| +} |
| + |
| +void WorkerThread::shutdownBackingThread() |
| +{ |
| + backingThread().shutdown(); |
| +} |
| + |
| void WorkerThread::terminateAndWaitForAllWorkers() |
| { |
| // Keep this lock to prevent WorkerThread instances from being destroyed. |
| @@ -405,32 +413,23 @@ void WorkerThread::postDelayedTask(const WebTraceLocation& location, PassOwnPtr< |
| backingThread().postDelayedTask(location, WorkerThreadTask::create(*this, task, true).leakPtr(), delayMs); |
| } |
| -v8::Isolate* WorkerThread::initializeIsolate() |
| +PassOwnPtr<WorkerV8Isolate> WorkerThread::initializeIsolate() |
| { |
| ASSERT(isCurrentThread()); |
| ASSERT(!m_isolate); |
| - v8::Isolate* isolate = V8PerIsolateData::initialize(); |
| - V8Initializer::initializeWorker(isolate); |
| - |
| - m_interruptor = adoptPtr(new V8IsolateInterruptor(isolate)); |
| - ThreadState::current()->addInterruptor(m_interruptor.get()); |
| - ThreadState::current()->registerTraceDOMWrappers(isolate, V8GCController::traceDOMWrappers); |
| - |
| - return isolate; |
| + return WorkerV8Isolate::createDefault(); |
| } |
| void WorkerThread::willDestroyIsolate() |
| { |
| ASSERT(isCurrentThread()); |
| ASSERT(m_isolate); |
| - V8PerIsolateData::willBeDestroyed(m_isolate); |
| - ThreadState::current()->removeInterruptor(m_interruptor.get()); |
| + m_isolate->willDestroy(); |
| } |
| void WorkerThread::destroyIsolate() |
| { |
| ASSERT(isCurrentThread()); |
| - V8PerIsolateData::destroy(m_isolate); |
| m_isolate = nullptr; |
|
kinuko
2015/05/26 14:41:25
nit: m_isolate is now OwnPtr, m_isolate.clear() mi
sadrul
2015/05/27 01:28:00
Done.
|
| } |
| @@ -438,7 +437,7 @@ void WorkerThread::terminateV8Execution() |
| { |
| ASSERT(isMainThread()); |
| m_workerGlobalScope->script()->willScheduleExecutionTermination(); |
| - v8::V8::TerminateExecution(m_isolate); |
| + m_isolate->terminateExecution(); |
| } |
| void WorkerThread::appendDebuggerTask(PassOwnPtr<WebThread::Task> task) |