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

Side by Side Diff: content/browser/service_worker/embedded_worker_registry.cc

Issue 2353853002: ServiceWorker: Add CHECK to EmbeddedWorkerRegistry for debug (Closed)
Patch Set: fix compile failures Created 4 years, 3 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/service_worker/embedded_worker_registry.h" 5 #include "content/browser/service_worker/embedded_worker_registry.h"
6 6
7 #include "base/bind_helpers.h" 7 #include "base/bind_helpers.h"
8 #include "base/metrics/histogram_macros.h" 8 #include "base/metrics/histogram_macros.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/renderer_host/render_widget_helper.h" 10 #include "content/browser/renderer_host/render_widget_helper.h"
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 bool EmbeddedWorkerRegistry::CanHandle(int embedded_worker_id) const { 222 bool EmbeddedWorkerRegistry::CanHandle(int embedded_worker_id) const {
223 if (embedded_worker_id < initial_embedded_worker_id_ || 223 if (embedded_worker_id < initial_embedded_worker_id_ ||
224 next_embedded_worker_id_ <= embedded_worker_id) { 224 next_embedded_worker_id_ <= embedded_worker_id) {
225 return false; 225 return false;
226 } 226 }
227 return true; 227 return true;
228 } 228 }
229 229
230 MessagePortMessageFilter* 230 MessagePortMessageFilter*
231 EmbeddedWorkerRegistry::MessagePortMessageFilterForProcess(int process_id) { 231 EmbeddedWorkerRegistry::MessagePortMessageFilterForProcess(int process_id) {
232 // TODO(nhiroki): Change this to DCHECK after https://crbug.com/648477 is
233 // fixed.
234 CHECK(
235 base::ContainsKey(process_message_port_message_filter_map_, process_id));
232 return process_message_port_message_filter_map_[process_id]; 236 return process_message_port_message_filter_map_[process_id];
233 } 237 }
234 238
235 EmbeddedWorkerRegistry::EmbeddedWorkerRegistry( 239 EmbeddedWorkerRegistry::EmbeddedWorkerRegistry(
236 const base::WeakPtr<ServiceWorkerContextCore>& context, 240 const base::WeakPtr<ServiceWorkerContextCore>& context,
237 int initial_embedded_worker_id) 241 int initial_embedded_worker_id)
238 : context_(context), 242 : context_(context),
239 next_embedded_worker_id_(initial_embedded_worker_id), 243 next_embedded_worker_id_(initial_embedded_worker_id),
240 initial_embedded_worker_id_(initial_embedded_worker_id) { 244 initial_embedded_worker_id_(initial_embedded_worker_id) {
241 } 245 }
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
299 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id); 303 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id);
300 if (!worker || worker->process_id() != process_id) { 304 if (!worker || worker->process_id() != process_id) {
301 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", false); 305 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", false);
302 return nullptr; 306 return nullptr;
303 } 307 }
304 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", true); 308 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", true);
305 return worker; 309 return worker;
306 } 310 }
307 311
308 } // namespace content 312 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698