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

Unified Diff: third_party/WebKit/Source/core/workers/WorkerThread.cpp

Issue 2006273003: Worker: Make WorkerMicrotaskRunner a private inner class of WorkerThread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 | « third_party/WebKit/Source/core/workers/WorkerThread.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/workers/WorkerThread.cpp
diff --git a/third_party/WebKit/Source/core/workers/WorkerThread.cpp b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
index e98767bbb1badde01a636a3c9a84cbd2c9d6f94d..f78e15e1b3a881a32c8cfc541a6a8a4588925e64 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -51,7 +51,7 @@
namespace blink {
-class WorkerMicrotaskRunner : public WebThread::TaskObserver {
+class WorkerThread::WorkerMicrotaskRunner : public WebThread::TaskObserver {
public:
explicit WorkerMicrotaskRunner(WorkerThread* workerThread)
: m_workerThread(workerThread)
@@ -238,7 +238,23 @@ void WorkerThread::initialize(PassOwnPtr<WorkerThreadStartupData> startupData)
postInitialize();
}
-void WorkerThread::performShutdownTask()
+void WorkerThread::prepareForShutdown()
+{
+ DCHECK(isCurrentThread());
+ {
+ MutexLocker lock(m_threadStateMutex);
+ if (m_readyToShutdown)
+ return;
+ m_readyToShutdown = true;
+ }
+
+ workerReportingProxy().willDestroyWorkerGlobalScope();
+ InspectorInstrumentation::allAsyncTasksCanceled(workerGlobalScope());
+ workerGlobalScope()->dispose();
+ workerBackingThread().backingThread().removeTaskObserver(m_microtaskRunner.get());
+}
+
+void WorkerThread::performShutdown()
{
DCHECK(isCurrentThread());
#if DCHECK_IS_ON
@@ -329,7 +345,7 @@ void WorkerThread::terminate()
m_inspectorTaskRunner->kill();
workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::prepareForShutdown, AllowCrossThreadAccess(this)));
- workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::performShutdownTask, AllowCrossThreadAccess(this)));
+ workerBackingThread().backingThread().postTask(BLINK_FROM_HERE, threadSafeBind(&WorkerThread::performShutdown, AllowCrossThreadAccess(this)));
}
void WorkerThread::terminateAndWait()
@@ -353,22 +369,6 @@ void WorkerThread::terminateAndWaitForAllWorkers()
thread->m_shutdownEvent->wait();
}
-void WorkerThread::prepareForShutdown()
-{
- DCHECK(isCurrentThread());
- {
- MutexLocker lock(m_threadStateMutex);
- if (m_readyToShutdown)
- return;
- m_readyToShutdown = true;
- }
-
- workerReportingProxy().willDestroyWorkerGlobalScope();
- InspectorInstrumentation::allAsyncTasksCanceled(workerGlobalScope());
- workerGlobalScope()->dispose();
- workerBackingThread().backingThread().removeTaskObserver(m_microtaskRunner.get());
-}
-
WorkerGlobalScope* WorkerThread::workerGlobalScope()
{
DCHECK(isCurrentThread());
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerThread.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698