Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(66)

Side by Side Diff: content/browser/devtools/devtools_agent_host_impl.cc

Issue 988003002: DevTools: pick sw targets to attach to on the backend side. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebaselined Created 5 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | content/browser/devtools/protocol/service_worker_handler.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/devtools_agent_host_impl.h" 5 #include "content/browser/devtools/devtools_agent_host_impl.h"
6 6
7 #include <map> 7 #include <map>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "base/guid.h" 11 #include "base/guid.h"
12 #include "base/lazy_instance.h" 12 #include "base/lazy_instance.h"
13 #include "content/browser/devtools/devtools_manager.h" 13 #include "content/browser/devtools/devtools_manager.h"
14 #include "content/browser/devtools/forwarding_agent_host.h" 14 #include "content/browser/devtools/forwarding_agent_host.h"
15 #include "content/browser/devtools/render_frame_devtools_agent_host.h" 15 #include "content/browser/devtools/render_frame_devtools_agent_host.h"
16 #include "content/browser/devtools/service_worker_devtools_agent_host.h"
16 #include "content/browser/devtools/service_worker_devtools_manager.h" 17 #include "content/browser/devtools/service_worker_devtools_manager.h"
18 #include "content/browser/devtools/shared_worker_devtools_agent_host.h"
17 #include "content/browser/devtools/shared_worker_devtools_manager.h" 19 #include "content/browser/devtools/shared_worker_devtools_manager.h"
18 #include "content/public/browser/browser_thread.h" 20 #include "content/public/browser/browser_thread.h"
19 #include "content/public/browser/devtools_manager_delegate.h" 21 #include "content/public/browser/devtools_manager_delegate.h"
20 22
21 namespace content { 23 namespace content {
22 24
23 namespace { 25 namespace {
24 typedef std::map<std::string, DevToolsAgentHostImpl*> Instances; 26 typedef std::map<std::string, DevToolsAgentHostImpl*> Instances;
25 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; 27 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER;
26 28
27 typedef std::vector<const DevToolsAgentHost::AgentStateCallback*> 29 typedef std::vector<const DevToolsAgentHost::AgentStateCallback*>
28 AgentStateCallbacks; 30 AgentStateCallbacks;
29 base::LazyInstance<AgentStateCallbacks>::Leaky g_callbacks = 31 base::LazyInstance<AgentStateCallbacks>::Leaky g_callbacks =
30 LAZY_INSTANCE_INITIALIZER; 32 LAZY_INSTANCE_INITIALIZER;
31 } // namespace 33 } // namespace
32 34
33 // static 35 // static
34 DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() { 36 DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() {
35 List result; 37 List result;
36 SharedWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); 38 SharedWorkerDevToolsAgentHost::List shared_list;
37 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); 39 SharedWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&shared_list);
40 for (const auto& host : shared_list)
41 result.push_back(host);
42
43 ServiceWorkerDevToolsAgentHost::List service_list;
44 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&service_list);
45 for (const auto& host : service_list)
46 result.push_back(host);
47
38 RenderFrameDevToolsAgentHost::AddAllAgentHosts(&result); 48 RenderFrameDevToolsAgentHost::AddAllAgentHosts(&result);
39 return result; 49 return result;
40 } 50 }
41 51
42 // Called on the UI thread. 52 // Called on the UI thread.
43 // static 53 // static
44 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( 54 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker(
45 int worker_process_id, 55 int worker_process_id,
46 int worker_route_id) { 56 int worker_route_id) {
47 if (scoped_refptr<DevToolsAgentHost> host = 57 if (scoped_refptr<DevToolsAgentHost> host =
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 (*it)->Run(agent_host, attached); 213 (*it)->Run(agent_host, attached);
204 } 214 }
205 215
206 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { 216 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) {
207 DevToolsManager* manager = DevToolsManager::GetInstance(); 217 DevToolsManager* manager = DevToolsManager::GetInstance();
208 if (manager->delegate()) 218 if (manager->delegate())
209 manager->delegate()->Inspect(browser_context, this); 219 manager->delegate()->Inspect(browser_context, this);
210 } 220 }
211 221
212 } // namespace content 222 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/devtools/protocol/service_worker_handler.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698