Chromium Code Reviews| 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..df6f784976cf15c4c88ddee17bdfc5f3a9f8bcdd 100644 |
| --- a/content/browser/service_worker/service_worker_version.cc |
| +++ b/content/browser/service_worker/service_worker_version.cc |
| @@ -1392,24 +1392,26 @@ 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_)) { |
|
falken
2015/03/23 00:38:57
(unrelated to this patch) I think there might be a
michaeln
2015/03/23 20:02:26
Good question. I think the answer is 'yes', hiroki
xiang
2015/03/24 07:32:51
Thanks for the clarification, yes, the Registratio
|
| + 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))); |
| + return; |
|
michaeln
2015/03/20 19:25:21
this return statement is not needed
xiang
2015/03/24 07:32:51
Done.
|
| } |
| void ServiceWorkerVersion::OnPongFromWorker() { |
| @@ -1450,24 +1452,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) { |