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/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
10 #include "base/threading/thread_restrictions.h" | 10 #include "base/threading/thread_restrictions.h" |
11 | 11 |
12 namespace { | 12 namespace { |
13 | 13 |
14 // Friendly names for the well-known threads. | 14 // Friendly names for the well-known threads. |
15 static const char* browser_thread_names[BrowserThread::ID_COUNT] = { | 15 static const char* browser_thread_names[content::BrowserThread::ID_COUNT] = { |
16 "", // UI (name assembled in browser_main.cc). | 16 "", // UI (name assembled in browser_main.cc). |
17 "Chrome_DBThread", // DB | 17 "Chrome_DBThread", // DB |
18 "Chrome_WebKitThread", // WEBKIT | 18 "Chrome_WebKitThread", // WEBKIT |
19 "Chrome_FileThread", // FILE | 19 "Chrome_FileThread", // FILE |
20 "Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER | 20 "Chrome_ProcessLauncherThread", // PROCESS_LAUNCHER |
21 "Chrome_CacheThread", // CACHE | 21 "Chrome_CacheThread", // CACHE |
22 "Chrome_IOThread", // IO | 22 "Chrome_IOThread", // IO |
23 #if defined(OS_CHROMEOS) | 23 #if defined(OS_CHROMEOS) |
24 "Chrome_WebSocketproxyThread", // WEB_SOCKET_PROXY | 24 "Chrome_WebSocketproxyThread", // WEB_SOCKET_PROXY |
25 #endif | 25 #endif |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
123 message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); | 123 message_loop->PostNonNestableDelayedTask(from_here, task, delay_ms); |
124 } | 124 } |
125 } | 125 } |
126 | 126 |
127 if (!guaranteed_to_outlive_target_thread) | 127 if (!guaranteed_to_outlive_target_thread) |
128 lock_.Release(); | 128 lock_.Release(); |
129 | 129 |
130 return !!message_loop; | 130 return !!message_loop; |
131 } | 131 } |
132 | 132 |
133 } // namespace content | |
134 | |
135 using content::BrowserThreadImpl; | |
136 | |
137 // TODO(joi): Remove | 133 // TODO(joi): Remove |
138 DeprecatedBrowserThread::DeprecatedBrowserThread(BrowserThread::ID identifier) | 134 DeprecatedBrowserThread::DeprecatedBrowserThread(BrowserThread::ID identifier) |
139 : BrowserThread(identifier) { | 135 : BrowserThread(identifier) { |
140 } | 136 } |
141 DeprecatedBrowserThread::DeprecatedBrowserThread(BrowserThread::ID identifier, | 137 DeprecatedBrowserThread::DeprecatedBrowserThread(BrowserThread::ID identifier, |
142 MessageLoop* message_loop) | 138 MessageLoop* message_loop) |
143 : BrowserThread(identifier, message_loop) { | 139 : BrowserThread(identifier, message_loop) { |
144 } | 140 } |
145 DeprecatedBrowserThread::~DeprecatedBrowserThread() { | 141 DeprecatedBrowserThread::~DeprecatedBrowserThread() { |
146 } | 142 } |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 } | 376 } |
381 | 377 |
382 // static | 378 // static |
383 scoped_refptr<base::MessageLoopProxy> | 379 scoped_refptr<base::MessageLoopProxy> |
384 BrowserThread::GetMessageLoopProxyForThread( | 380 BrowserThread::GetMessageLoopProxyForThread( |
385 ID identifier) { | 381 ID identifier) { |
386 scoped_refptr<base::MessageLoopProxy> proxy( | 382 scoped_refptr<base::MessageLoopProxy> proxy( |
387 new BrowserThreadMessageLoopProxy(identifier)); | 383 new BrowserThreadMessageLoopProxy(identifier)); |
388 return proxy; | 384 return proxy; |
389 } | 385 } |
| 386 |
| 387 } // namespace content |
OLD | NEW |