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 BASE_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_H_ |
6 #define BASE_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <queue> | 9 #include <queue> |
10 #include <string> | 10 #include <string> |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 // | 161 // |
162 // NOTE: These methods may be called on any thread. The Task will be invoked | 162 // NOTE: These methods may be called on any thread. The Task will be invoked |
163 // on the thread that executes MessageLoop::Run(). | 163 // on the thread that executes MessageLoop::Run(). |
164 | 164 |
165 void PostTask( | 165 void PostTask( |
166 const tracked_objects::Location& from_here, Task* task); | 166 const tracked_objects::Location& from_here, Task* task); |
167 | 167 |
168 void PostDelayedTask( | 168 void PostDelayedTask( |
169 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); | 169 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); |
170 | 170 |
| 171 void PostDelayedTask( |
| 172 const tracked_objects::Location& from_here, |
| 173 Task* task, |
| 174 base::TimeDelta delay); |
| 175 |
171 void PostNonNestableTask( | 176 void PostNonNestableTask( |
172 const tracked_objects::Location& from_here, Task* task); | 177 const tracked_objects::Location& from_here, Task* task); |
173 | 178 |
174 void PostNonNestableDelayedTask( | 179 void PostNonNestableDelayedTask( |
175 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); | 180 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); |
176 | 181 |
| 182 void PostNonNestableDelayedTask( |
| 183 const tracked_objects::Location& from_here, |
| 184 Task* task, |
| 185 base::TimeDelta delay); |
| 186 |
177 // TODO(ajwong): Remove the functions above once the Task -> Closure migration | 187 // TODO(ajwong): Remove the functions above once the Task -> Closure migration |
178 // is complete. | 188 // is complete. |
179 // | 189 // |
180 // There are 2 sets of Post*Task functions, one which takes the older Task* | 190 // There are 2 sets of Post*Task functions, one which takes the older Task* |
181 // function object representation, and one that takes the newer base::Closure. | 191 // function object representation, and one that takes the newer base::Closure. |
182 // We have this overload to allow a staged transition between the two systems. | 192 // We have this overload to allow a staged transition between the two systems. |
183 // Once the transition is done, the functions above should be deleted. | 193 // Once the transition is done, the functions above should be deleted. |
184 void PostTask( | 194 void PostTask( |
185 const tracked_objects::Location& from_here, | 195 const tracked_objects::Location& from_here, |
186 const base::Closure& task); | 196 const base::Closure& task); |
187 | 197 |
188 void PostDelayedTask( | 198 void PostDelayedTask( |
189 const tracked_objects::Location& from_here, | 199 const tracked_objects::Location& from_here, |
190 const base::Closure& task, int64 delay_ms); | 200 const base::Closure& task, int64 delay_ms); |
191 | 201 |
| 202 void PostDelayedTask( |
| 203 const tracked_objects::Location& from_here, |
| 204 const base::Closure& task, |
| 205 base::TimeDelta delay); |
| 206 |
192 void PostNonNestableTask( | 207 void PostNonNestableTask( |
193 const tracked_objects::Location& from_here, | 208 const tracked_objects::Location& from_here, |
194 const base::Closure& task); | 209 const base::Closure& task); |
195 | 210 |
196 void PostNonNestableDelayedTask( | 211 void PostNonNestableDelayedTask( |
197 const tracked_objects::Location& from_here, | 212 const tracked_objects::Location& from_here, |
198 const base::Closure& task, int64 delay_ms); | 213 const base::Closure& task, int64 delay_ms); |
199 | 214 |
| 215 void PostNonNestableDelayedTask( |
| 216 const tracked_objects::Location& from_here, |
| 217 const base::Closure& task, |
| 218 base::TimeDelta delay); |
| 219 |
200 // A variant on PostTask that deletes the given object. This is useful | 220 // A variant on PostTask that deletes the given object. This is useful |
201 // if the object needs to live until the next run of the MessageLoop (for | 221 // if the object needs to live until the next run of the MessageLoop (for |
202 // example, deleting a RenderProcessHost from within an IPC callback is not | 222 // example, deleting a RenderProcessHost from within an IPC callback is not |
203 // good). | 223 // good). |
204 // | 224 // |
205 // NOTE: This method may be called on any thread. The object will be deleted | 225 // NOTE: This method may be called on any thread. The object will be deleted |
206 // on the thread that executes MessageLoop::Run(). If this is not the same | 226 // on the thread that executes MessageLoop::Run(). If this is not the same |
207 // as the thread that calls PostDelayedTask(FROM_HERE, ), then T MUST inherit | 227 // as the thread that calls PostDelayedTask(FROM_HERE, ), then T MUST inherit |
208 // from RefCountedThreadSafe<T>! | 228 // from RefCountedThreadSafe<T>! |
209 template <class T> | 229 template <class T> |
(...skipping 446 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
656 #endif // defined(OS_POSIX) | 676 #endif // defined(OS_POSIX) |
657 }; | 677 }; |
658 | 678 |
659 // Do not add any member variables to MessageLoopForIO! This is important b/c | 679 // Do not add any member variables to MessageLoopForIO! This is important b/c |
660 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 680 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
661 // data that you need should be stored on the MessageLoop's pump_ instance. | 681 // data that you need should be stored on the MessageLoop's pump_ instance. |
662 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 682 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
663 MessageLoopForIO_should_not_have_extra_member_variables); | 683 MessageLoopForIO_should_not_have_extra_member_variables); |
664 | 684 |
665 #endif // BASE_MESSAGE_LOOP_H_ | 685 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |