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

Side by Side Diff: content/browser/service_worker/service_worker_context_core.cc

Issue 2771823002: Implement updateViaCache flag and no-cache by default for main service worker scripts
Patch Set: Created 3 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/browser/service_worker/service_worker_context_core.h" 5 #include "content/browser/service_worker/service_worker_context_core.h"
6 6
7 #include <limits> 7 #include <limits>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 396 matching lines...) Expand 10 before | Expand all | Expand 10 after
407 const std::string& client_uuid) { 407 const std::string& client_uuid) {
408 auto found = provider_by_uuid_->find(client_uuid); 408 auto found = provider_by_uuid_->find(client_uuid);
409 if (found == provider_by_uuid_->end()) 409 if (found == provider_by_uuid_->end())
410 return nullptr; 410 return nullptr;
411 return found->second; 411 return found->second;
412 } 412 }
413 413
414 void ServiceWorkerContextCore::RegisterServiceWorker( 414 void ServiceWorkerContextCore::RegisterServiceWorker(
415 const GURL& pattern, 415 const GURL& pattern,
416 const GURL& script_url, 416 const GURL& script_url,
417 bool use_cache,
417 ServiceWorkerProviderHost* provider_host, 418 ServiceWorkerProviderHost* provider_host,
418 const RegistrationCallback& callback) { 419 const RegistrationCallback& callback) {
419 DCHECK_CURRENTLY_ON(BrowserThread::IO); 420 DCHECK_CURRENTLY_ON(BrowserThread::IO);
420 was_service_worker_registered_ = true; 421 was_service_worker_registered_ = true;
421 job_coordinator_->Register( 422 job_coordinator_->Register(
422 pattern, 423 pattern, script_url, use_cache, provider_host,
423 script_url, 424 base::Bind(&ServiceWorkerContextCore::RegistrationComplete, AsWeakPtr(),
424 provider_host, 425 pattern, callback));
425 base::Bind(&ServiceWorkerContextCore::RegistrationComplete,
426 AsWeakPtr(),
427 pattern,
428 callback));
429 } 426 }
430 427
431 void ServiceWorkerContextCore::UpdateServiceWorker( 428 void ServiceWorkerContextCore::UpdateServiceWorker(
432 ServiceWorkerRegistration* registration, 429 ServiceWorkerRegistration* registration,
433 bool force_bypass_cache) { 430 bool force_bypass_cache) {
434 DCHECK_CURRENTLY_ON(BrowserThread::IO); 431 DCHECK_CURRENTLY_ON(BrowserThread::IO);
435 job_coordinator_->Update(registration, force_bypass_cache); 432 job_coordinator_->Update(registration, force_bypass_cache);
436 } 433 }
437 434
438 void ServiceWorkerContextCore::UpdateServiceWorker( 435 void ServiceWorkerContextCore::UpdateServiceWorker(
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after
907 scoped_refptr<ServiceWorkerRegistration> registration) { 904 scoped_refptr<ServiceWorkerRegistration> registration) {
908 if (!registration->active_version() && !registration->waiting_version()) { 905 if (!registration->active_version() && !registration->waiting_version()) {
909 callback.Run(ServiceWorkerCapability::NO_SERVICE_WORKER); 906 callback.Run(ServiceWorkerCapability::NO_SERVICE_WORKER);
910 return; 907 return;
911 } 908 }
912 909
913 CheckFetchHandlerOfInstalledServiceWorker(callback, registration); 910 CheckFetchHandlerOfInstalledServiceWorker(callback, registration);
914 } 911 }
915 912
916 } // namespace content 913 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698