| 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..82a3775be7c6f496840bd417f9166feb94840015 100644
|
| --- a/third_party/WebKit/Source/core/workers/WorkerThread.cpp
|
| +++ b/third_party/WebKit/Source/core/workers/WorkerThread.cpp
|
| @@ -147,6 +147,24 @@ static HashSet<WorkerThread*>& workerThreads()
|
| return threads;
|
| }
|
|
|
| +WorkerThreadContext::WorkerThreadContext()
|
| +{
|
| + DCHECK(isMainThread());
|
| +}
|
| +
|
| +WorkerThreadContext::~WorkerThreadContext()
|
| +{
|
| + DCHECK(isMainThread());
|
| +}
|
| +
|
| +void WorkerThreadContext::notifyContextDestroyed()
|
| +{
|
| + DCHECK(isMainThread());
|
| + DCHECK(!m_wasContextDestroyed);
|
| + m_wasContextDestroyed = true;
|
| + LifecycleNotifier::notifyContextDestroyed();
|
| +}
|
| +
|
| WorkerThread::~WorkerThread()
|
| {
|
| DCHECK(isMainThread());
|
| @@ -292,7 +310,9 @@ WorkerThread::WorkerThread(PassRefPtr<WorkerLoaderProxy> workerLoaderProxy, Work
|
| , m_shutdownEvent(adoptPtr(new WaitableEvent(
|
| WaitableEvent::ResetPolicy::Manual,
|
| WaitableEvent::InitialState::NonSignaled)))
|
| + , m_workerThreadContext(new WorkerThreadContext)
|
| {
|
| + DCHECK(isMainThread());
|
| MutexLocker lock(threadSetMutex());
|
| workerThreads().add(this);
|
| }
|
| @@ -339,6 +359,8 @@ void WorkerThread::terminateInternal(TerminationMode mode)
|
| if (m_terminationEvent)
|
| m_terminationEvent->signal();
|
|
|
| + m_workerThreadContext->notifyContextDestroyed();
|
| +
|
| // 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().
|
|
|