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

Side by Side Diff: content/browser/browser_thread_impl.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/browser/browser_child_process_host.cc ('k') | content/browser/browsing_instance.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/browser/browser_thread_impl.h" 5 #include "content/browser/browser_thread_impl.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/lazy_instance.h" 8 #include "base/lazy_instance.h"
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/message_loop_proxy.h" 10 #include "base/message_loop_proxy.h"
(...skipping 18 matching lines...) Expand all
29 } // namespace 29 } // namespace
30 30
31 namespace content { 31 namespace content {
32 32
33 namespace { 33 namespace {
34 34
35 // This lock protects |g_browser_threads|. Do not read or modify that array 35 // This lock protects |g_browser_threads|. Do not read or modify that array
36 // without holding this lock. Do not block while holding this lock. 36 // without holding this lock. Do not block while holding this lock.
37 base::LazyInstance<base::Lock, 37 base::LazyInstance<base::Lock,
38 base::LeakyLazyInstanceTraits<base::Lock> > 38 base::LeakyLazyInstanceTraits<base::Lock> >
39 g_lock(base::LINKER_INITIALIZED); 39 g_lock = LAZY_INSTANCE_INITIALIZER;
40 40
41 41
42 // An array of the BrowserThread objects. This array is protected by |g_lock|. 42 // An array of the BrowserThread objects. This array is protected by |g_lock|.
43 // The threads are not owned by this array. Typically, the threads are owned 43 // The threads are not owned by this array. Typically, the threads are owned
44 // on the UI thread by the g_browser_process object. BrowserThreads remove 44 // on the UI thread by the g_browser_process object. BrowserThreads remove
45 // themselves from this array upon destruction. 45 // themselves from this array upon destruction.
46 BrowserThread* g_browser_threads[BrowserThread::ID_COUNT]; 46 BrowserThread* g_browser_threads[BrowserThread::ID_COUNT];
47 47
48 } // namespace 48 } // namespace
49 49
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 // static 387 // static
388 scoped_refptr<base::MessageLoopProxy> 388 scoped_refptr<base::MessageLoopProxy>
389 BrowserThread::GetMessageLoopProxyForThread( 389 BrowserThread::GetMessageLoopProxyForThread(
390 ID identifier) { 390 ID identifier) {
391 scoped_refptr<base::MessageLoopProxy> proxy( 391 scoped_refptr<base::MessageLoopProxy> proxy(
392 new BrowserThreadMessageLoopProxy(identifier)); 392 new BrowserThreadMessageLoopProxy(identifier));
393 return proxy; 393 return proxy;
394 } 394 }
395 395
396 } // namespace content 396 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/browser_child_process_host.cc ('k') | content/browser/browsing_instance.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698