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 #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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
11 #include "base/message_loop_proxy.h" | 11 #include "base/message_loop_proxy.h" |
12 #include "base/task.h" | 12 #include "base/task.h" |
13 #include "base/tracked_objects.h" | 13 #include "base/tracked_objects.h" |
14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
15 #include "content/public/browser/browser_thread_delegate.h" | 15 #include "content/public/browser/browser_thread_delegate.h" |
16 | 16 |
17 #if defined(UNIT_TEST) | 17 #if defined(UNIT_TEST) |
18 #include "base/logging.h" | 18 #include "base/logging.h" |
19 #endif // UNIT_TEST | 19 #endif // UNIT_TEST |
20 | 20 |
21 class MessageLoop; | 21 class MessageLoop; |
22 | 22 |
23 namespace base { | 23 namespace base { |
24 class SequencedWorkerPool; | |
24 class Thread; | 25 class Thread; |
25 } | 26 } |
26 | 27 |
27 namespace content { | 28 namespace content { |
28 | 29 |
29 class BrowserThreadImpl; | 30 class BrowserThreadImpl; |
30 | 31 |
31 /////////////////////////////////////////////////////////////////////////////// | 32 /////////////////////////////////////////////////////////////////////////////// |
32 // BrowserThread | 33 // BrowserThread |
33 // | 34 // |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
150 } | 151 } |
151 | 152 |
152 template <class T> | 153 template <class T> |
153 static bool ReleaseSoon(ID identifier, | 154 static bool ReleaseSoon(ID identifier, |
154 const tracked_objects::Location& from_here, | 155 const tracked_objects::Location& from_here, |
155 const T* object) { | 156 const T* object) { |
156 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( | 157 return GetMessageLoopProxyForThread(identifier)->ReleaseSoon( |
157 from_here, object); | 158 from_here, object); |
158 } | 159 } |
159 | 160 |
161 // Returns the thread pool used for blocking file I/O. Use this object to | |
162 // perform random blocking operations such as file writes or querying the | |
163 // Windows registry. | |
164 static base::SequencedWorkerPool* GetBlockingPool(); | |
jam
2012/01/03 19:48:17
does this getter really belong on BrowserThread? i
| |
165 | |
160 // Callable on any thread. Returns whether the given ID corresponds to a well | 166 // Callable on any thread. Returns whether the given ID corresponds to a well |
161 // known thread. | 167 // known thread. |
162 static bool IsWellKnownThread(ID identifier); | 168 static bool IsWellKnownThread(ID identifier); |
163 | 169 |
164 // Callable on any thread. Returns whether you're currently on a particular | 170 // Callable on any thread. Returns whether you're currently on a particular |
165 // thread. | 171 // thread. |
166 static bool CurrentlyOn(ID identifier); | 172 static bool CurrentlyOn(ID identifier); |
167 | 173 |
168 // Callable on any thread. Returns whether the threads message loop is valid. | 174 // Callable on any thread. Returns whether the threads message loop is valid. |
169 // If this returns false it means the thread is in the process of shutting | 175 // If this returns false it means the thread is in the process of shutting |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
244 private: | 250 private: |
245 friend class BrowserThreadImpl; | 251 friend class BrowserThreadImpl; |
246 | 252 |
247 BrowserThread() {} | 253 BrowserThread() {} |
248 DISALLOW_COPY_AND_ASSIGN(BrowserThread); | 254 DISALLOW_COPY_AND_ASSIGN(BrowserThread); |
249 }; | 255 }; |
250 | 256 |
251 } // namespace content | 257 } // namespace content |
252 | 258 |
253 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 259 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
OLD | NEW |