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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 worker_route_id)) { | 60 worker_route_id)) { |
61 return host; | 61 return host; |
62 } | 62 } |
63 return ServiceWorkerDevToolsManager::GetInstance() | 63 return ServiceWorkerDevToolsManager::GetInstance() |
64 ->GetDevToolsAgentHostForWorker(worker_process_id, worker_route_id); | 64 ->GetDevToolsAgentHostForWorker(worker_process_id, worker_route_id); |
65 } | 65 } |
66 | 66 |
67 DevToolsAgentHostImpl::DevToolsAgentHostImpl() | 67 DevToolsAgentHostImpl::DevToolsAgentHostImpl() |
68 : id_(base::GenerateGUID()), | 68 : id_(base::GenerateGUID()), |
69 client_(NULL) { | 69 client_(NULL) { |
70 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 70 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
71 g_instances.Get()[id_] = this; | 71 g_instances.Get()[id_] = this; |
72 } | 72 } |
73 | 73 |
74 DevToolsAgentHostImpl::~DevToolsAgentHostImpl() { | 74 DevToolsAgentHostImpl::~DevToolsAgentHostImpl() { |
75 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 75 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
76 g_instances.Get().erase(g_instances.Get().find(id_)); | 76 g_instances.Get().erase(g_instances.Get().find(id_)); |
77 } | 77 } |
78 | 78 |
79 // static | 79 // static |
80 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForId( | 80 scoped_refptr<DevToolsAgentHost> DevToolsAgentHost::GetForId( |
81 const std::string& id) { | 81 const std::string& id) { |
82 if (g_instances == NULL) | 82 if (g_instances == NULL) |
83 return NULL; | 83 return NULL; |
84 Instances::iterator it = g_instances.Get().find(id); | 84 Instances::iterator it = g_instances.Get().find(id); |
85 if (it == g_instances.Get().end()) | 85 if (it == g_instances.Get().end()) |
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
213 (*it)->Run(agent_host, attached); | 213 (*it)->Run(agent_host, attached); |
214 } | 214 } |
215 | 215 |
216 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { | 216 void DevToolsAgentHostImpl::Inspect(BrowserContext* browser_context) { |
217 DevToolsManager* manager = DevToolsManager::GetInstance(); | 217 DevToolsManager* manager = DevToolsManager::GetInstance(); |
218 if (manager->delegate()) | 218 if (manager->delegate()) |
219 manager->delegate()->Inspect(browser_context, this); | 219 manager->delegate()->Inspect(browser_context, this); |
220 } | 220 } |
221 | 221 |
222 } // namespace content | 222 } // namespace content |
OLD | NEW |