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

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

Issue 1795863006: service worker: Attribute purpose to start worker attempts for UMA (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: patch for landing? Created 4 years, 9 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
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 "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 } 84 }
85 85
86 ServiceWorkerVersion* version = service_worker_registration->active_version(); 86 ServiceWorkerVersion* version = service_worker_registration->active_version();
87 DCHECK(version); 87 DCHECK(version);
88 88
89 // Hold on to the service worker registration in the callback to keep it 89 // Hold on to the service worker registration in the callback to keep it
90 // alive until the callback dies. Otherwise the registration could be 90 // alive until the callback dies. Otherwise the registration could be
91 // released when this method returns - before the event is delivered to the 91 // released when this method returns - before the event is delivered to the
92 // service worker. 92 // service worker.
93 version->RunAfterStartWorker( 93 version->RunAfterStartWorker(
94 ServiceWorkerMetrics::EventType::PUSH,
94 base::Bind(&PushMessagingRouter::DeliverMessageToWorker, 95 base::Bind(&PushMessagingRouter::DeliverMessageToWorker,
95 make_scoped_refptr(version), service_worker_registration, 96 make_scoped_refptr(version), service_worker_registration,
96 payload, deliver_message_callback), 97 payload, deliver_message_callback),
97 base::Bind(&PushMessagingRouter::DeliverMessageEnd, 98 base::Bind(&PushMessagingRouter::DeliverMessageEnd,
98 deliver_message_callback, service_worker_registration)); 99 deliver_message_callback, service_worker_registration));
99 } 100 }
100 101
101 // static 102 // static
102 void PushMessagingRouter::DeliverMessageToWorker( 103 void PushMessagingRouter::DeliverMessageToWorker(
103 const scoped_refptr<ServiceWorkerVersion>& service_worker, 104 const scoped_refptr<ServiceWorkerVersion>& service_worker,
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 case SERVICE_WORKER_ERROR_MAX_VALUE: 153 case SERVICE_WORKER_ERROR_MAX_VALUE:
153 NOTREACHED() << "Got unexpected error code: " << service_worker_status 154 NOTREACHED() << "Got unexpected error code: " << service_worker_status
154 << " " << ServiceWorkerStatusToString(service_worker_status); 155 << " " << ServiceWorkerStatusToString(service_worker_status);
155 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR; 156 delivery_status = PUSH_DELIVERY_STATUS_SERVICE_WORKER_ERROR;
156 break; 157 break;
157 } 158 }
158 RunDeliverCallback(deliver_message_callback, delivery_status); 159 RunDeliverCallback(deliver_message_callback, delivery_status);
159 } 160 }
160 161
161 } // namespace content 162 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698