OLD | NEW |
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 Loading... |
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 Loading... |
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 |
OLD | NEW |