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 c57cb9117d3972875ac8086a9a3853e63fa1e955..752ff21cd5d89114e9063ec25611306eaa1852b7 100644 |
--- a/third_party/WebKit/Source/core/workers/WorkerThread.h |
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.h |
@@ -205,13 +205,22 @@ private: |
ExitCode getExitCodeForTesting(); |
// Accessed only on the main thread. |
- bool m_started = false; |
+ bool m_requestedToStart = false; |
// Set on the main thread and checked on both the main and worker threads. |
- bool m_terminated = false; |
- |
- // Set on the worker thread and checked on both the main and worker threads. |
- bool m_readyToShutdown = false; |
+ bool m_requestedToTerminate = false; |
+ |
+ // Represents the state of this worker thread. A caller may need to acquire |
+ // a lock |m_threadStateMutex| before accessing this: |
+ // - Only the worker thread can set this with the lock. |
+ // - The worker thread can read this without the lock. |
+ // - The main thread can read this with the lock. |
+ enum class ThreadState { |
+ NotStarted, |
+ Running, |
+ ReadyToShutdown, |
+ }; |
+ ThreadState m_threadState = ThreadState::NotStarted; |
// Accessed only on the worker thread. |
bool m_pausedInDebugger = false; |
@@ -229,8 +238,8 @@ private: |
RefPtr<WorkerLoaderProxy> m_workerLoaderProxy; |
WorkerReportingProxy& m_workerReportingProxy; |
- // This lock protects |m_globalScope|, |m_terminated|, |m_readyToShutdown|, |
- // |m_runningDebuggerTask|, |m_exitCode| and |m_microtaskRunner|. |
+ // This lock protects |m_globalScope|, |m_requestedToTerminate|, |
+ // |m_threadState|, |m_runningDebuggerTask| and |m_exitCode|. |
Mutex m_threadStateMutex; |
Persistent<ConsoleMessageStorage> m_consoleMessageStorage; |