| 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 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 397 return; | 397 return; |
| 398 } | 398 } |
| 399 version->RegisterStatusChangeCallback( | 399 version->RegisterStatusChangeCallback( |
| 400 base::Bind(&self::OnUpdatedVersionStatusChanged, | 400 base::Bind(&self::OnUpdatedVersionStatusChanged, |
| 401 weak_factory_.GetWeakPtr(), registration, version)); | 401 weak_factory_.GetWeakPtr(), registration, version)); |
| 402 } | 402 } |
| 403 | 403 |
| 404 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { | 404 void ServiceWorkerControlleeRequestHandler::PrepareForSubResource() { |
| 405 DCHECK(job_.get()); | 405 DCHECK(job_.get()); |
| 406 DCHECK(context_); | 406 DCHECK(context_); |
| 407 DCHECK(provider_host_->active_version()); | 407 |
| 408 if (!provider_host_->active_version()) { |
| 409 // TODO(falken): For debugging. Remove once https://crbug.com/655910 is |
| 410 // resolved. |
| 411 CHECK(provider_host_->controller_was_deleted()); |
| 412 } |
| 413 |
| 408 MaybeForwardToServiceWorker(job_.get(), provider_host_->active_version()); | 414 MaybeForwardToServiceWorker(job_.get(), provider_host_->active_version()); |
| 409 } | 415 } |
| 410 | 416 |
| 411 void ServiceWorkerControlleeRequestHandler::OnPrepareToRestart() { | 417 void ServiceWorkerControlleeRequestHandler::OnPrepareToRestart() { |
| 412 use_network_ = true; | 418 use_network_ = true; |
| 413 ClearJob(); | 419 ClearJob(); |
| 414 } | 420 } |
| 415 | 421 |
| 416 ServiceWorkerVersion* | 422 ServiceWorkerVersion* |
| 417 ServiceWorkerControlleeRequestHandler::GetServiceWorkerVersion( | 423 ServiceWorkerControlleeRequestHandler::GetServiceWorkerVersion( |
| (...skipping 16 matching lines...) Expand all Loading... |
| 434 if (!provider_host_) { | 440 if (!provider_host_) { |
| 435 *result = ServiceWorkerMetrics::REQUEST_JOB_ERROR_NO_PROVIDER_HOST; | 441 *result = ServiceWorkerMetrics::REQUEST_JOB_ERROR_NO_PROVIDER_HOST; |
| 436 return false; | 442 return false; |
| 437 } | 443 } |
| 438 return true; | 444 return true; |
| 439 } | 445 } |
| 440 | 446 |
| 441 void ServiceWorkerControlleeRequestHandler::MainResourceLoadFailed() { | 447 void ServiceWorkerControlleeRequestHandler::MainResourceLoadFailed() { |
| 442 DCHECK(provider_host_); | 448 DCHECK(provider_host_); |
| 443 // Detach the controller so subresource requests also skip the worker. | 449 // Detach the controller so subresource requests also skip the worker. |
| 444 provider_host_->NotifyControllerLost(); | 450 provider_host_->NotifyControllerLost(false /* was_deleted */); |
| 445 } | 451 } |
| 446 | 452 |
| 447 void ServiceWorkerControlleeRequestHandler::ClearJob() { | 453 void ServiceWorkerControlleeRequestHandler::ClearJob() { |
| 448 job_.reset(); | 454 job_.reset(); |
| 449 } | 455 } |
| 450 | 456 |
| 451 } // namespace content | 457 } // namespace content |
| OLD | NEW |