Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1708)

Unified Diff: Source/core/workers/WorkerThread.h

Issue 1168843003: Minor cleanup for WorkerThread::stop (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
« no previous file with comments | « no previous file | Source/core/workers/WorkerThread.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698