| Index: Source/core/workers/WorkerThread.cpp
|
| diff --git a/Source/core/workers/WorkerThread.cpp b/Source/core/workers/WorkerThread.cpp
|
| index 2a074a724a2fc350c71a9676cc8021c386a25ae6..b4f8fc467d6141d2c58bee774e390d86a84e184a 100644
|
| --- a/Source/core/workers/WorkerThread.cpp
|
| +++ b/Source/core/workers/WorkerThread.cpp
|
| @@ -39,6 +39,7 @@
|
| #include "platform/PlatformThreadData.h"
|
| #include "platform/weborigin/KURL.h"
|
| #include "public/platform/Platform.h"
|
| +#include "public/platform/WebWaitableEvent.h"
|
| #include "public/platform/WebWorkerRunLoop.h"
|
| #include "wtf/Noncopyable.h"
|
| #include "wtf/text/WTFString.h"
|
| @@ -71,6 +72,7 @@ WorkerThread::WorkerThread(WorkerLoaderProxy& workerLoaderProxy, WorkerReporting
|
| , m_workerReportingProxy(workerReportingProxy)
|
| , m_startupData(startupData)
|
| , m_notificationClient(0)
|
| + , m_shutdownEvent(adoptPtr(blink::Platform::current()->createWaitableEvent()))
|
| {
|
| MutexLocker lock(threadSetMutex());
|
| workerThreads().add(this);
|
| @@ -210,6 +212,10 @@ void WorkerThread::stop()
|
| // Mutex protection is necessary because stop() can be called before the context is fully created.
|
| MutexLocker lock(m_threadCreationMutex);
|
|
|
| + // Signal the thread to notify that the thread's stopping.
|
| + if (m_shutdownEvent)
|
| + m_shutdownEvent->signal();
|
| +
|
| // Ensure that tasks are being handled by thread event loop. If script execution weren't forbidden, a while(1) loop in JS could keep the thread alive forever.
|
| if (m_workerGlobalScope) {
|
| m_workerGlobalScope->script()->scheduleExecutionTermination();
|
|
|