Chromium Code Reviews| Index: Source/core/workers/WorkerThread.h |
| diff --git a/Source/core/workers/WorkerThread.h b/Source/core/workers/WorkerThread.h |
| index 0753bc3b766c0ec862f00feaafe5d1c87020077d..fa0f296e5ac51c0c55210f5d51d5e346f7e95be6 100644 |
| --- a/Source/core/workers/WorkerThread.h |
| +++ b/Source/core/workers/WorkerThread.h |
| @@ -60,6 +60,7 @@ class CORE_EXPORT WorkerThread : public RefCounted<WorkerThread> { |
| public: |
| virtual ~WorkerThread(); |
| + // Called on the main thread. |
|
Noel Gordon
2015/06/11 07:07:03
Is this true, or is this an implicit statement of
kinuko
2015/06/11 08:59:44
It just states how our system works today. Current
|
| virtual void start(PassOwnPtr<WorkerThreadStartupData>); |
| virtual void stop(); |
| @@ -79,6 +80,10 @@ public: |
| WebWaitableEvent* shutdownEvent() { return m_shutdownEvent.get(); } |
| WebWaitableEvent* terminationEvent() { return m_terminationEvent.get(); } |
| + |
| + // Called in shutdown sequence. Internally calls stop() (or stopInternal) |
| + // and wait (by *blocking* the calling thread) until the worker(s) is/are |
| + // shut down. |
| void terminateAndWait(); |
| static void terminateAndWaitForAllWorkers(); |
| @@ -103,6 +108,9 @@ public: |
| void didLeaveNestedLoop(); |
| WorkerGlobalScope* workerGlobalScope() const { return m_workerGlobalScope.get(); } |
| + |
| + // Returns true once stop() (or one of the terminate* methods which |
| + // internally calls stop) is called. |
| bool terminated(); |
| // Number of active worker threads. |
| @@ -132,9 +140,10 @@ protected: |
| private: |
| friend class WorkerMicrotaskRunner; |
| - void stopInShutdownSequence(); |
| + // Called on the main thread. |
| void stopInternal(); |
| + // Called on the worker thread. |
| void initialize(PassOwnPtr<WorkerThreadStartupData>); |
| void shutdown(); |
| void performIdleWork(double deadlineSeconds); |