| 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 55b6a0e5dc2822ab51e846b8525fa0765b1a0f2f..91ec0988c8392947d5bfdc11883cde8078e1dff1 100644
|
| --- a/content/browser/service_worker/service_worker_version.cc
|
| +++ b/content/browser/service_worker/service_worker_version.cc
|
| @@ -39,6 +39,7 @@
|
| #include "content/public/common/content_client.h"
|
| #include "content/public/common/content_switches.h"
|
| #include "content/public/common/result_codes.h"
|
| +#include "content/public/common/service_registry.h"
|
| #include "net/http/http_response_headers.h"
|
| #include "net/http/http_response_info.h"
|
|
|
| @@ -754,12 +755,10 @@ void ServiceWorkerVersion::DispatchSyncEvent(const StatusCallback& callback) {
|
| }
|
|
|
| int request_id = AddRequest(callback, &sync_callbacks_, REQUEST_SYNC);
|
| - ServiceWorkerStatusCode status = embedded_worker_->SendMessage(
|
| - ServiceWorkerMsg_SyncEvent(request_id));
|
| - if (status != SERVICE_WORKER_OK) {
|
| - sync_callbacks_.Remove(request_id);
|
| - RunSoon(base::Bind(callback, status));
|
| - }
|
| + mojo_event_dispatcher_.DispatchSyncEvent(
|
| + embedded_worker_->process_id(), embedded_worker_->thread_id(),
|
| + base::Bind(&self::OnSyncEventFinished, weak_factory_.GetWeakPtr(),
|
| + request_id));
|
| }
|
|
|
| void ServiceWorkerVersion::DispatchNotificationClickEvent(
|
| @@ -1174,8 +1173,6 @@ bool ServiceWorkerVersion::OnMessageReceived(const IPC::Message& message) {
|
| OnInstallEventFinished)
|
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FetchEventFinished,
|
| OnFetchEventFinished)
|
| - IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_SyncEventFinished,
|
| - OnSyncEventFinished)
|
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NotificationClickEventFinished,
|
| OnNotificationClickEventFinished)
|
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PushEventFinished,
|
| @@ -1347,9 +1344,8 @@ void ServiceWorkerVersion::OnFetchEventFinished(
|
| RemoveCallbackAndStopIfRedundant(&fetch_callbacks_, request_id);
|
| }
|
|
|
| -void ServiceWorkerVersion::OnSyncEventFinished(
|
| - int request_id,
|
| - blink::WebServiceWorkerEventResult result) {
|
| +void ServiceWorkerVersion::OnSyncEventFinished(int request_id,
|
| + ServiceWorkerStatusCode status) {
|
| TRACE_EVENT1("ServiceWorker",
|
| "ServiceWorkerVersion::OnSyncEventFinished",
|
| "Request id", request_id);
|
| @@ -1359,14 +1355,11 @@ void ServiceWorkerVersion::OnSyncEventFinished(
|
| return;
|
| }
|
|
|
| - ServiceWorkerStatusCode status = SERVICE_WORKER_OK;
|
| if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
|
| switches::kEnableServiceWorkerSync)) {
|
| // Avoid potential race condition where flag is disabled after a sync event
|
| // was dispatched
|
| status = SERVICE_WORKER_ERROR_ABORT;
|
| - } else if (result == blink::WebServiceWorkerEventResultRejected) {
|
| - status = SERVICE_WORKER_ERROR_EVENT_WAITUNTIL_REJECTED;
|
| }
|
|
|
| scoped_refptr<ServiceWorkerVersion> protect(this);
|
|
|