Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(70)

Side by Side Diff: content/browser/push_messaging/push_messaging_router.cc

Issue 2600863002: Revert of [ServiceWorker] Mojofy PushEvent of Service Worker. (Closed)
Patch Set: Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « AUTHORS ('k') | content/browser/service_worker/embedded_worker_test_helper.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/push_messaging/push_messaging_router.h" 5 #include "content/browser/push_messaging/push_messaging_router.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/metrics/histogram_macros.h" 10 #include "base/metrics/histogram_macros.h"
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, 116 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration,
117 const PushEventPayload& payload, 117 const PushEventPayload& payload,
118 const DeliverMessageCallback& deliver_message_callback) { 118 const DeliverMessageCallback& deliver_message_callback) {
119 DCHECK_CURRENTLY_ON(BrowserThread::IO); 119 DCHECK_CURRENTLY_ON(BrowserThread::IO);
120 int request_id = service_worker->StartRequestWithCustomTimeout( 120 int request_id = service_worker->StartRequestWithCustomTimeout(
121 ServiceWorkerMetrics::EventType::PUSH, 121 ServiceWorkerMetrics::EventType::PUSH,
122 base::Bind(&PushMessagingRouter::DeliverMessageEnd, 122 base::Bind(&PushMessagingRouter::DeliverMessageEnd,
123 deliver_message_callback, service_worker_registration), 123 deliver_message_callback, service_worker_registration),
124 base::TimeDelta::FromSeconds(kPushMessageTimeoutSeconds), 124 base::TimeDelta::FromSeconds(kPushMessageTimeoutSeconds),
125 ServiceWorkerVersion::KILL_ON_TIMEOUT); 125 ServiceWorkerVersion::KILL_ON_TIMEOUT);
126 126 service_worker->DispatchSimpleEvent<ServiceWorkerHostMsg_PushEventFinished>(
127 service_worker->event_dispatcher()->DispatchPushEvent( 127 request_id, ServiceWorkerMsg_PushEvent(request_id, payload));
128 payload, base::Bind(&ServiceWorkerVersion::OnSimpleEventFinished,
129 service_worker, request_id));
130 } 128 }
131 129
132 // static 130 // static
133 void PushMessagingRouter::DeliverMessageEnd( 131 void PushMessagingRouter::DeliverMessageEnd(
134 const DeliverMessageCallback& deliver_message_callback, 132 const DeliverMessageCallback& deliver_message_callback,
135 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, 133 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration,
136 ServiceWorkerStatusCode service_worker_status) { 134 ServiceWorkerStatusCode service_worker_status) {
137 DCHECK_CURRENTLY_ON(BrowserThread::IO); 135 DCHECK_CURRENTLY_ON(BrowserThread::IO);
138 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus.ServiceWorkerEvent", 136 UMA_HISTOGRAM_ENUMERATION("PushMessaging.DeliveryStatus.ServiceWorkerEvent",
139 service_worker_status, 137 service_worker_status,
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 case SERVICE_WORKER_ERROR_MAX_VALUE: 169 case SERVICE_WORKER_ERROR_MAX_VALUE:
172 NOTREACHED() << "Got unexpected error code: " << service_worker_status 170 NOTREACHED() << "Got unexpected error code: " << service_worker_status
173 << " " << ServiceWorkerStatusToString(service_worker_status); 171 << " " << ServiceWorkerStatusToString(service_worker_status);
174 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; 172 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR;
175 break; 173 break;
176 } 174 }
177 RunDeliverCallback(deliver_message_callback, delivery_status); 175 RunDeliverCallback(deliver_message_callback, delivery_status);
178 } 176 }
179 177
180 } // namespace content 178 } // namespace content
OLDNEW
« no previous file with comments | « AUTHORS ('k') | content/browser/service_worker/embedded_worker_test_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698