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

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

Issue 268753004: Add WorkerScriptLoaded message to support attaching DevTools while starting ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: incorporated kinuko's comment Created 6 years, 8 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 82b9bb0397b63b2bfba37239102f9b26975012ac..7ed1ba093f98991c966f89a0d242fc3dffd280d7 100644
--- a/content/browser/service_worker/embedded_worker_registry.cc
+++ b/content/browser/service_worker/embedded_worker_registry.cc
@@ -84,6 +84,28 @@ void EmbeddedWorkerRegistry::Shutdown() {
}
}
+void EmbeddedWorkerRegistry::OnWorkerScriptLoaded(int process_id,
+ int embedded_worker_id) {
+ WorkerInstanceMap::iterator found = worker_map_.find(embedded_worker_id);
+ if (found == worker_map_.end()) {
+ LOG(ERROR) << "Worker " << embedded_worker_id << " not registered";
+ return;
+ }
+ DCHECK_EQ(found->second->process_id(), process_id);
nasko 2014/05/02 16:24:46 What are the implications of this check failing? W
horo 2014/05/06 00:26:48 Done.
+ found->second->OnScriptLoaded();
+}
+
+void EmbeddedWorkerRegistry::OnWorkerScriptLoadFailed(int process_id,
+ int embedded_worker_id) {
+ WorkerInstanceMap::iterator found = worker_map_.find(embedded_worker_id);
+ if (found == worker_map_.end()) {
+ LOG(ERROR) << "Worker " << embedded_worker_id << " not registered";
+ return;
+ }
+ DCHECK_EQ(found->second->process_id(), process_id);
+ found->second->OnScriptLoadFailed();
+}
+
void EmbeddedWorkerRegistry::OnWorkerStarted(
int process_id, int thread_id, int embedded_worker_id) {
DCHECK(!ContainsKey(worker_process_map_, process_id) ||

Powered by Google App Engine
This is Rietveld 408576698