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