OLD | NEW |
---|---|
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 "base/debug/trace_event.h" | 7 #include "base/debug/trace_event.h" |
8 #include "content/browser/service_worker/service_worker_context_core.h" | 8 #include "content/browser/service_worker/service_worker_context_core.h" |
9 #include "content/browser/service_worker/service_worker_metrics.h" | 9 #include "content/browser/service_worker/service_worker_metrics.h" |
10 #include "content/browser/service_worker/service_worker_provider_host.h" | 10 #include "content/browser/service_worker/service_worker_provider_host.h" |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
233 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", | 233 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", |
234 job_.get(), | 234 job_.get(), |
235 "Status", status, | 235 "Status", status, |
236 "Info", | 236 "Info", |
237 "ServiceWorkerVersion is not available, so falling back to network"); | 237 "ServiceWorkerVersion is not available, so falling back to network"); |
238 return; | 238 return; |
239 } | 239 } |
240 | 240 |
241 ServiceWorkerMetrics::CountControlledPageLoad(); | 241 ServiceWorkerMetrics::CountControlledPageLoad(); |
242 | 242 |
243 provider_host_->AssociateRegistration(registration.get()); | 243 provider_host_->UseRegistration(registration.get()); |
michaeln
2015/01/28 21:11:14
please stick with the verb associate, we have othe
| |
244 job_->ForwardToServiceWorker(); | 244 job_->ForwardToServiceWorker(); |
245 TRACE_EVENT_ASYNC_END2( | 245 TRACE_EVENT_ASYNC_END2( |
246 "ServiceWorker", | 246 "ServiceWorker", |
247 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", | 247 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", |
248 job_.get(), | 248 job_.get(), |
249 "Status", status, | 249 "Status", status, |
250 "Info", | 250 "Info", |
251 "Forwarded to the ServiceWorker"); | 251 "Forwarded to the ServiceWorker"); |
252 } | 252 } |
253 | 253 |
254 void ServiceWorkerControlleeRequestHandler::OnVersionStatusChanged( | 254 void ServiceWorkerControlleeRequestHandler::OnVersionStatusChanged( |
255 ServiceWorkerRegistration* registration, | 255 ServiceWorkerRegistration* registration, |
256 ServiceWorkerVersion* version) { | 256 ServiceWorkerVersion* version) { |
257 if (provider_host_) | 257 if (provider_host_) |
258 provider_host_->SetAllowAssociation(true); | 258 provider_host_->SetAllowAssociation(true); |
259 if (version != registration->active_version() || | 259 if (version != registration->active_version() || |
260 version->status() != ServiceWorkerVersion::ACTIVATED || | 260 version->status() != ServiceWorkerVersion::ACTIVATED || |
261 !provider_host_) { | 261 !provider_host_) { |
262 job_->FallbackToNetwork(); | 262 job_->FallbackToNetwork(); |
263 return; | 263 return; |
264 } | 264 } |
265 | 265 |
266 ServiceWorkerMetrics::CountControlledPageLoad(); | 266 ServiceWorkerMetrics::CountControlledPageLoad(); |
267 | 267 |
268 provider_host_->AssociateRegistration(registration); | 268 provider_host_->UseRegistration(registration); |
269 job_->ForwardToServiceWorker(); | 269 job_->ForwardToServiceWorker(); |
270 } | 270 } |
271 | 271 |
272 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { | 272 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { |
273 DCHECK(job_.get()); | 273 DCHECK(job_.get()); |
274 DCHECK(context_); | 274 DCHECK(context_); |
275 DCHECK(provider_host_->active_version()); | 275 DCHECK(provider_host_->active_version()); |
276 job_->ForwardToServiceWorker(); | 276 job_->ForwardToServiceWorker(); |
277 } | 277 } |
278 | 278 |
279 } // namespace content | 279 } // namespace content |
OLD | NEW |