Chromium Code Reviews| Index: Source/web/WebEmbeddedWorkerImpl.cpp |
| diff --git a/Source/web/WebEmbeddedWorkerImpl.cpp b/Source/web/WebEmbeddedWorkerImpl.cpp |
| index 7853ed9487b53cff814c08256a0c8e5a031f7d97..c06458b60be6b810c8146fd6cc217f562985aa2d 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*>& aliveWebEmbeddedWorkerImplInstances() |
|
michaeln
2014/07/25 02:49:52
this is long'ish, runningWorkerInstances()?
kouhei (in TOK)
2014/07/25 05:00:39
Acknowledged.
|
| +{ |
| + 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) |
| { |
| + aliveWebEmbeddedWorkerImplInstances().add(this); |
| } |
| WebEmbeddedWorkerImpl::~WebEmbeddedWorkerImpl() |
| { |
| + ASSERT(aliveWebEmbeddedWorkerImplInstances().contains(this)); |
| + aliveWebEmbeddedWorkerImplInstances().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 = aliveWebEmbeddedWorkerImplInstances(); |
| + for (HashSet<WebEmbeddedWorkerImpl*>::iterator it = instances.begin(), itEnd = instances.end(); it != itEnd; ++it) { |
| + (*it)->terminateWorkerContext(); |
| + } |
| +} |
| + |
| void WebEmbeddedWorkerImpl::startWorkerContext( |
| const WebEmbeddedWorkerStartData& data) |
| { |