| Index: content/browser/service_worker/service_worker_version.cc
|
| diff --git a/content/browser/service_worker/service_worker_version.cc b/content/browser/service_worker/service_worker_version.cc
|
| index 0682c5a81144bde859d5ebea1b03b1a3448f7e5e..056c23d79874520857d9e2fae2f7662830c3c829 100644
|
| --- a/content/browser/service_worker/service_worker_version.cc
|
| +++ b/content/browser/service_worker/service_worker_version.cc
|
| @@ -1392,24 +1392,25 @@ void ServiceWorkerVersion::DidSkipWaiting(int request_id) {
|
| }
|
|
|
| void ServiceWorkerVersion::OnClaimClients(int request_id) {
|
| - StatusCallback callback = base::Bind(&ServiceWorkerVersion::DidClaimClients,
|
| - weak_factory_.GetWeakPtr(), request_id);
|
| if (status_ != ACTIVATING && status_ != ACTIVATED) {
|
| - callback.Run(SERVICE_WORKER_ERROR_STATE);
|
| + embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
|
| + request_id, blink::WebServiceWorkerError::ErrorTypeState,
|
| + base::ASCIIToUTF16(kClaimClientsStateErrorMesage)));
|
| return;
|
| }
|
| - if (!context_) {
|
| - callback.Run(SERVICE_WORKER_ERROR_ABORT);
|
| - return;
|
| + if (context_) {
|
| + if (ServiceWorkerRegistration* registration =
|
| + context_->GetLiveRegistration(registration_id_)) {
|
| + registration->ClaimClients();
|
| + embedded_worker_->SendMessage(
|
| + ServiceWorkerMsg_DidClaimClients(request_id));
|
| + return;
|
| + }
|
| }
|
|
|
| - ServiceWorkerRegistration* registration =
|
| - context_->GetLiveRegistration(registration_id_);
|
| - if (!registration) {
|
| - callback.Run(SERVICE_WORKER_ERROR_ABORT);
|
| - return;
|
| - }
|
| - registration->ClaimClients(callback);
|
| + embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
|
| + request_id, blink::WebServiceWorkerError::ErrorTypeAbort,
|
| + base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage)));
|
| }
|
|
|
| void ServiceWorkerVersion::OnPongFromWorker() {
|
| @@ -1450,24 +1451,6 @@ void ServiceWorkerVersion::DidEnsureLiveRegistrationForStartWorker(
|
| }
|
| }
|
|
|
| -void ServiceWorkerVersion::DidClaimClients(
|
| - int request_id, ServiceWorkerStatusCode status) {
|
| - if (status == SERVICE_WORKER_ERROR_STATE) {
|
| - embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
|
| - request_id, blink::WebServiceWorkerError::ErrorTypeState,
|
| - base::ASCIIToUTF16(kClaimClientsStateErrorMesage)));
|
| - return;
|
| - }
|
| - if (status == SERVICE_WORKER_ERROR_ABORT) {
|
| - embedded_worker_->SendMessage(ServiceWorkerMsg_ClaimClientsError(
|
| - request_id, blink::WebServiceWorkerError::ErrorTypeAbort,
|
| - base::ASCIIToUTF16(kClaimClientsShutdownErrorMesage)));
|
| - return;
|
| - }
|
| - DCHECK(status == SERVICE_WORKER_OK);
|
| - embedded_worker_->SendMessage(ServiceWorkerMsg_DidClaimClients(request_id));
|
| -}
|
| -
|
| void ServiceWorkerVersion::DidGetClients(
|
| int request_id,
|
| const std::vector<ServiceWorkerClientInfo>& clients) {
|
|
|