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

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

Issue 380093002: Update installed ServiceWorkers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_controllee_request_handl er.h" 5 #include "content/browser/service_worker/service_worker_controllee_request_handl er.h"
6 6
7 #include "content/browser/service_worker/service_worker_context_core.h" 7 #include "content/browser/service_worker/service_worker_context_core.h"
8 #include "content/browser/service_worker/service_worker_metrics.h" 8 #include "content/browser/service_worker/service_worker_metrics.h"
9 #include "content/browser/service_worker/service_worker_provider_host.h" 9 #include "content/browser/service_worker/service_worker_provider_host.h"
10 #include "content/browser/service_worker/service_worker_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 } 113 }
114 114
115 void 115 void
116 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource( 116 ServiceWorkerControlleeRequestHandler::DidLookupRegistrationForMainResource(
117 ServiceWorkerStatusCode status, 117 ServiceWorkerStatusCode status,
118 const scoped_refptr<ServiceWorkerRegistration>& registration) { 118 const scoped_refptr<ServiceWorkerRegistration>& registration) {
119 DCHECK(job_.get()); 119 DCHECK(job_.get());
120 if (status != SERVICE_WORKER_OK || !registration->active_version()) { 120 if (status != SERVICE_WORKER_OK || !registration->active_version()) {
121 // No registration, or no active version for the registration is available. 121 // No registration, or no active version for the registration is available.
122 job_->FallbackToNetwork(); 122 job_->FallbackToNetwork();
123 // TODO(michaeln): If there's a waiting version, activate it instead of
124 // using the network.
123 return; 125 return;
124 } 126 }
125 127
126 ServiceWorkerMetrics::CountControlledPageLoad(); 128 ServiceWorkerMetrics::CountControlledPageLoad();
127 129
128 // TODO(michaeln): should SetWaitingVersion() even if no active version so 130 // TODO(michaeln): if 'activating' wait until it's activated before
129 // so the versions in the pipeline (.installing, .waiting) show up in the 131 // forwarding the request to the serviceworker.
130 // attribute values.
131 DCHECK(registration); 132 DCHECK(registration);
132 provider_host_->SetControllerVersion(registration->active_version()); 133 provider_host_->SetControllerVersion(registration->active_version());
133 provider_host_->SetActiveVersion(registration->active_version()); 134 provider_host_->SetActiveVersion(registration->active_version());
134 provider_host_->SetWaitingVersion(registration->waiting_version()); 135 provider_host_->SetWaitingVersion(registration->waiting_version());
136 provider_host_->SetInstallingVersion(registration->installing_version());
137
135 job_->ForwardToServiceWorker(); 138 job_->ForwardToServiceWorker();
136 } 139 }
137 140
138 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { 141 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() {
139 DCHECK(job_.get()); 142 DCHECK(job_.get());
140 DCHECK(context_); 143 DCHECK(context_);
141 DCHECK(provider_host_->active_version()); 144 DCHECK(provider_host_->active_version());
142 job_->ForwardToServiceWorker(); 145 job_->ForwardToServiceWorker();
143 } 146 }
144 147
145 } // namespace content 148 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698