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 b77ba3b06ec0ab61b2ac67e528e0bd38e8612d57..9288b85473da66da8ac9da050f061368fba39e65 100644 |
| --- a/content/browser/service_worker/service_worker_version.cc |
| +++ b/content/browser/service_worker/service_worker_version.cc |
| @@ -625,37 +625,6 @@ void ServiceWorkerVersion::DispatchFetchEvent( |
| } |
| } |
| -void ServiceWorkerVersion::DispatchNotificationClickEvent( |
| - const StatusCallback& callback, |
| - int64_t persistent_notification_id, |
| - const PlatformNotificationData& notification_data, |
| - int action_index) { |
| - OnBeginEvent(); |
| - DCHECK_EQ(ACTIVATED, status()) << status(); |
|
johnme
2016/01/15 16:52:58
Is there any equivalent to this DCHECK in the new
Marijn Kruisselbrink
2016/01/15 23:48:49
Good question. Not currently. I considered adding
johnme
2016/01/18 16:31:05
Both push and notifications have experienced a lot
Marijn Kruisselbrink
2016/01/19 23:50:17
I think most of the subtle bugs have been adressed
|
| - if (running_status() != RUNNING) { |
| - // Schedule calling this method after starting the worker. |
| - StartWorker(base::Bind( |
| - &RunTaskAfterStartWorker, weak_factory_.GetWeakPtr(), callback, |
| - base::Bind(&self::DispatchNotificationClickEvent, |
| - weak_factory_.GetWeakPtr(), callback, |
| - persistent_notification_id, notification_data, |
| - action_index))); |
| - return; |
| - } |
| - |
| - int request_id = AddRequest( |
| - callback, ¬ification_click_requests_, REQUEST_NOTIFICATION_CLICK, |
| - ServiceWorkerMetrics::EventType::NOTIFICATION_CLICK); |
| - ServiceWorkerStatusCode status = |
| - embedded_worker_->SendMessage(ServiceWorkerMsg_NotificationClickEvent( |
| - request_id, persistent_notification_id, notification_data, |
| - action_index)); |
| - if (status != SERVICE_WORKER_OK) { |
| - notification_click_requests_.Remove(request_id); |
| - RunSoon(base::Bind(callback, status)); |
| - } |
| -} |
| - |
| void ServiceWorkerVersion::DispatchPushEvent(const StatusCallback& callback, |
| const std::string& data) { |
| OnBeginEvent(); |
| @@ -982,8 +951,6 @@ bool ServiceWorkerVersion::OnMessageReceived(const IPC::Message& message) { |
| OnInstallEventFinished) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_FetchEventFinished, |
| OnFetchEventFinished) |
| - IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_NotificationClickEventFinished, |
| - OnNotificationClickEventFinished) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_PushEventFinished, |
| OnPushEventFinished) |
| IPC_MESSAGE_HANDLER(ServiceWorkerHostMsg_OpenWindow, |
| @@ -1155,26 +1122,6 @@ void ServiceWorkerVersion::OnFetchEventFinished( |
| RemoveCallbackAndStopIfRedundant(&fetch_requests_, request_id); |
| } |
| -void ServiceWorkerVersion::OnNotificationClickEventFinished( |
| - int request_id) { |
| - TRACE_EVENT1("ServiceWorker", |
| - "ServiceWorkerVersion::OnNotificationClickEventFinished", |
| - "Request id", request_id); |
| - PendingRequest<StatusCallback>* request = |
| - notification_click_requests_.Lookup(request_id); |
| - if (!request) { |
| - NOTREACHED() << "Got unexpected message: " << request_id; |
| - return; |
| - } |
| - |
| - ServiceWorkerMetrics::RecordEventDuration( |
| - request->event_type, base::TimeTicks::Now() - request->start_time); |
| - |
| - scoped_refptr<ServiceWorkerVersion> protect(this); |
| - request->callback.Run(SERVICE_WORKER_OK); |
| - RemoveCallbackAndStopIfRedundant(¬ification_click_requests_, request_id); |
| -} |
| - |
| void ServiceWorkerVersion::OnPushEventFinished( |
| int request_id, |
| blink::WebServiceWorkerEventResult result) { |
| @@ -1732,8 +1679,7 @@ void ServiceWorkerVersion::StopWorkerIfIdle() { |
| bool ServiceWorkerVersion::HasInflightRequests() const { |
| return !activate_requests_.IsEmpty() || !install_requests_.IsEmpty() || |
| - !fetch_requests_.IsEmpty() || |
| - !notification_click_requests_.IsEmpty() || !push_requests_.IsEmpty() || |
| + !fetch_requests_.IsEmpty() || !push_requests_.IsEmpty() || |
| !custom_requests_.IsEmpty() || !streaming_url_request_jobs_.empty(); |
| } |
| @@ -1828,9 +1774,6 @@ bool ServiceWorkerVersion::MaybeTimeOutRequest(const RequestInfo& info) { |
| &fetch_requests_, info.id, SERVICE_WORKER_ERROR_TIMEOUT, |
| /* The other args are ignored for non-OK status. */ |
| SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, ServiceWorkerResponse()); |
| - case REQUEST_NOTIFICATION_CLICK: |
| - return RunIDMapCallback(¬ification_click_requests_, info.id, |
| - SERVICE_WORKER_ERROR_TIMEOUT); |
| case REQUEST_PUSH: |
| return RunIDMapCallback(&push_requests_, info.id, |
| SERVICE_WORKER_ERROR_TIMEOUT); |
| @@ -1952,7 +1895,6 @@ void ServiceWorkerVersion::OnStoppedInternal( |
| RunIDMapCallbacks(&fetch_requests_, SERVICE_WORKER_ERROR_FAILED, |
| SERVICE_WORKER_FETCH_EVENT_RESULT_FALLBACK, |
| ServiceWorkerResponse()); |
| - RunIDMapCallbacks(¬ification_click_requests_, SERVICE_WORKER_ERROR_FAILED); |
| RunIDMapCallbacks(&push_requests_, SERVICE_WORKER_ERROR_FAILED); |
| RunIDMapCallbacks(&custom_requests_, SERVICE_WORKER_ERROR_FAILED); |