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