OLD | NEW |
1 // Copyright (c) 2011 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/renderer/devtools_agent.h" | 5 #include "content/renderer/devtools_agent.h" |
6 | 6 |
7 #include <map> | 7 #include <map> |
8 | 8 |
9 #include "base/lazy_instance.h" | 9 #include "base/lazy_instance.h" |
10 #include "base/message_loop.h" | 10 #include "base/message_loop.h" |
11 #include "base/process.h" | 11 #include "base/process.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 message_loop_->SetNestableTasksAllowed(old_state); | 44 message_loop_->SetNestableTasksAllowed(old_state); |
45 } | 45 } |
46 virtual void quitNow() { | 46 virtual void quitNow() { |
47 message_loop_->QuitNow(); | 47 message_loop_->QuitNow(); |
48 } | 48 } |
49 private: | 49 private: |
50 MessageLoop* message_loop_; | 50 MessageLoop* message_loop_; |
51 }; | 51 }; |
52 | 52 |
53 typedef std::map<int, DevToolsAgent*> IdToAgentMap; | 53 typedef std::map<int, DevToolsAgent*> IdToAgentMap; |
54 base::LazyInstance<IdToAgentMap, base::LeakyLazyInstanceTraits<IdToAgentMap> > | 54 base::LazyInstance<IdToAgentMap>::Leaky |
55 g_agent_for_routing_id = LAZY_INSTANCE_INITIALIZER; | 55 g_agent_for_routing_id = LAZY_INSTANCE_INITIALIZER; |
56 | 56 |
57 } // namespace | 57 } // namespace |
58 | 58 |
59 DevToolsAgent::DevToolsAgent(RenderViewImpl* render_view) | 59 DevToolsAgent::DevToolsAgent(RenderViewImpl* render_view) |
60 : content::RenderViewObserver(render_view), | 60 : content::RenderViewObserver(render_view), |
61 is_attached_(false) { | 61 is_attached_(false) { |
62 g_agent_for_routing_id.Get()[routing_id()] = this; | 62 g_agent_for_routing_id.Get()[routing_id()] = this; |
63 | 63 |
64 render_view->webview()->setDevToolsAgentClient(this); | 64 render_view->webview()->setDevToolsAgentClient(this); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { | 179 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { |
180 WebView* web_view = render_view()->GetWebView(); | 180 WebView* web_view = render_view()->GetWebView(); |
181 if (!web_view) | 181 if (!web_view) |
182 return NULL; | 182 return NULL; |
183 return web_view->devToolsAgent(); | 183 return web_view->devToolsAgent(); |
184 } | 184 } |
185 | 185 |
186 bool DevToolsAgent::IsAttached() { | 186 bool DevToolsAgent::IsAttached() { |
187 return is_attached_; | 187 return is_attached_; |
188 } | 188 } |
OLD | NEW |