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

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

Issue 976313003: [DevTools] Expose DevToolsAgentHost for OOPIF, display it in chrome://inspect. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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
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/service_worker_devtools_manager.h" 16 #include "content/browser/devtools/service_worker_devtools_manager.h"
16 #include "content/browser/devtools/shared_worker_devtools_manager.h" 17 #include "content/browser/devtools/shared_worker_devtools_manager.h"
17 #include "content/public/browser/browser_thread.h" 18 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/devtools_manager_delegate.h" 19 #include "content/public/browser/devtools_manager_delegate.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 namespace { 23 namespace {
23 typedef std::map<std::string, DevToolsAgentHostImpl*> Instances; 24 typedef std::map<std::string, DevToolsAgentHostImpl*> Instances;
24 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER; 25 base::LazyInstance<Instances>::Leaky g_instances = LAZY_INSTANCE_INITIALIZER;
25 26
26 typedef std::vector<const DevToolsAgentHost::AgentStateCallback*> 27 typedef std::vector<const DevToolsAgentHost::AgentStateCallback*>
27 AgentStateCallbacks; 28 AgentStateCallbacks;
28 base::LazyInstance<AgentStateCallbacks>::Leaky g_callbacks = 29 base::LazyInstance<AgentStateCallbacks>::Leaky g_callbacks =
29 LAZY_INSTANCE_INITIALIZER; 30 LAZY_INSTANCE_INITIALIZER;
30 } // namespace 31 } // namespace
31 32
32 // static 33 // static
33 DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() { 34 DevToolsAgentHost::List DevToolsAgentHost::GetOrCreateAll() {
34 List result; 35 List result;
35 SharedWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); 36 SharedWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result);
36 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); 37 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result);
37 std::vector<WebContents*> wc_list = 38 RenderFrameDevToolsAgentHost::AddAllAgentHosts(&result);
38 DevToolsAgentHostImpl::GetInspectableWebContents();
39 for (std::vector<WebContents*>::iterator it = wc_list.begin();
40 it != wc_list.end(); ++it) {
41 result.push_back(GetOrCreateFor(*it));
42 }
43 return result; 39 return result;
44 } 40 }
45 41
46 DevToolsAgentHostImpl::DevToolsAgentHostImpl() 42 DevToolsAgentHostImpl::DevToolsAgentHostImpl()
47 : id_(base::GenerateGUID()), 43 : id_(base::GenerateGUID()),
48 client_(NULL) { 44 client_(NULL) {
49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 45 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
50 g_instances.Get()[id_] = this; 46 g_instances.Get()[id_] = this;
51 } 47 }
52 48
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 (*it)->Run(agent_host, attached); 188 (*it)->Run(agent_host, attached);
193 } 189 }
194 190
195 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { 191 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) {
196 DevToolsManager* manager = DevToolsManager::GetInstance(); 192 DevToolsManager* manager = DevToolsManager::GetInstance();
197 if (manager->delegate()) 193 if (manager->delegate())
198 manager->delegate()->Inspect(browser_context, this); 194 manager->delegate()->Inspect(browser_context, this);
199 } 195 }
200 196
201 } // namespace content 197 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698