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

Side by Side Diff: content/browser/renderer_host/render_process_host.cc

Issue 8491043: Allow linker initialization of lazy instance (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: thakis comment, renamed LAZY_INSTANCE_INITIALIZER 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/renderer_host/render_process_host.h" 5 #include "content/browser/renderer_host/render_process_host.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/sys_info.h" 10 #include "base/sys_info.h"
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
78 if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(host->id()) != 78 if (ChildProcessSecurityPolicy::GetInstance()->HasWebUIBindings(host->id()) !=
79 content::WebUIFactory::Get()->HasWebUIScheme(site_url)) 79 content::WebUIFactory::Get()->HasWebUIScheme(site_url))
80 return false; 80 return false;
81 81
82 return content::GetContentClient()->browser()->IsSuitableHost(host, site_url); 82 return content::GetContentClient()->browser()->IsSuitableHost(host, site_url);
83 } 83 }
84 84
85 // the global list of all renderer processes 85 // the global list of all renderer processes
86 base::LazyInstance<IDMap<RenderProcessHost>, 86 base::LazyInstance<IDMap<RenderProcessHost>,
87 base::LeakyLazyInstanceTraits<IDMap<RenderProcessHost> > > 87 base::LeakyLazyInstanceTraits<IDMap<RenderProcessHost> > >
88 g_all_hosts(base::LINKER_INITIALIZED); 88 g_all_hosts = LAZY_INSTANCE_INITIALIZER;
89 89
90 } // namespace 90 } // namespace
91 91
92 // static 92 // static
93 bool RenderProcessHost::run_renderer_in_process_ = false; 93 bool RenderProcessHost::run_renderer_in_process_ = false;
94 94
95 // static 95 // static
96 void RenderProcessHost::SetMaxRendererProcessCountForTest(size_t count) { 96 void RenderProcessHost::SetMaxRendererProcessCountForTest(size_t count) {
97 max_renderer_count_override = count; 97 max_renderer_count_override = count;
98 } 98 }
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 242
243 // Now pick a random suitable renderer, if we have any. 243 // Now pick a random suitable renderer, if we have any.
244 if (!suitable_renderers.empty()) { 244 if (!suitable_renderers.empty()) {
245 int suitable_count = static_cast<int>(suitable_renderers.size()); 245 int suitable_count = static_cast<int>(suitable_renderers.size());
246 int random_index = base::RandInt(0, suitable_count - 1); 246 int random_index = base::RandInt(0, suitable_count - 1);
247 return suitable_renderers[random_index]; 247 return suitable_renderers[random_index];
248 } 248 }
249 249
250 return NULL; 250 return NULL;
251 } 251 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698