| OLD | NEW |
| 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 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 } | 72 } |
| 73 | 73 |
| 74 void EmbeddedWorkerRegistry::Shutdown() { | 74 void EmbeddedWorkerRegistry::Shutdown() { |
| 75 for (WorkerInstanceMap::iterator it = worker_map_.begin(); | 75 for (WorkerInstanceMap::iterator it = worker_map_.begin(); |
| 76 it != worker_map_.end(); | 76 it != worker_map_.end(); |
| 77 ++it) { | 77 ++it) { |
| 78 it->second->Stop(); | 78 it->second->Stop(); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 void EmbeddedWorkerRegistry::OnWorkerReadyForInspection( | |
| 83 int process_id, | |
| 84 int embedded_worker_id) { | |
| 85 EmbeddedWorkerInstance* worker = | |
| 86 GetWorkerForMessage(process_id, embedded_worker_id); | |
| 87 if (!worker) | |
| 88 return; | |
| 89 worker->OnReadyForInspection(); | |
| 90 } | |
| 91 | |
| 92 void EmbeddedWorkerRegistry::OnWorkerScriptLoaded(int process_id, | 82 void EmbeddedWorkerRegistry::OnWorkerScriptLoaded(int process_id, |
| 93 int embedded_worker_id) { | 83 int embedded_worker_id) { |
| 94 EmbeddedWorkerInstance* worker = | 84 EmbeddedWorkerInstance* worker = |
| 95 GetWorkerForMessage(process_id, embedded_worker_id); | 85 GetWorkerForMessage(process_id, embedded_worker_id); |
| 96 if (!worker) | 86 if (!worker) |
| 97 return; | 87 return; |
| 98 worker->OnScriptLoaded(); | 88 worker->OnScriptLoaded(); |
| 99 } | 89 } |
| 100 | 90 |
| 101 void EmbeddedWorkerRegistry::OnWorkerThreadStarted(int process_id, | 91 void EmbeddedWorkerRegistry::OnWorkerThreadStarted(int process_id, |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id); | 274 EmbeddedWorkerInstance* worker = GetWorker(embedded_worker_id); |
| 285 if (!worker || worker->process_id() != process_id) { | 275 if (!worker || worker->process_id() != process_id) { |
| 286 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", false); | 276 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", false); |
| 287 return nullptr; | 277 return nullptr; |
| 288 } | 278 } |
| 289 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", true); | 279 UMA_HISTOGRAM_BOOLEAN("ServiceWorker.WorkerForMessageFound", true); |
| 290 return worker; | 280 return worker; |
| 291 } | 281 } |
| 292 | 282 |
| 293 } // namespace content | 283 } // namespace content |
| OLD | NEW |