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

Unified Diff: content/child/service_worker/service_worker_dispatcher.cc

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: fix IPC Created 3 years, 4 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/child/service_worker/service_worker_dispatcher.cc
diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc
index ebd66c5cb63994c8a0432d8fab9421d59d488e7d..7c0f8b417ab6a0121e31d5632899be563f24e60d 100644
--- a/content/child/service_worker/service_worker_dispatcher.cc
+++ b/content/child/service_worker/service_worker_dispatcher.cc
@@ -120,6 +120,7 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
int provider_id,
const GURL& pattern,
const GURL& script_url,
+ blink::WebServiceWorkerUpdateViaCache update_via_cache,
std::unique_ptr<WebServiceWorkerRegistrationCallbacks> callbacks) {
DCHECK(callbacks);
@@ -134,7 +135,7 @@ void ServiceWorkerDispatcher::RegisterServiceWorker(
}
int request_id = pending_registration_callbacks_.Add(std::move(callbacks));
- ServiceWorkerRegistrationOptions options(pattern);
+ ServiceWorkerRegistrationOptions options(pattern, update_via_cache);
TRACE_EVENT_ASYNC_BEGIN2("ServiceWorker",
"ServiceWorkerDispatcher::RegisterServiceWorker",
@@ -185,6 +186,7 @@ void ServiceWorkerDispatcher::GetRegistration(
int request_id =
pending_get_registration_callbacks_.Add(std::move(callbacks));
+
TRACE_EVENT_ASYNC_BEGIN1("ServiceWorker",
"ServiceWorkerDispatcher::GetRegistration",
request_id,
@@ -372,8 +374,12 @@ ServiceWorkerDispatcher::GetOrAdoptRegistration(
Adopt(attrs.active);
RegistrationObjectMap::iterator found = registrations_.find(info.handle_id);
- if (found != registrations_.end())
+ if (found != registrations_.end()) {
+ if (found->second->UpdateViaCache() != registration_ref->update_via_cache())
+ found->second->SetRegistrationHandleReference(
+ std::move(registration_ref));
return found->second;
+ }
// WebServiceWorkerRegistrationImpl constructor calls
// AddServiceWorkerRegistration.

Powered by Google App Engine
This is Rietveld 408576698