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

Side by Side Diff: content/browser/navigator_connect/navigator_connect_context_impl.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: 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/navigator_connect/navigator_connect_context_impl.h" 5 #include "content/browser/navigator_connect/navigator_connect_context_impl.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/message_port_service.h" 10 #include "content/browser/message_port_service.h"
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 Port& service_port = ports_[service_port_id]; 151 Port& service_port = ports_[service_port_id];
152 service_port.service_worker_registration_id = registration->id(); 152 service_port.service_worker_registration_id = registration->id();
153 service_port.service_worker_registration_origin = 153 service_port.service_worker_registration_origin =
154 registration->pattern().GetOrigin(); 154 registration->pattern().GetOrigin();
155 155
156 active_version->RunAfterStartWorker( 156 active_version->RunAfterStartWorker(
157 base::Bind(&NavigatorConnectContextImpl::DispatchConnectEvent, this, 157 base::Bind(&NavigatorConnectContextImpl::DispatchConnectEvent, this,
158 callback, client_port_id, service_port_id, registration, 158 callback, client_port_id, service_port_id, registration,
159 make_scoped_refptr(active_version)), 159 make_scoped_refptr(active_version)),
160 base::Bind(&NavigatorConnectContextImpl::OnConnectError, this, callback, 160 base::Bind(&NavigatorConnectContextImpl::OnConnectError, this, callback,
161 client_port_id, service_port_id)); 161 client_port_id, service_port_id),
162 ServiceWorkerMetrics::EventType::SERVICE_PORT_CONNECT);
162 } 163 }
163 164
164 void NavigatorConnectContextImpl::DispatchConnectEvent( 165 void NavigatorConnectContextImpl::DispatchConnectEvent(
165 const ConnectCallback& callback, 166 const ConnectCallback& callback,
166 int client_port_id, 167 int client_port_id,
167 int service_port_id, 168 int service_port_id,
168 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration, 169 const scoped_refptr<ServiceWorkerRegistration>& service_worker_registration,
169 const scoped_refptr<ServiceWorkerVersion>& worker) { 170 const scoped_refptr<ServiceWorkerVersion>& worker) {
170 DCHECK_CURRENTLY_ON(BrowserThread::IO); 171 DCHECK_CURRENTLY_ON(BrowserThread::IO);
171 DCHECK(ContainsKey(ports_, client_port_id)); 172 DCHECK(ContainsKey(ports_, client_port_id));
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 DCHECK(active_version); 259 DCHECK(active_version);
259 260
260 const Port& port = ports_[port_id]; 261 const Port& port = ports_[port_id];
261 NavigatorConnectClient client(port.target_url, port.client_origin, port_id); 262 NavigatorConnectClient client(port.target_url, port.client_origin, port_id);
262 active_version->DispatchCrossOriginMessageEvent( 263 active_version->DispatchCrossOriginMessageEvent(
263 client, message, sent_message_ports, 264 client, message, sent_message_ports,
264 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 265 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
265 } 266 }
266 267
267 } // namespace content 268 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698