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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
176 EmbeddedWorkerDevToolsManager::FindExistingServiceWorkerAgentHost( | 176 EmbeddedWorkerDevToolsManager::FindExistingServiceWorkerAgentHost( |
177 const ServiceWorkerIdentifier& service_worker_id) { | 177 const ServiceWorkerIdentifier& service_worker_id) { |
178 AgentHostMap::iterator it = workers_.begin(); | 178 AgentHostMap::iterator it = workers_.begin(); |
179 for (; it != workers_.end(); ++it) { | 179 for (; it != workers_.end(); ++it) { |
180 if (it->second->Matches(service_worker_id)) | 180 if (it->second->Matches(service_worker_id)) |
181 break; | 181 break; |
182 } | 182 } |
183 return it; | 183 return it; |
184 } | 184 } |
185 | 185 |
| 186 DevToolsAgentHost::List |
| 187 EmbeddedWorkerDevToolsManager::GetOrCreateAllAgentHosts() { |
| 188 DevToolsAgentHost::List result; |
| 189 EmbeddedWorkerDevToolsManager* instance = GetInstance(); |
| 190 for (AgentHostMap::iterator it = instance->workers_.begin(); |
| 191 it != instance->workers_.end(); ++it) { |
| 192 if (!it->second->IsTerminated()) |
| 193 result.push_back(it->second); |
| 194 } |
| 195 return result; |
| 196 } |
| 197 |
186 void EmbeddedWorkerDevToolsManager::WorkerRestarted( | 198 void EmbeddedWorkerDevToolsManager::WorkerRestarted( |
187 const WorkerId& id, | 199 const WorkerId& id, |
188 const AgentHostMap::iterator& it) { | 200 const AgentHostMap::iterator& it) { |
189 EmbeddedWorkerDevToolsAgentHost* agent_host = it->second; | 201 EmbeddedWorkerDevToolsAgentHost* agent_host = it->second; |
190 agent_host->WorkerRestarted(id); | 202 agent_host->WorkerRestarted(id); |
191 workers_.erase(it); | 203 workers_.erase(it); |
192 workers_[id] = agent_host; | 204 workers_[id] = agent_host; |
193 } | 205 } |
194 | 206 |
195 void EmbeddedWorkerDevToolsManager::ResetForTesting() { | 207 void EmbeddedWorkerDevToolsManager::ResetForTesting() { |
196 workers_.clear(); | 208 workers_.clear(); |
197 } | 209 } |
198 | 210 |
199 } // namespace content | 211 } // namespace content |
OLD | NEW |