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 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 return service_worker_context_ == other.service_worker_context_ && | 45 return service_worker_context_ == other.service_worker_context_ && |
46 service_worker_version_id_ == other.service_worker_version_id_; | 46 service_worker_version_id_ == other.service_worker_version_id_; |
47 } | 47 } |
48 | 48 |
49 // static | 49 // static |
50 EmbeddedWorkerDevToolsManager* EmbeddedWorkerDevToolsManager::GetInstance() { | 50 EmbeddedWorkerDevToolsManager* EmbeddedWorkerDevToolsManager::GetInstance() { |
51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 51 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
52 return Singleton<EmbeddedWorkerDevToolsManager>::get(); | 52 return Singleton<EmbeddedWorkerDevToolsManager>::get(); |
53 } | 53 } |
54 | 54 |
55 DevToolsAgentHostImpl* | 55 DevToolsAgentHost* EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForWorker( |
56 EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForWorker( | |
57 int worker_process_id, | 56 int worker_process_id, |
58 int worker_route_id) { | 57 int worker_route_id) { |
59 AgentHostMap::iterator it = workers_.find( | 58 AgentHostMap::iterator it = workers_.find( |
60 WorkerId(worker_process_id, worker_route_id)); | 59 WorkerId(worker_process_id, worker_route_id)); |
61 return it == workers_.end() ? NULL : it->second; | 60 return it == workers_.end() ? NULL : it->second; |
62 } | 61 } |
63 | 62 |
64 DevToolsAgentHostImpl* | 63 DevToolsAgentHost* |
65 EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForServiceWorker( | 64 EmbeddedWorkerDevToolsManager::GetDevToolsAgentHostForServiceWorker( |
66 const ServiceWorkerIdentifier& service_worker_id) { | 65 const ServiceWorkerIdentifier& service_worker_id) { |
67 AgentHostMap::iterator it = | 66 AgentHostMap::iterator it = |
68 FindExistingServiceWorkerAgentHost(service_worker_id); | 67 FindExistingServiceWorkerAgentHost(service_worker_id); |
69 if (it == workers_.end()) | 68 if (it == workers_.end()) |
70 return NULL; | 69 return NULL; |
71 return GetDevToolsAgentHostForWorker(it->first.first, it->first.second); | 70 return GetDevToolsAgentHostForWorker(it->first.first, it->first.second); |
72 } | 71 } |
73 | 72 |
74 EmbeddedWorkerDevToolsManager::EmbeddedWorkerDevToolsManager() | 73 EmbeddedWorkerDevToolsManager::EmbeddedWorkerDevToolsManager() |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
162 agent_host->WorkerRestarted(id); | 161 agent_host->WorkerRestarted(id); |
163 workers_.erase(it); | 162 workers_.erase(it); |
164 workers_[id] = agent_host; | 163 workers_[id] = agent_host; |
165 } | 164 } |
166 | 165 |
167 void EmbeddedWorkerDevToolsManager::ResetForTesting() { | 166 void EmbeddedWorkerDevToolsManager::ResetForTesting() { |
168 workers_.clear(); | 167 workers_.clear(); |
169 } | 168 } |
170 | 169 |
171 } // namespace content | 170 } // namespace content |
OLD | NEW |