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

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

Issue 2053273002: Remove WorkerBackingThread::scriptCount (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 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
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 bcb8193a6c51b06ea26ed5dde83ca6aa64a73a36..c862eb2915d0f5aec5188a86ed7df6ea9eb4089b 100644
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
@@ -390,17 +390,10 @@ void WorkerThread::terminateInternal(TerminationMode mode)
// scope is already disposed, so we don't have to explicitly terminate the
// worker execution.
//
- // (2) |workerScriptCount() == 1|: If other WorkerGlobalScopes are running
- // on the worker thread, we should not terminate the worker execution. This
- // condition is not entirely correct because other scripts can be being
- // initialized or terminated simuletaneously. Though this function itself is
- // protected by a mutex, it is possible that |workerScriptCount()| here is
- // not consistent with that in |initialize| and |shutdown|.
- //
- // (3) |m_runningDebuggerTask|: Terminating during debugger task may lead to
+ // (2) |m_runningDebuggerTask|: Terminating during debugger task may lead to
// crash due to heavy use of v8 api in debugger. Any debugger task is
// guaranteed to finish, so we can wait for the completion.
- bool shouldScheduleToTerminateExecution = !m_readyToShutdown && (workerBackingThread().workerScriptCount() == 1) && !m_runningDebuggerTask;
+ bool shouldScheduleToTerminateExecution = !m_readyToShutdown && !m_runningDebuggerTask;
if (shouldScheduleToTerminateExecution) {
if (mode == TerminationMode::Forcible) {
@@ -453,7 +446,8 @@ void WorkerThread::initializeOnWorkerThread(PassOwnPtr<WorkerThreadStartupData>
return;
}
- workerBackingThread().attach();
+ if (isOwningBackingThread())
+ workerBackingThread().initialize();
if (shouldAttachThreadDebugger())
V8PerIsolateData::from(isolate())->setThreadDebugger(adoptPtr(new WorkerThreadDebugger(this, isolate())));
@@ -538,7 +532,8 @@ void WorkerThread::performShutdownOnWorkerThread()
m_workerGlobalScope->notifyContextDestroyed();
m_workerGlobalScope = nullptr;
- workerBackingThread().detach();
+ if (isOwningBackingThread())
+ workerBackingThread().shutdown();
// We must not touch workerBackingThread() from now on.
m_microtaskRunner = nullptr;
« no previous file with comments | « third_party/WebKit/Source/core/workers/WorkerThread.h ('k') | third_party/WebKit/Source/modules/ModulesInitializer.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698