| 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 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 // Update failed. Look up the registration again since the original | 373 // Update failed. Look up the registration again since the original |
| 374 // registration was possibly unregistered in the meantime. | 374 // registration was possibly unregistered in the meantime. |
| 375 context_->storage()->FindRegistrationForDocument( | 375 context_->storage()->FindRegistrationForDocument( |
| 376 stripped_url_, base::Bind(&self::DidLookupRegistrationForMainResource, | 376 stripped_url_, base::Bind(&self::DidLookupRegistrationForMainResource, |
| 377 weak_factory_.GetWeakPtr())); | 377 weak_factory_.GetWeakPtr())); |
| 378 return; | 378 return; |
| 379 } | 379 } |
| 380 DCHECK_EQ(original_registration->id(), registration_id); | 380 DCHECK_EQ(original_registration->id(), registration_id); |
| 381 scoped_refptr<ServiceWorkerVersion> new_version = | 381 scoped_refptr<ServiceWorkerVersion> new_version = |
| 382 original_registration->installing_version(); | 382 original_registration->installing_version(); |
| 383 new_version->ReportError( | 383 new_version->ReportForceUpdateToDevTools(); |
| 384 SERVICE_WORKER_OK, | |
| 385 "ServiceWorker was updated because \"Force update on page load\" was " | |
| 386 "checked in DevTools Source tab."); | |
| 387 new_version->set_skip_waiting(true); | 384 new_version->set_skip_waiting(true); |
| 388 new_version->RegisterStatusChangeCallback(base::Bind( | 385 new_version->RegisterStatusChangeCallback(base::Bind( |
| 389 &self::OnUpdatedVersionStatusChanged, weak_factory_.GetWeakPtr(), | 386 &self::OnUpdatedVersionStatusChanged, weak_factory_.GetWeakPtr(), |
| 390 original_registration, new_version)); | 387 original_registration, new_version)); |
| 391 } | 388 } |
| 392 | 389 |
| 393 void ServiceWorkerControlleeRequestHandler::OnUpdatedVersionStatusChanged( | 390 void ServiceWorkerControlleeRequestHandler::OnUpdatedVersionStatusChanged( |
| 394 const scoped_refptr<ServiceWorkerRegistration>& registration, | 391 const scoped_refptr<ServiceWorkerRegistration>& registration, |
| 395 const scoped_refptr<ServiceWorkerVersion>& version) { | 392 const scoped_refptr<ServiceWorkerVersion>& version) { |
| 396 // The job may have been canceled and then destroyed before this was invoked. | 393 // The job may have been canceled and then destroyed before this was invoked. |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 DCHECK(provider_host_); | 468 DCHECK(provider_host_); |
| 472 // Detach the controller so subresource requests also skip the worker. | 469 // Detach the controller so subresource requests also skip the worker. |
| 473 provider_host_->NotifyControllerLost(); | 470 provider_host_->NotifyControllerLost(); |
| 474 } | 471 } |
| 475 | 472 |
| 476 void ServiceWorkerControlleeRequestHandler::ClearJob() { | 473 void ServiceWorkerControlleeRequestHandler::ClearJob() { |
| 477 job_.reset(); | 474 job_.reset(); |
| 478 } | 475 } |
| 479 | 476 |
| 480 } // namespace content | 477 } // namespace content |
| OLD | NEW |