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

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: 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/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 #include <vector>
8 9
9 #include "base/stl_util.h" 10 #include "base/stl_util.h"
10 #include "content/browser/message_port_service.h" 11 #include "content/browser/message_port_service.h"
11 #include "content/browser/navigator_connect/service_port_service_impl.h" 12 #include "content/browser/navigator_connect/service_port_service_impl.h"
12 #include "content/browser/service_worker/service_worker_context_wrapper.h" 13 #include "content/browser/service_worker/service_worker_context_wrapper.h"
13 #include "content/common/service_worker/service_worker_utils.h" 14 #include "content/common/service_worker/service_worker_utils.h"
14 #include "content/public/browser/browser_thread.h" 15 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/navigator_connect_service_factory.h" 16 #include "content/public/browser/navigator_connect_service_factory.h"
16 #include "content/public/common/navigator_connect_client.h" 17 #include "content/public/common/navigator_connect_client.h"
17 #include "mojo/common/url_type_converters.h" 18 #include "mojo/common/url_type_converters.h"
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 148
148 ServiceWorkerVersion* active_version = registration->active_version(); 149 ServiceWorkerVersion* active_version = registration->active_version();
149 DCHECK(active_version); 150 DCHECK(active_version);
150 151
151 Port& service_port = ports_[service_port_id]; 152 Port& service_port = ports_[service_port_id];
152 service_port.service_worker_registration_id = registration->id(); 153 service_port.service_worker_registration_id = registration->id();
153 service_port.service_worker_registration_origin = 154 service_port.service_worker_registration_origin =
154 registration->pattern().GetOrigin(); 155 registration->pattern().GetOrigin();
155 156
156 active_version->RunAfterStartWorker( 157 active_version->RunAfterStartWorker(
158 ServiceWorkerMetrics::EventType::SERVICE_PORT_CONNECT,
157 base::Bind(&NavigatorConnectContextImpl::DispatchConnectEvent, this, 159 base::Bind(&NavigatorConnectContextImpl::DispatchConnectEvent, this,
158 callback, client_port_id, service_port_id, registration, 160 callback, client_port_id, service_port_id, registration,
159 make_scoped_refptr(active_version)), 161 make_scoped_refptr(active_version)),
160 base::Bind(&NavigatorConnectContextImpl::OnConnectError, this, callback, 162 base::Bind(&NavigatorConnectContextImpl::OnConnectError, this, callback,
161 client_port_id, service_port_id)); 163 client_port_id, service_port_id));
162 } 164 }
163 165
164 void NavigatorConnectContextImpl::DispatchConnectEvent( 166 void NavigatorConnectContextImpl::DispatchConnectEvent(
165 const ConnectCallback& callback, 167 const ConnectCallback& callback,
166 int client_port_id, 168 int client_port_id,
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 DCHECK(active_version); 260 DCHECK(active_version);
259 261
260 const Port& port = ports_[port_id]; 262 const Port& port = ports_[port_id];
261 NavigatorConnectClient client(port.target_url, port.client_origin, port_id); 263 NavigatorConnectClient client(port.target_url, port.client_origin, port_id);
262 active_version->DispatchCrossOriginMessageEvent( 264 active_version->DispatchCrossOriginMessageEvent(
263 client, message, sent_message_ports, 265 client, message, sent_message_ports,
264 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback)); 266 base::Bind(&ServiceWorkerUtils::NoOpStatusCallback));
265 } 267 }
266 268
267 } // namespace content 269 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698