| 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" |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 178 const base::Closure& task, | 178 const base::Closure& task, |
| 179 const base::Closure& reply); | 179 const base::Closure& reply); |
| 180 static bool PostBlockingPoolSequencedTask( | 180 static bool PostBlockingPoolSequencedTask( |
| 181 const std::string& sequence_token_name, | 181 const std::string& sequence_token_name, |
| 182 const tracked_objects::Location& from_here, | 182 const tracked_objects::Location& from_here, |
| 183 const base::Closure& task); | 183 const base::Closure& task); |
| 184 | 184 |
| 185 // Returns the thread pool used for blocking file I/O. Use this object to | 185 // Returns the thread pool used for blocking file I/O. Use this object to |
| 186 // perform random blocking operations such as file writes or querying the | 186 // perform random blocking operations such as file writes or querying the |
| 187 // Windows registry. | 187 // Windows registry. |
| 188 static base::SequencedWorkerPool* GetBlockingPool(); | 188 static base::SequencedWorkerPool* GetBlockingPool() WARN_UNUSED_RESULT; |
| 189 | 189 |
| 190 // Callable on any thread. Returns whether the given well-known thread is | 190 // Callable on any thread. Returns whether the given well-known thread is |
| 191 // initialized. | 191 // initialized. |
| 192 static bool IsThreadInitialized(ID identifier); | 192 static bool IsThreadInitialized(ID identifier) WARN_UNUSED_RESULT; |
| 193 | 193 |
| 194 // Callable on any thread. Returns whether you're currently on a particular | 194 // Callable on any thread. Returns whether you're currently on a particular |
| 195 // thread. To DCHECK this, use the DCHECK_CURRENTLY_ON() macro above. | 195 // thread. To DCHECK this, use the DCHECK_CURRENTLY_ON() macro above. |
| 196 static bool CurrentlyOn(ID identifier); | 196 static bool CurrentlyOn(ID identifier) WARN_UNUSED_RESULT; |
| 197 | 197 |
| 198 // Callable on any thread. Returns whether the threads message loop is valid. | 198 // Callable on any thread. Returns whether the threads message loop is valid. |
| 199 // If this returns false it means the thread is in the process of shutting | 199 // If this returns false it means the thread is in the process of shutting |
| 200 // down. | 200 // down. |
| 201 static bool IsMessageLoopValid(ID identifier); | 201 static bool IsMessageLoopValid(ID identifier) WARN_UNUSED_RESULT; |
| 202 | 202 |
| 203 // If the current message loop is one of the known threads, returns true and | 203 // If the current message loop is one of the known threads, returns true and |
| 204 // sets identifier to its ID. Otherwise returns false. | 204 // sets identifier to its ID. Otherwise returns false. |
| 205 static bool GetCurrentThreadIdentifier(ID* identifier); | 205 static bool GetCurrentThreadIdentifier(ID* identifier) WARN_UNUSED_RESULT; |
| 206 | 206 |
| 207 // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime | 207 // Callers can hold on to a refcounted MessageLoopProxy beyond the lifetime |
| 208 // of the thread. | 208 // of the thread. |
| 209 static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread( | 209 static scoped_refptr<base::MessageLoopProxy> GetMessageLoopProxyForThread( |
| 210 ID identifier); | 210 ID identifier); |
| 211 | 211 |
| 212 // Returns a pointer to the thread's message loop, which will become | 212 // Returns a pointer to the thread's message loop, which will become |
| 213 // invalid during shutdown, so you probably shouldn't hold onto it. | 213 // invalid during shutdown, so you probably shouldn't hold onto it. |
| 214 // | 214 // |
| 215 // This must not be called before the thread is started, or after | 215 // This must not be called before the thread is started, or after |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 276 private: | 276 private: |
| 277 friend class BrowserThreadImpl; | 277 friend class BrowserThreadImpl; |
| 278 | 278 |
| 279 BrowserThread() {} | 279 BrowserThread() {} |
| 280 DISALLOW_COPY_AND_ASSIGN(BrowserThread); | 280 DISALLOW_COPY_AND_ASSIGN(BrowserThread); |
| 281 }; | 281 }; |
| 282 | 282 |
| 283 } // namespace content | 283 } // namespace content |
| 284 | 284 |
| 285 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ | 285 #endif // CONTENT_PUBLIC_BROWSER_BROWSER_THREAD_H_ |
| OLD | NEW |