Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(647)

Unified Diff: content/browser/service_worker/service_worker_context_wrapper.cc

Issue 2575523002: Prerender: Confirm ServiceWorkers are invoked for NoState Prefetch (Closed)
Patch Set: Check that SW runs rather than disabling Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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..a6f3f57a0efb72331ba8c93ad0b79e0e4bf1d8ed 100644
--- a/content/browser/service_worker/service_worker_context_wrapper.cc
+++ b/content/browser/service_worker/service_worker_context_wrapper.cc
@@ -101,6 +101,13 @@ ServiceWorkerMetrics::EventType GetNavigationHintEventType(
return ServiceWorkerMetrics::EventType::UNKNOWN;
}
+void Noop() {}
+
+void StatusCallbackRunner(const base::Closure& callback,
+ ServiceWorkerStatusCode status) {
+ callback.Run();
+}
+
} // namespace
void ServiceWorkerContext::AddExcludedHeadersForFetchEvent(
@@ -490,11 +497,18 @@ void ServiceWorkerContextWrapper::DidCheckHasServiceWorker(
void ServiceWorkerContextWrapper::StopAllServiceWorkersForOrigin(
const GURL& origin) {
+ StopAllServiceWorkersForOriginWithCallback(origin, base::Bind(&Noop));
pasko 2017/01/02 18:15:36 base::DoNothing
mattcary 2017/01/03 09:00:03 Ah, thanks, I was looking in callback_helpers.h, s
+}
+
+void ServiceWorkerContextWrapper::StopAllServiceWorkersForOriginWithCallback(
+ const GURL& origin,
+ const base::Closure& callback) {
if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
BrowserThread::PostTask(
BrowserThread::IO, FROM_HERE,
- base::Bind(&ServiceWorkerContextWrapper::StopAllServiceWorkersForOrigin,
- this, origin));
+ base::Bind(&ServiceWorkerContextWrapper::
+ StopAllServiceWorkersForOriginWithCallback,
+ this, origin, callback));
return;
}
if (!context_core_.get()) {
@@ -504,7 +518,7 @@ void ServiceWorkerContextWrapper::StopAllServiceWorkersForOrigin(
for (const ServiceWorkerVersionInfo& info : live_versions) {
ServiceWorkerVersion* version = GetLiveVersion(info.version_id);
if (version && version->scope().GetOrigin() == origin)
- version->StopWorker(base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
+ version->StopWorker(base::Bind(&StatusCallbackRunner, callback));
}
}

Powered by Google App Engine
This is Rietveld 408576698