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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // | 155 // |
156 // The NonNestable variants work similarly except that they promise never to | 156 // The NonNestable variants work similarly except that they promise never to |
157 // dispatch the task from a nested invocation of MessageLoop::Run. Instead, | 157 // dispatch the task from a nested invocation of MessageLoop::Run. Instead, |
158 // such tasks get deferred until the top-most MessageLoop::Run is executing. | 158 // such tasks get deferred until the top-most MessageLoop::Run is executing. |
159 // | 159 // |
160 // The MessageLoop takes ownership of the Task, and deletes it after it has | 160 // The MessageLoop takes ownership of the Task, and deletes it after it has |
161 // been Run(). | 161 // been Run(). |
162 // | 162 // |
163 // NOTE: These methods may be called on any thread. The Task will be invoked | 163 // NOTE: These methods may be called on any thread. The Task will be invoked |
164 // on the thread that executes MessageLoop::Run(). | 164 // on the thread that executes MessageLoop::Run(). |
165 | |
166 void PostTask( | |
167 const tracked_objects::Location& from_here, Task* task); | |
168 | |
169 void PostDelayedTask( | |
170 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); | |
171 | |
172 void PostDelayedTask( | |
173 const tracked_objects::Location& from_here, | |
174 Task* task, | |
175 base::TimeDelta delay); | |
176 | |
177 void PostNonNestableTask( | |
178 const tracked_objects::Location& from_here, Task* task); | |
179 | |
180 void PostNonNestableDelayedTask( | |
181 const tracked_objects::Location& from_here, Task* task, int64 delay_ms); | |
182 | |
183 void PostNonNestableDelayedTask( | |
184 const tracked_objects::Location& from_here, | |
185 Task* task, | |
186 base::TimeDelta delay); | |
187 | |
188 // TODO(ajwong): Remove the functions above once the Task -> Closure migration | |
189 // is complete. | |
190 // | |
191 // There are 2 sets of Post*Task functions, one which takes the older Task* | |
192 // function object representation, and one that takes the newer base::Closure. | |
193 // We have this overload to allow a staged transition between the two systems. | |
194 // Once the transition is done, the functions above should be deleted. | |
195 void PostTask( | 165 void PostTask( |
196 const tracked_objects::Location& from_here, | 166 const tracked_objects::Location& from_here, |
197 const base::Closure& task); | 167 const base::Closure& task); |
198 | 168 |
199 void PostDelayedTask( | 169 void PostDelayedTask( |
200 const tracked_objects::Location& from_here, | 170 const tracked_objects::Location& from_here, |
201 const base::Closure& task, int64 delay_ms); | 171 const base::Closure& task, int64 delay_ms); |
202 | 172 |
203 void PostDelayedTask( | 173 void PostDelayedTask( |
204 const tracked_objects::Location& from_here, | 174 const tracked_objects::Location& from_here, |
(...skipping 485 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 #endif // defined(OS_POSIX) | 660 #endif // defined(OS_POSIX) |
691 }; | 661 }; |
692 | 662 |
693 // Do not add any member variables to MessageLoopForIO! This is important b/c | 663 // Do not add any member variables to MessageLoopForIO! This is important b/c |
694 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 664 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
695 // data that you need should be stored on the MessageLoop's pump_ instance. | 665 // data that you need should be stored on the MessageLoop's pump_ instance. |
696 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 666 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
697 MessageLoopForIO_should_not_have_extra_member_variables); | 667 MessageLoopForIO_should_not_have_extra_member_variables); |
698 | 668 |
699 #endif // BASE_MESSAGE_LOOP_H_ | 669 #endif // BASE_MESSAGE_LOOP_H_ |
OLD | NEW |