OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 5 #ifndef CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 6 #define CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/callback.h" | 11 #include "base/callback.h" |
12 #include "base/location.h" | 12 #include "base/location.h" |
13 #include "base/message_loop_proxy.h" | 13 #include "base/message_loop_proxy.h" |
14 #include "base/task_runner_util.h" | 14 #include "base/task_runner_util.h" |
15 #include "base/time.h" | 15 #include "base/time.h" |
16 #include "content/common/content_export.h" | 16 #include "content/common/content_export.h" |
17 | 17 |
18 #if defined(UNIT_TEST) | 18 #if defined(UNIT_TEST) |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #endif // UNIT_TEST | 20 #endif // UNIT_TEST |
21 | 21 |
| 22 namespace base { |
22 class MessageLoop; | 23 class MessageLoop; |
23 | |
24 namespace base { | |
25 class SequencedWorkerPool; | 24 class SequencedWorkerPool; |
26 class Thread; | 25 class Thread; |
27 } | 26 } |
28 | 27 |
29 namespace content { | 28 namespace content { |
30 | 29 |
31 class BrowserThreadDelegate; | 30 class BrowserThreadDelegate; |
32 class BrowserThreadImpl; | 31 class BrowserThreadImpl; |
33 | 32 |
34 /////////////////////////////////////////////////////////////////////////////// | 33 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 ID identifier); | 208 ID identifier); |
210 | 209 |
211 // Returns a pointer to the thread's message loop, which will become | 210 // Returns a pointer to the thread's message loop, which will become |
212 // invalid during shutdown, so you probably shouldn't hold onto it. | 211 // invalid during shutdown, so you probably shouldn't hold onto it. |
213 // | 212 // |
214 // This must not be called before the thread is started, or after | 213 // This must not be called before the thread is started, or after |
215 // the thread is stopped, or it will DCHECK. | 214 // the thread is stopped, or it will DCHECK. |
216 // | 215 // |
217 // Ownership remains with the BrowserThread implementation, so you | 216 // Ownership remains with the BrowserThread implementation, so you |
218 // must not delete the pointer. | 217 // must not delete the pointer. |
219 static MessageLoop* UnsafeGetMessageLoopForThread(ID identifier); | 218 static base::MessageLoop* UnsafeGetMessageLoopForThread(ID identifier); |
220 | 219 |
221 // Sets the delegate for the specified BrowserThread. | 220 // Sets the delegate for the specified BrowserThread. |
222 // | 221 // |
223 // Only one delegate may be registered at a time. Delegates may be | 222 // Only one delegate may be registered at a time. Delegates may be |
224 // unregistered by providing a NULL pointer. | 223 // unregistered by providing a NULL pointer. |
225 // | 224 // |
226 // If the caller unregisters a delegate before CleanUp has been | 225 // If the caller unregisters a delegate before CleanUp has been |
227 // called, it must perform its own locking to ensure the delegate is | 226 // called, it must perform its own locking to ensure the delegate is |
228 // not deleted while unregistering. | 227 // not deleted while unregistering. |
229 static void SetDelegate(ID identifier, BrowserThreadDelegate* delegate); | 228 static void SetDelegate(ID identifier, BrowserThreadDelegate* delegate); |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 private: | 272 private: |
274 friend class BrowserThreadImpl; | 273 friend class BrowserThreadImpl; |
275 | 274 |
276 BrowserThread() {} | 275 BrowserThread() {} |
277 DISALLOW_COPY_AND_ASSIGN(BrowserThread); | 276 DISALLOW_COPY_AND_ASSIGN(BrowserThread); |
278 }; | 277 }; |
279 | 278 |
280 } // namespace content | 279 } // namespace content |
281 | 280 |
282 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 281 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
OLD | NEW |