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

Side by Side Diff: content/renderer/devtools_agent.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: willchan comments + rebase Created 9 years, 1 month 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 | Annotate | Revision Log
« no previous file with comments | « content/public/utility/utility_thread.cc ('k') | content/renderer/gpu/renderer_gl_context.cc » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 9 #include "base/command_line.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 } 47 }
48 virtual void quitNow() { 48 virtual void quitNow() {
49 message_loop_->QuitNow(); 49 message_loop_->QuitNow();
50 } 50 }
51 private: 51 private:
52 MessageLoop* message_loop_; 52 MessageLoop* message_loop_;
53 }; 53 };
54 54
55 typedef std::map<int, DevToolsAgent*> IdToAgentMap; 55 typedef std::map<int, DevToolsAgent*> IdToAgentMap;
56 base::LazyInstance<IdToAgentMap, base::LeakyLazyInstanceTraits<IdToAgentMap> > 56 base::LazyInstance<IdToAgentMap, base::LeakyLazyInstanceTraits<IdToAgentMap> >
57 g_agent_for_routing_id(base::LINKER_INITIALIZED); 57 g_agent_for_routing_id = LAZY_INSTANCE_INITIALIZER;
58 58
59 } // namespace 59 } // namespace
60 60
61 DevToolsAgent::DevToolsAgent(RenderViewImpl* render_view) 61 DevToolsAgent::DevToolsAgent(RenderViewImpl* render_view)
62 : content::RenderViewObserver(render_view), 62 : content::RenderViewObserver(render_view),
63 is_attached_(false) { 63 is_attached_(false) {
64 g_agent_for_routing_id.Get()[routing_id()] = this; 64 g_agent_for_routing_id.Get()[routing_id()] = this;
65 65
66 CommandLine* cmd = CommandLine::ForCurrentProcess(); 66 CommandLine* cmd = CommandLine::ForCurrentProcess();
67 expose_v8_debugger_protocol_ = cmd->HasSwitch(switches::kRemoteShellPort); 67 expose_v8_debugger_protocol_ = cmd->HasSwitch(switches::kRemoteShellPort);
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
203 WebDevToolsAgent* DevToolsAgent::GetWebAgent() { 203 WebDevToolsAgent* DevToolsAgent::GetWebAgent() {
204 WebView* web_view = render_view()->GetWebView(); 204 WebView* web_view = render_view()->GetWebView();
205 if (!web_view) 205 if (!web_view)
206 return NULL; 206 return NULL;
207 return web_view->devToolsAgent(); 207 return web_view->devToolsAgent();
208 } 208 }
209 209
210 bool DevToolsAgent::IsAttached() { 210 bool DevToolsAgent::IsAttached() {
211 return is_attached_; 211 return is_attached_;
212 } 212 }
OLDNEW
« no previous file with comments | « content/public/utility/utility_thread.cc ('k') | content/renderer/gpu/renderer_gl_context.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698