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

Unified Diff: content/browser/service_worker/embedded_worker_registry.cc

Issue 2149273003: service worker: Tweak some documentation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/embedded_worker_registry.cc
diff --git a/content/browser/service_worker/embedded_worker_registry.cc b/content/browser/service_worker/embedded_worker_registry.cc
index f0031c5ec9b0493c4c612d38daf488a92ad9f401..dd28900a60137ea85ec9bfd4058a2eb08280639c 100644
--- a/content/browser/service_worker/embedded_worker_registry.cc
+++ b/content/browser/service_worker/embedded_worker_registry.cc
@@ -256,12 +256,15 @@ ServiceWorkerStatusCode EmbeddedWorkerRegistry::SendStartWorker(
DCHECK(ContainsKey(process_sender_map_, process_id));
int embedded_worker_id = params->embedded_worker_id;
+#ifndef NDEBUG
nhiroki 2016/07/19 03:37:53 "#if DCHECK_IS_ON()" would be better for DCHECK_AL
falken 2016/07/22 01:34:47 Acknowledged.
+ // Assert the embedded worker's process id is |process_id|.
WorkerInstanceMap::iterator found = worker_map_.find(embedded_worker_id);
DCHECK(found != worker_map_.end());
DCHECK_EQ(found->second->process_id(), process_id);
nhiroki 2016/07/19 03:37:53 Optional: I'd prefer not to have macros in a produ
falken 2016/07/22 01:34:47 Much better, done.
-
+ // Assert the embedded worker is not in the map for starting/running workers.
DCHECK(!ContainsKey(worker_process_map_, process_id) ||
worker_process_map_[process_id].count(embedded_worker_id) == 0);
nhiroki 2016/07/19 03:37:53 Optional: "!ContainsKey(worker_process_map_[proces
falken 2016/07/22 01:34:47 Huh yea. Not sure why I used count in the first pl
+#endif // NDEBUG
ServiceWorkerStatusCode status =
Send(process_id, new EmbeddedWorkerMsg_StartWorker(*params));

Powered by Google App Engine
This is Rietveld 408576698