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/service_worker_devtools_manager.h" | 5 #include "content/browser/devtools/service_worker_devtools_manager.h" |
6 | 6 |
7 #include "content/browser/devtools/ipc_devtools_agent_host.h" | 7 #include "content/browser/devtools/ipc_devtools_agent_host.h" |
8 #include "content/browser/devtools/service_worker_devtools_agent_host.h" | 8 #include "content/browser/devtools/service_worker_devtools_agent_host.h" |
9 #include "content/public/browser/browser_thread.h" | 9 #include "content/public/browser/browser_thread.h" |
10 #include "content/public/browser/render_process_host.h" | 10 #include "content/public/browser/render_process_host.h" |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 void ServiceWorkerDevToolsManager::AddAllAgentHosts( | 59 void ServiceWorkerDevToolsManager::AddAllAgentHosts( |
60 ServiceWorkerDevToolsAgentHost::List* result) { | 60 ServiceWorkerDevToolsAgentHost::List* result) { |
61 for (auto& worker : workers_) { | 61 for (auto& worker : workers_) { |
62 if (!worker.second->IsTerminated()) | 62 if (!worker.second->IsTerminated()) |
63 result->push_back(worker.second); | 63 result->push_back(worker.second); |
64 } | 64 } |
65 } | 65 } |
66 | 66 |
| 67 void ServiceWorkerDevToolsManager::AddAllAgentHostsForBrowserContext( |
| 68 BrowserContext* browser_context, |
| 69 ServiceWorkerDevToolsAgentHost::List* result) { |
| 70 for (auto& worker : workers_) { |
| 71 if (!worker.second->IsTerminated() && |
| 72 worker.second->GetBrowserContext() == browser_context) { |
| 73 result->push_back(worker.second); |
| 74 } |
| 75 } |
| 76 } |
| 77 |
67 bool ServiceWorkerDevToolsManager::WorkerCreated( | 78 bool ServiceWorkerDevToolsManager::WorkerCreated( |
68 int worker_process_id, | 79 int worker_process_id, |
69 int worker_route_id, | 80 int worker_route_id, |
70 const ServiceWorkerIdentifier& service_worker_id) { | 81 const ServiceWorkerIdentifier& service_worker_id) { |
71 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 82 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
72 const WorkerId id(worker_process_id, worker_route_id); | 83 const WorkerId id(worker_process_id, worker_route_id); |
73 AgentHostMap::iterator it = FindExistingWorkerAgentHost(service_worker_id); | 84 AgentHostMap::iterator it = FindExistingWorkerAgentHost(service_worker_id); |
74 if (it == workers_.end()) { | 85 if (it == workers_.end()) { |
75 scoped_refptr<ServiceWorkerDevToolsAgentHost> host = | 86 scoped_refptr<ServiceWorkerDevToolsAgentHost> host = |
76 new ServiceWorkerDevToolsAgentHost( | 87 new ServiceWorkerDevToolsAgentHost( |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
165 break; | 176 break; |
166 } | 177 } |
167 return it; | 178 return it; |
168 } | 179 } |
169 | 180 |
170 void ServiceWorkerDevToolsManager::ResetForTesting() { | 181 void ServiceWorkerDevToolsManager::ResetForTesting() { |
171 workers_.clear(); | 182 workers_.clear(); |
172 } | 183 } |
173 | 184 |
174 } // namespace content | 185 } // namespace content |
OLD | NEW |