| Index: Source/web/WebEmbeddedWorkerImpl.cpp
|
| diff --git a/Source/web/WebEmbeddedWorkerImpl.cpp b/Source/web/WebEmbeddedWorkerImpl.cpp
|
| index 71aac5f62281c14c80327b991808f800df9244ed..c28bd7802a4b9da135b37a7272218d2c9ab88c91 100644
|
| --- a/Source/web/WebEmbeddedWorkerImpl.cpp
|
| +++ b/Source/web/WebEmbeddedWorkerImpl.cpp
|
| @@ -146,6 +146,12 @@ WebEmbeddedWorker* WebEmbeddedWorker::create(
|
| return new WebEmbeddedWorkerImpl(adoptPtr(client), adoptPtr(permissionClient));
|
| }
|
|
|
| +static HashSet<WebEmbeddedWorkerImpl*>& runningWorkerInstances()
|
| +{
|
| + DEFINE_STATIC_LOCAL(HashSet<WebEmbeddedWorkerImpl*>, set, ());
|
| + return set;
|
| +}
|
| +
|
| WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(
|
| PassOwnPtr<WebServiceWorkerContextClient> client,
|
| PassOwnPtr<WebWorkerPermissionClientProxy> permissionClient)
|
| @@ -156,10 +162,13 @@ WebEmbeddedWorkerImpl::WebEmbeddedWorkerImpl(
|
| , m_askedToTerminate(false)
|
| , m_pauseAfterDownloadState(DontPauseAfterDownload)
|
| {
|
| + runningWorkerInstances().add(this);
|
| }
|
|
|
| WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl()
|
| {
|
| + ASSERT(runningWorkerInstances().contains(this));
|
| + runningWorkerInstances().remove(this);
|
| ASSERT(m_webView);
|
|
|
| // Detach the client before closing the view to avoid getting called back.
|
| @@ -169,6 +178,14 @@ WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl()
|
| m_mainFrame->close();
|
| }
|
|
|
| +void WebEmbeddedWorkerImpl::terminateAll()
|
| +{
|
| + HashSet<WebEmbeddedWorkerImpl*> instances = runningWorkerInstances();
|
| + for (HashSet<WebEmbeddedWorkerImpl*>::iterator it = instances.begin(), itEnd = instances.end(); it != itEnd; ++it) {
|
| + (*it)->terminateWorkerContext();
|
| + }
|
| +}
|
| +
|
| void WebEmbeddedWorkerImpl::startWorkerContext(
|
| const WebEmbeddedWorkerStartData& data)
|
| {
|
|
|