| Index: Source/core/workers/WorkerThread.cpp
|
| diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp
|
| index 883944ff2e4caeac2a8c5b0f951d687984b8da7e..6f3c60ec1d5555a2b07659681c6ea7709b7eb421 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"
|
| @@ -316,7 +314,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);
|
| @@ -373,7 +371,7 @@ void WorkerThread::shutdown()
|
| m_workerGlobalScope = nullptr;
|
|
|
| backingThread().removeTaskObserver(m_microtaskRunner.get());
|
| - backingThread().shutdown();
|
| + shutdownBackingThread();
|
| destroyIsolate();
|
|
|
| m_microtaskRunner = nullptr;
|
| @@ -457,6 +455,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.
|
| @@ -507,40 +515,31 @@ 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;
|
| + m_isolate.clear();
|
| }
|
|
|
| void WorkerThread::terminateV8Execution()
|
| {
|
| ASSERT(isMainThread());
|
| m_workerGlobalScope->script()->willScheduleExecutionTermination();
|
| - v8::V8::TerminateExecution(m_isolate);
|
| + m_isolate->terminateExecution();
|
| }
|
|
|
| void WorkerThread::appendDebuggerTask(PassOwnPtr<WebThread::Task> task)
|
|
|