Skip to content

Commit

Permalink
Move didStopWorkerRunLoop out of WorkerScriptController
Browse files Browse the repository at this point in the history
Now that we no longer have real worker run loop and all we're doing
in didStopWorkerRunLoop is deleting per-worker-thread IPC dispatchers
the timing should be no longer that sensitive; we should be able to call
it somewhere after we actually stopped event loop / before we stop the thread.

BUG=571614

Review URL: https://codereview.chromium.org/1547123002

Cr-Commit-Position: refs/heads/master@{#366930}
  • Loading branch information
kinu authored and Commit bot committed Dec 27, 2015
1 parent b1c680b commit a54fe37
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -129,10 +129,6 @@ void WorkerScriptController::dispose()

m_world->dispose();

// The corresponding call to didStartRunLoop() is in WorkerThread::initialize().
// See http://webkit.org/b/83104#c14 for why this is here.
m_workerGlobalScope->thread()->didStopRunLoop();

if (isContextInitialized())
m_scriptState->disposePerContextData();
}
Expand Down
5 changes: 4 additions & 1 deletion third_party/WebKit/Source/core/workers/WorkerThread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -295,7 +295,6 @@ void WorkerThread::initialize(PassOwnPtr<WorkerThreadStartupData> startupData)
m_workerGlobalScope = createWorkerGlobalScope(startupData);
m_workerGlobalScope->scriptLoaded(sourceCode.length(), cachedMetaData.get() ? cachedMetaData->size() : 0);

// The corresponding call to didStopRunLoop() is in ~WorkerScriptController().
didStartRunLoop();

// Notify proxy that a new WorkerGlobalScope has been created and started.
Expand Down Expand Up @@ -334,6 +333,10 @@ void WorkerThread::shutdown()

workerGlobalScope()->dispose();

// This should be called after the WorkerGlobalScope's disposed (which may
// trigger some last-minutes cleanups) and before the thread actually stops.
didStopRunLoop();

backingThread().removeTaskObserver(m_microtaskRunner.get());
postTask(BLINK_FROM_HERE, createSameThreadTask(&WorkerThread::performShutdownTask, this));
}
Expand Down

0 comments on commit a54fe37

Please sign in to comment.