| OLD | NEW |
| 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/devtools/embedded_worker_devtools_manager.h" | 5 #include "content/browser/devtools/embedded_worker_devtools_manager.h" |
| 6 | 6 |
| 7 #include "content/browser/devtools/devtools_manager_impl.h" | 7 #include "content/browser/devtools/devtools_manager_impl.h" |
| 8 #include "content/browser/devtools/devtools_protocol.h" | 8 #include "content/browser/devtools/devtools_protocol.h" |
| 9 #include "content/browser/devtools/devtools_protocol_constants.h" | 9 #include "content/browser/devtools/devtools_protocol_constants.h" |
| 10 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h" | 10 #include "content/browser/devtools/embedded_worker_devtools_agent_host.h" |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 DevToolsAgentHost* EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForWorker( | 55 DevToolsAgentHost* EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForWorker( |
| 56 int worker_process_id, | 56 int worker_process_id, |
| 57 int worker_route_id) { | 57 int worker_route_id) { |
| 58 AgentHostMap::iterator it = workers_.find( | 58 AgentHostMap::iterator it = workers_.find( |
| 59 WorkerId(worker_process_id, worker_route_id)); | 59 WorkerId(worker_process_id, worker_route_id)); |
| 60 return it == workers_.end() ? NULL : it->second; | 60 return it == workers_.end() ? NULL : it->second; |
| 61 } | 61 } |
| 62 | 62 |
| 63 DevToolsAgentHost* | |
| 64 EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForServiceWorker( | |
| 65 const ServiceWorkerIdentifier& service_worker_id) { | |
| 66 AgentHostMap::iterator it = | |
| 67 FindExistingServiceWorkerAgentHost(service_worker_id); | |
| 68 if (it == workers_.end()) | |
| 69 return NULL; | |
| 70 return GetDevToolsAgentHostForWorker(it->first.first, it->first.second); | |
| 71 } | |
| 72 | |
| 73 EmbeddedWorkerDevToolsManager::EmbeddedWorkerDevToolsManager() | 63 EmbeddedWorkerDevToolsManager::EmbeddedWorkerDevToolsManager() |
| 74 : debug_service_worker_on_start_(false) { | 64 : debug_service_worker_on_start_(false) { |
| 75 } | 65 } |
| 76 | 66 |
| 77 EmbeddedWorkerDevToolsManager::~EmbeddedWorkerDevToolsManager() { | 67 EmbeddedWorkerDevToolsManager::~EmbeddedWorkerDevToolsManager() { |
| 78 } | 68 } |
| 79 | 69 |
| 80 bool EmbeddedWorkerDevToolsManager::SharedWorkerCreated( | 70 bool EmbeddedWorkerDevToolsManager::SharedWorkerCreated( |
| 81 int worker_process_id, | 71 int worker_process_id, |
| 82 int worker_route_id, | 72 int worker_route_id, |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 agent_host->WorkerRestarted(id); | 151 agent_host->WorkerRestarted(id); |
| 162 workers_.erase(it); | 152 workers_.erase(it); |
| 163 workers_[id] = agent_host; | 153 workers_[id] = agent_host; |
| 164 } | 154 } |
| 165 | 155 |
| 166 void EmbeddedWorkerDevToolsManager::ResetForTesting() { | 156 void EmbeddedWorkerDevToolsManager::ResetForTesting() { |
| 167 workers_.clear(); | 157 workers_.clear(); |
| 168 } | 158 } |
| 169 | 159 |
| 170 } // namespace content | 160 } // namespace content |
| OLD | NEW |