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

Side by Side Diff: content/browser/debugger/render_view_devtools_agent_host.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
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/browser/debugger/render_view_devtools_agent_host.h" 5 #include "content/browser/debugger/render_view_devtools_agent_host.h"
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "content/browser/debugger/devtools_manager.h" 9 #include "content/browser/debugger/devtools_manager.h"
10 #include "content/browser/debugger/render_view_devtools_agent_host.h" 10 #include "content/browser/debugger/render_view_devtools_agent_host.h"
11 #include "content/browser/renderer_host/render_process_host.h" 11 #include "content/browser/renderer_host/render_process_host.h"
12 #include "content/browser/renderer_host/render_view_host.h" 12 #include "content/browser/renderer_host/render_view_host.h"
13 #include "content/browser/site_instance.h" 13 #include "content/browser/site_instance.h"
14 #include "content/browser/tab_contents/tab_contents.h" 14 #include "content/browser/tab_contents/tab_contents.h"
15 #include "content/common/devtools_messages.h" 15 #include "content/common/devtools_messages.h"
16 #include "content/public/browser/content_browser_client.h" 16 #include "content/public/browser/content_browser_client.h"
17 #include "content/public/browser/notification_service.h" 17 #include "content/public/browser/notification_service.h"
18 #include "content/public/browser/notification_types.h" 18 #include "content/public/browser/notification_types.h"
19 19
20 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances; 20 typedef std::map<RenderViewHost*, RenderViewDevToolsAgentHost*> Instances;
21 21
22 namespace { 22 namespace {
23 base::LazyInstance<Instances, 23 base::LazyInstance<Instances,
24 base::LeakyLazyInstanceTraits<Instances> > 24 base::LeakyLazyInstanceTraits<Instances> >
25 g_instances(base::LINKER_INITIALIZED); 25 g_instances = LAZY_INSTANCE_INITIALIZER;
26 } // namespace 26 } // namespace
27 27
28 DevToolsAgentHost* RenderViewDevToolsAgentHost::FindFor( 28 DevToolsAgentHost* RenderViewDevToolsAgentHost::FindFor(
29 RenderViewHost* rvh) { 29 RenderViewHost* rvh) {
30 Instances::iterator it = g_instances.Get().find(rvh); 30 Instances::iterator it = g_instances.Get().find(rvh);
31 if (it != g_instances.Get().end()) 31 if (it != g_instances.Get().end())
32 return it->second; 32 return it->second;
33 return new RenderViewDevToolsAgentHost(rvh); 33 return new RenderViewDevToolsAgentHost(rvh);
34 } 34 }
35 35
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 } 108 }
109 109
110 void RenderViewDevToolsAgentHost::OnClearBrowserCache() { 110 void RenderViewDevToolsAgentHost::OnClearBrowserCache() {
111 content::GetContentClient()->browser()->ClearCache(render_view_host_); 111 content::GetContentClient()->browser()->ClearCache(render_view_host_);
112 } 112 }
113 113
114 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() { 114 void RenderViewDevToolsAgentHost::OnClearBrowserCookies() {
115 content::GetContentClient()->browser()->ClearCookies(render_view_host_); 115 content::GetContentClient()->browser()->ClearCookies(render_view_host_);
116 } 116 }
117 117
OLDNEW
« no previous file with comments | « content/browser/debugger/devtools_http_protocol_handler.cc ('k') | content/browser/gpu/gpu_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698