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 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 EmbeddedWorkerDevToolsManager::FindExistingServiceWorkerAgentHost( | 148 EmbeddedWorkerDevToolsManager::FindExistingServiceWorkerAgentHost( |
149 const ServiceWorkerIdentifier& service_worker_id) { | 149 const ServiceWorkerIdentifier& service_worker_id) { |
150 AgentHostMap::iterator it = workers_.begin(); | 150 AgentHostMap::iterator it = workers_.begin(); |
151 for (; it != workers_.end(); ++it) { | 151 for (; it != workers_.end(); ++it) { |
152 if (it->second->Matches(service_worker_id)) | 152 if (it->second->Matches(service_worker_id)) |
153 break; | 153 break; |
154 } | 154 } |
155 return it; | 155 return it; |
156 } | 156 } |
157 | 157 |
| 158 DevToolsAgentHost::List |
| 159 EmbeddedWorkerDevToolsManager::GetOrCreateAllAgentHosts() { |
| 160 DevToolsAgentHost::List result; |
| 161 EmbeddedWorkerDevToolsManager* instance = GetInstance(); |
| 162 for (AgentHostMap::iterator it = instance->workers_.begin(); |
| 163 it != instance->workers_.end(); ++it) { |
| 164 result.push_back(it->second); |
| 165 } |
| 166 return result; |
| 167 } |
| 168 |
158 void EmbeddedWorkerDevToolsManager::WorkerRestarted( | 169 void EmbeddedWorkerDevToolsManager::WorkerRestarted( |
159 const WorkerId& id, | 170 const WorkerId& id, |
160 const AgentHostMap::iterator& it) { | 171 const AgentHostMap::iterator& it) { |
161 EmbeddedWorkerDevToolsAgentHost* agent_host = it->second; | 172 EmbeddedWorkerDevToolsAgentHost* agent_host = it->second; |
162 agent_host->WorkerRestarted(id); | 173 agent_host->WorkerRestarted(id); |
163 workers_.erase(it); | 174 workers_.erase(it); |
164 workers_[id] = agent_host; | 175 workers_[id] = agent_host; |
165 } | 176 } |
166 | 177 |
167 void EmbeddedWorkerDevToolsManager::ResetForTesting() { | 178 void EmbeddedWorkerDevToolsManager::ResetForTesting() { |
168 workers_.clear(); | 179 workers_.clear(); |
169 } | 180 } |
170 | 181 |
171 } // namespace content | 182 } // namespace content |
OLD | NEW |