Chromium Code Reviews| Index: third_party/WebKit/Source/core/workers/WorkerThread.h |
| diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.h b/third_party/WebKit/Source/core/workers/WorkerThread.h |
| index 0e720f55ab3c2831144d6885c220437b0cdba8e3..696696c0197567a046aacb0667ca3414ed9d1724 100644 |
| --- a/third_party/WebKit/Source/core/workers/WorkerThread.h |
| +++ b/third_party/WebKit/Source/core/workers/WorkerThread.h |
| @@ -58,6 +58,9 @@ enum WorkerThreadStartMode { |
| // can access the lower thread infrastructure via an implementation of this |
| // abstract class. Multiple WorkerThreads can share one WorkerBackingThread. |
| // See WorkerBackingThread.h for more details. |
| +// |
| +// WorkerThread start and termination must be initiated on the main thread and |
| +// an actual task is executed on the worker thread. |
| class CORE_EXPORT WorkerThread { |
| public: |
| virtual ~WorkerThread(); |
| @@ -72,8 +75,8 @@ public: |
| void terminateAndWait(); |
| static void terminateAndWaitForAllWorkers(); |
| - // Called on the worker thread for WorkerGlobleScope::close(). |
| - void terminateFromWorkerThread(); |
| + // Called on the worker thread. Disposes |m_workerGlobalScope|. |
| + void prepareForShutdown(); |
|
kinuko
2016/05/24 09:07:49
nit: could we make WorkerMicroTaskRunner a private
nhiroki
2016/05/24 13:36:06
Agreed. I'll make a separate CL for this.
nhiroki
2016/05/25 01:58:33
Uploaded a CL: https://codereview.chromium.org/200
|
| virtual WorkerBackingThread& workerBackingThread() = 0; |
| virtual bool shouldAttachThreadDebugger() const { return true; } |
| @@ -129,27 +132,27 @@ private: |
| // Called on the worker thread. |
| void initialize(PassOwnPtr<WorkerThreadStartupData>); |
| - void shutdown(); |
| void performTask(std::unique_ptr<ExecutionContextTask>, bool isInstrumented); |
| void performShutdownTask(); |
| void runDebuggerTask(std::unique_ptr<CrossThreadClosure>); |
| void runDebuggerTaskDontWait(); |
| - bool m_started; |
| - bool m_terminated; |
| - bool m_shutdown; |
| - bool m_pausedInDebugger; |
| - bool m_runningDebuggerTask; |
| - bool m_shouldTerminateV8Execution; |
| + bool m_started = false; |
| + bool m_terminated = false; |
| + bool m_readyToShutdown = false; |
| + bool m_pausedInDebugger = false; |
| + bool m_runningDebuggerTask = false; |
| + bool m_shouldTerminateV8Execution = false; |
| + |
| OwnPtr<InspectorTaskRunner> m_inspectorTaskRunner; |
| OwnPtr<WebThread::TaskObserver> m_microtaskRunner; |
| RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
| WorkerReportingProxy& m_workerReportingProxy; |
| - // This lock protects |m_workerGlobalScope|, |m_terminated|, |m_shutdown|, |
| - // |m_runningDebuggerTask|, |m_shouldTerminateV8Execution| and |
| - // |m_microtaskRunner|. |
| + // This lock protects |m_workerGlobalScope|, |m_terminated|, |
| + // |m_readyToShutdown|, |m_runningDebuggerTask|, |
| + // |m_shouldTerminateV8Execution| and |m_microtaskRunner|. |
| Mutex m_threadStateMutex; |
| Persistent<WorkerGlobalScope> m_workerGlobalScope; |