| Index: content/browser/service_worker/service_worker_context_wrapper.cc
|
| diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc
|
| index 6c5881189fa43ed89a803e5713a44b2945f2cf9e..7e2331ec1c860175ed01b886cd306fdacaa45eca 100644
|
| --- a/content/browser/service_worker/service_worker_context_wrapper.cc
|
| +++ b/content/browser/service_worker/service_worker_context_wrapper.cc
|
| @@ -12,6 +12,7 @@
|
|
|
| #include "base/barrier_closure.h"
|
| #include "base/bind.h"
|
| +#include "base/bind_helpers.h"
|
| #include "base/files/file_path.h"
|
| #include "base/lazy_instance.h"
|
| #include "base/location.h"
|
| @@ -33,6 +34,7 @@
|
| #include "content/public/browser/browser_context.h"
|
| #include "content/public/browser/browser_thread.h"
|
| #include "content/public/browser/render_process_host.h"
|
| +#include "content/public/common/result_codes.h"
|
| #include "net/base/url_util.h"
|
| #include "storage/browser/quota/quota_manager_proxy.h"
|
| #include "storage/browser/quota/special_storage_policy.h"
|
| @@ -508,6 +510,32 @@ void ServiceWorkerContextWrapper::StopAllServiceWorkersForOrigin(
|
| }
|
| }
|
|
|
| +void ServiceWorkerContextWrapper::KillAllServiceWorkersForOrigin(
|
| + const GURL& origin) {
|
| + if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO, FROM_HERE,
|
| + base::Bind(&ServiceWorkerContextWrapper::KillAllServiceWorkersForOrigin,
|
| + this, origin));
|
| + return;
|
| + }
|
| + if (!context_core_.get()) {
|
| + return;
|
| + }
|
| + std::vector<ServiceWorkerVersionInfo> live_versions = GetAllLiveVersionInfo();
|
| + for (const ServiceWorkerVersionInfo& info : live_versions) {
|
| + ServiceWorkerVersion* version = GetLiveVersion(info.version_id);
|
| + if (version && version->scope().GetOrigin() == origin) {
|
| + for (const auto& client_pair : info.clients) {
|
| + RenderProcessHost* render_process_host =
|
| + RenderProcessHost::FromID(client_pair.second.process_id);
|
| + if (render_process_host)
|
| + render_process_host->Shutdown(RESULT_CODE_KILLED, true /* wait */);
|
| + }
|
| + }
|
| + }
|
| +}
|
| +
|
| void ServiceWorkerContextWrapper::DidFindRegistrationForUpdate(
|
| ServiceWorkerStatusCode status,
|
| scoped_refptr<ServiceWorkerRegistration> registration) {
|
|
|