| 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 <memory> | 7 #include <memory> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 "Status", status, | 280 "Status", status, |
| 281 "Info", | 281 "Info", |
| 282 "ServiceWorkerVersion is not available, so falling back to network"); | 282 "ServiceWorkerVersion is not available, so falling back to network"); |
| 283 return; | 283 return; |
| 284 } | 284 } |
| 285 | 285 |
| 286 DCHECK_NE(active_version->fetch_handler_existence(), | 286 DCHECK_NE(active_version->fetch_handler_existence(), |
| 287 ServiceWorkerVersion::FetchHandlerExistence::UNKNOWN); | 287 ServiceWorkerVersion::FetchHandlerExistence::UNKNOWN); |
| 288 | 288 |
| 289 ServiceWorkerMetrics::CountControlledPageLoad( | 289 ServiceWorkerMetrics::CountControlledPageLoad( |
| 290 stripped_url_, active_version->fetch_handler_existence() == | 290 active_version->site_for_uma(), stripped_url_, is_main_frame_load_); |
| 291 ServiceWorkerVersion::FetchHandlerExistence::EXISTS, | |
| 292 is_main_frame_load_); | |
| 293 | 291 |
| 294 bool is_forwarded = | 292 bool is_forwarded = |
| 295 MaybeForwardToServiceWorker(job_.get(), active_version.get()); | 293 MaybeForwardToServiceWorker(job_.get(), active_version.get()); |
| 296 | 294 |
| 297 TRACE_EVENT_ASYNC_END2( | 295 TRACE_EVENT_ASYNC_END2( |
| 298 "ServiceWorker", | 296 "ServiceWorker", |
| 299 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", | 297 "ServiceWorkerControlleeRequestHandler::PrepareForMainResource", |
| 300 job_.get(), "Status", status, "Info", | 298 job_.get(), "Status", status, "Info", |
| 301 (is_forwarded) ? "Forwarded to the ServiceWorker" | 299 (is_forwarded) ? "Forwarded to the ServiceWorker" |
| 302 : "Skipped the ServiceWorker which has no fetch handler"); | 300 : "Skipped the ServiceWorker which has no fetch handler"); |
| (...skipping 11 matching lines...) Expand all Loading... |
| 314 if (version != registration->active_version() || | 312 if (version != registration->active_version() || |
| 315 version->status() != ServiceWorkerVersion::ACTIVATED || | 313 version->status() != ServiceWorkerVersion::ACTIVATED || |
| 316 !provider_host_) { | 314 !provider_host_) { |
| 317 job_->FallbackToNetwork(); | 315 job_->FallbackToNetwork(); |
| 318 return; | 316 return; |
| 319 } | 317 } |
| 320 | 318 |
| 321 DCHECK_NE(version->fetch_handler_existence(), | 319 DCHECK_NE(version->fetch_handler_existence(), |
| 322 ServiceWorkerVersion::FetchHandlerExistence::UNKNOWN); | 320 ServiceWorkerVersion::FetchHandlerExistence::UNKNOWN); |
| 323 ServiceWorkerMetrics::CountControlledPageLoad( | 321 ServiceWorkerMetrics::CountControlledPageLoad( |
| 324 stripped_url_, version->fetch_handler_existence() == | 322 version->site_for_uma(), stripped_url_, is_main_frame_load_); |
| 325 ServiceWorkerVersion::FetchHandlerExistence::EXISTS, | |
| 326 is_main_frame_load_); | |
| 327 | 323 |
| 328 provider_host_->AssociateRegistration(registration, | 324 provider_host_->AssociateRegistration(registration, |
| 329 false /* notify_controllerchange */); | 325 false /* notify_controllerchange */); |
| 330 | 326 |
| 331 MaybeForwardToServiceWorker(job_.get(), version); | 327 MaybeForwardToServiceWorker(job_.get(), version); |
| 332 } | 328 } |
| 333 | 329 |
| 334 void ServiceWorkerControlleeRequestHandler::DidUpdateRegistration( | 330 void ServiceWorkerControlleeRequestHandler::DidUpdateRegistration( |
| 335 const scoped_refptr<ServiceWorkerRegistration>& original_registration, | 331 const scoped_refptr<ServiceWorkerRegistration>& original_registration, |
| 336 ServiceWorkerStatusCode status, | 332 ServiceWorkerStatusCode status, |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 435 DCHECK(provider_host_); | 431 DCHECK(provider_host_); |
| 436 // Detach the controller so subresource requests also skip the worker. | 432 // Detach the controller so subresource requests also skip the worker. |
| 437 provider_host_->NotifyControllerLost(); | 433 provider_host_->NotifyControllerLost(); |
| 438 } | 434 } |
| 439 | 435 |
| 440 void ServiceWorkerControlleeRequestHandler::ClearJob() { | 436 void ServiceWorkerControlleeRequestHandler::ClearJob() { |
| 441 job_.reset(); | 437 job_.reset(); |
| 442 } | 438 } |
| 443 | 439 |
| 444 } // namespace content | 440 } // namespace content |
| OLD | NEW |