| OLD | NEW |
| 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" |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); | 36 ServiceWorkerDevToolsManager::GetInstance()->AddAllAgentHosts(&result); |
| 37 std::vector<WebContents*> wc_list = | 37 std::vector<WebContents*> wc_list = |
| 38 DevToolsAgentHostImpl::GetInspectableWebContents(); | 38 DevToolsAgentHostImpl::GetInspectableWebContents(); |
| 39 for (std::vector<WebContents*>::iterator it = wc_list.begin(); | 39 for (std::vector<WebContents*>::iterator it = wc_list.begin(); |
| 40 it != wc_list.end(); ++it) { | 40 it != wc_list.end(); ++it) { |
| 41 result.push_back(GetOrCreateFor(*it)); | 41 result.push_back(GetOrCreateFor(*it)); |
| 42 } | 42 } |
| 43 return result; | 43 return result; |
| 44 } | 44 } |
| 45 | 45 |
| 46 // Called on the UI thread. |
| 47 // static |
| 48 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForWorker( |
| 49 int worker_process_id, |
| 50 int worker_route_id) { |
| 51 if (scoped_refptr<DevToolsAgentHost> host = |
| 52 SharedWorkerDevToolsManager::GetInstance() |
| 53 ->GetDevToolsAgentHostForWorker(worker_process_id, |
| 54 worker_route_id)) { |
| 55 return host; |
| 56 } |
| 57 return ServiceWorkerDevToolsManager::GetInstance() |
| 58 ->GetDevToolsAgentHostForWorker(worker_process_id, worker_route_id); |
| 59 } |
| 60 |
| 46 DevToolsAgentHostImpl::DevToolsAgentHostImpl() | 61 DevToolsAgentHostImpl::DevToolsAgentHostImpl() |
| 47 : id_(base::GenerateGUID()), | 62 : id_(base::GenerateGUID()), |
| 48 client_(NULL) { | 63 client_(NULL) { |
| 49 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 64 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 50 g_instances.Get()[id_] = this; | 65 g_instances.Get()[id_] = this; |
| 51 } | 66 } |
| 52 | 67 |
| 53 DevToolsAgentHostImpl::~DevToolsAgentHostImpl() { | 68 DevToolsAgentHostImpl::~DevToolsAgentHostImpl() { |
| 54 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 69 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 55 g_instances.Get().erase(g_instances.Get().find(id_)); | 70 g_instances.Get().erase(g_instances.Get().find(id_)); |
| (...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 (*it)->Run(agent_host, attached); | 207 (*it)->Run(agent_host, attached); |
| 193 } | 208 } |
| 194 | 209 |
| 195 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { | 210 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { |
| 196 DevToolsManager* manager = DevToolsManager::GetInstance(); | 211 DevToolsManager* manager = DevToolsManager::GetInstance(); |
| 197 if (manager->delegate()) | 212 if (manager->delegate()) |
| 198 manager->delegate()->Inspect(browser_context, this); | 213 manager->delegate()->Inspect(browser_context, this); |
| 199 } | 214 } |
| 200 | 215 |
| 201 } // namespace content | 216 } // namespace content |
| OLD | NEW |