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 62c4fd888ac86f03869271c109be5607ccb159c8..2697ed03c31de02f4fafe799903ce86dafea5748 100644 |
--- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
+++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp |
@@ -37,7 +37,9 @@ |
#include "core/workers/WorkerBackingThread.h" |
#include "core/workers/WorkerClients.h" |
#include "core/workers/WorkerReportingProxy.h" |
+#include "core/workers/WorkerThreadLifecycleObserver.h" |
#include "core/workers/WorkerThreadStartupData.h" |
+#include "platform/LifecycleNotifier.h" |
#include "platform/ThreadSafeFunctional.h" |
#include "platform/WaitableEvent.h" |
#include "platform/WebThreadSupportingGC.h" |
@@ -292,6 +294,7 @@ WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, Work |
, m_shutdownEvent(adoptPtr(new WaitableEvent( |
WaitableEvent::ResetPolicy::Manual, |
WaitableEvent::InitialState::NonSignaled))) |
+ , m_workerThreadContext(new WorkerThreadContext) |
{ |
MutexLocker lock(threadSetMutex()); |
workerThreads().add(this); |
@@ -339,6 +342,10 @@ void WorkerThread::terminateInternal(TerminationMode mode) |
if (m_terminationEvent) |
m_terminationEvent->signal(); |
+ DCHECK(m_workerThreadContext); |
+ m_workerThreadContext->notifyContextDestroyed(); |
+ m_workerThreadContext = nullptr; |
+ |
// If the worker thread was never initialized, don't start another |
// shutdown, but still wait for the thread to signal when shutdown has |
// completed on initializeOnWorkerThread(). |