| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 IOS_WEB_PUBLIC_WEB_THREAD_H_ | 5 #ifndef IOS_WEB_PUBLIC_WEB_THREAD_H_ |
| 6 #define IOS_WEB_PUBLIC_WEB_THREAD_H_ | 6 #define IOS_WEB_PUBLIC_WEB_THREAD_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <utility> | 9 #include <utility> |
| 10 | 10 |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 // identifier. | 94 // identifier. |
| 95 ID_COUNT | 95 ID_COUNT |
| 96 }; | 96 }; |
| 97 | 97 |
| 98 // These are the same methods as in message_loop.h, but are guaranteed to | 98 // These are the same methods as in message_loop.h, but are guaranteed to |
| 99 // either get posted to the MessageLoop if it's still alive, or be deleted | 99 // either get posted to the MessageLoop if it's still alive, or be deleted |
| 100 // otherwise. | 100 // otherwise. |
| 101 // They return true iff the thread existed and the task was posted. | 101 // They return true iff the thread existed and the task was posted. |
| 102 static bool PostTask(ID identifier, | 102 static bool PostTask(ID identifier, |
| 103 const tracked_objects::Location& from_here, | 103 const tracked_objects::Location& from_here, |
| 104 const base::Closure& task); | 104 base::Closure task); |
| 105 static bool PostDelayedTask(ID identifier, | 105 static bool PostDelayedTask(ID identifier, |
| 106 const tracked_objects::Location& from_here, | 106 const tracked_objects::Location& from_here, |
| 107 const base::Closure& task, | 107 base::Closure task, |
| 108 base::TimeDelta delay); | 108 base::TimeDelta delay); |
| 109 static bool PostNonNestableTask(ID identifier, | 109 static bool PostNonNestableTask(ID identifier, |
| 110 const tracked_objects::Location& from_here, | 110 const tracked_objects::Location& from_here, |
| 111 const base::Closure& task); | 111 base::Closure task); |
| 112 static bool PostNonNestableDelayedTask( | 112 static bool PostNonNestableDelayedTask( |
| 113 ID identifier, | 113 ID identifier, |
| 114 const tracked_objects::Location& from_here, | 114 const tracked_objects::Location& from_here, |
| 115 const base::Closure& task, | 115 base::Closure task, |
| 116 base::TimeDelta delay); | 116 base::TimeDelta delay); |
| 117 | 117 |
| 118 static bool PostTaskAndReply(ID identifier, | 118 static bool PostTaskAndReply(ID identifier, |
| 119 const tracked_objects::Location& from_here, | 119 const tracked_objects::Location& from_here, |
| 120 base::Closure task, | 120 base::Closure task, |
| 121 base::Closure reply); | 121 base::Closure reply); |
| 122 | 122 |
| 123 template <typename ReturnType, typename ReplyArgType> | 123 template <typename ReturnType, typename ReplyArgType> |
| 124 static bool PostTaskAndReplyWithResult( | 124 static bool PostTaskAndReplyWithResult( |
| 125 ID identifier, | 125 ID identifier, |
| (...skipping 28 matching lines...) Expand all Loading... |
| 154 // something slow and noncritical that doesn't need to block shutdown), | 154 // something slow and noncritical that doesn't need to block shutdown), |
| 155 // or you want to manually provide a sequence token (which saves a map | 155 // or you want to manually provide a sequence token (which saves a map |
| 156 // lookup and is guaranteed unique without you having to come up with a | 156 // lookup and is guaranteed unique without you having to come up with a |
| 157 // unique string), you can access the sequenced worker pool directly via | 157 // unique string), you can access the sequenced worker pool directly via |
| 158 // GetBlockingPool(). | 158 // GetBlockingPool(). |
| 159 // | 159 // |
| 160 // If you need to PostTaskAndReplyWithResult, use | 160 // If you need to PostTaskAndReplyWithResult, use |
| 161 // base::PostTaskAndReplyWithResult() with GetBlockingPool() as the task | 161 // base::PostTaskAndReplyWithResult() with GetBlockingPool() as the task |
| 162 // runner. | 162 // runner. |
| 163 static bool PostBlockingPoolTask(const tracked_objects::Location& from_here, | 163 static bool PostBlockingPoolTask(const tracked_objects::Location& from_here, |
| 164 const base::Closure& task); | 164 base::Closure task); |
| 165 static bool PostBlockingPoolTaskAndReply( | 165 static bool PostBlockingPoolTaskAndReply( |
| 166 const tracked_objects::Location& from_here, | 166 const tracked_objects::Location& from_here, |
| 167 base::Closure task, | 167 base::Closure task, |
| 168 base::Closure reply); | 168 base::Closure reply); |
| 169 static bool PostBlockingPoolSequencedTask( | 169 static bool PostBlockingPoolSequencedTask( |
| 170 const std::string& sequence_token_name, | 170 const std::string& sequence_token_name, |
| 171 const tracked_objects::Location& from_here, | 171 const tracked_objects::Location& from_here, |
| 172 const base::Closure& task); | 172 base::Closure task); |
| 173 | 173 |
| 174 // Returns the thread pool used for blocking file I/O. Use this object to | 174 // Returns the thread pool used for blocking file I/O. Use this object to |
| 175 // perform random blocking operations such as file writes. | 175 // perform random blocking operations such as file writes. |
| 176 static base::SequencedWorkerPool* GetBlockingPool() WARN_UNUSED_RESULT; | 176 static base::SequencedWorkerPool* GetBlockingPool() WARN_UNUSED_RESULT; |
| 177 | 177 |
| 178 // Callable on any thread. Returns whether the given well-known thread is | 178 // Callable on any thread. Returns whether the given well-known thread is |
| 179 // initialized. | 179 // initialized. |
| 180 static bool IsThreadInitialized(ID identifier) WARN_UNUSED_RESULT; | 180 static bool IsThreadInitialized(ID identifier) WARN_UNUSED_RESULT; |
| 181 | 181 |
| 182 // Callable on any thread. Returns whether execution is currently on the | 182 // Callable on any thread. Returns whether execution is currently on the |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 260 private: | 260 private: |
| 261 friend class WebThreadImpl; | 261 friend class WebThreadImpl; |
| 262 | 262 |
| 263 WebThread() {} | 263 WebThread() {} |
| 264 DISALLOW_COPY_AND_ASSIGN(WebThread); | 264 DISALLOW_COPY_AND_ASSIGN(WebThread); |
| 265 }; | 265 }; |
| 266 | 266 |
| 267 } // namespace web | 267 } // namespace web |
| 268 | 268 |
| 269 #endif // IOS_WEB_PUBLIC_WEB_THREAD_H_ | 269 #endif // IOS_WEB_PUBLIC_WEB_THREAD_H_ |
| OLD | NEW |