OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_MESSAGE_LOOP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 | 235 |
236 // Deprecated: use RunLoop instead. | 236 // Deprecated: use RunLoop instead. |
237 // Run the message loop. | 237 // Run the message loop. |
238 void Run(); | 238 void Run(); |
239 | 239 |
240 // Deprecated: use RunLoop instead. | 240 // Deprecated: use RunLoop instead. |
241 // Process all pending tasks, windows messages, etc., but don't wait/sleep. | 241 // Process all pending tasks, windows messages, etc., but don't wait/sleep. |
242 // Return as soon as all items that can be run are taken care of. | 242 // Return as soon as all items that can be run are taken care of. |
243 void RunUntilIdle(); | 243 void RunUntilIdle(); |
244 | 244 |
245 // TODO(jbates) remove this. crbug.com/131220. See QuitWhenIdle(). | |
246 void Quit() { QuitWhenIdle(); } | |
247 | |
248 // Deprecated: use RunLoop instead. | 245 // Deprecated: use RunLoop instead. |
249 // | 246 // |
250 // Signals the Run method to return when it becomes idle. It will continue to | 247 // Signals the Run method to return when it becomes idle. It will continue to |
251 // process pending messages and future messages as long as they are enqueued. | 248 // process pending messages and future messages as long as they are enqueued. |
252 // Warning: if the MessageLoop remains busy, it may never quit. Only use this | 249 // Warning: if the MessageLoop remains busy, it may never quit. Only use this |
253 // Quit method when looping procedures (such as web pages) have been shut | 250 // Quit method when looping procedures (such as web pages) have been shut |
254 // down. | 251 // down. |
255 // | 252 // |
256 // This method may only be called on the same thread that called Run, and Run | 253 // This method may only be called on the same thread that called Run, and Run |
257 // must still be on the call stack. | 254 // must still be on the call stack. |
258 // | 255 // |
259 // Use QuitClosure variants if you need to Quit another thread's MessageLoop, | 256 // Use QuitClosure variants if you need to Quit another thread's MessageLoop, |
260 // but note that doing so is fairly dangerous if the target thread makes | 257 // but note that doing so is fairly dangerous if the target thread makes |
261 // nested calls to MessageLoop::Run. The problem being that you won't know | 258 // nested calls to MessageLoop::Run. The problem being that you won't know |
262 // which nested run loop you are quitting, so be careful! | 259 // which nested run loop you are quitting, so be careful! |
263 void QuitWhenIdle(); | 260 void QuitWhenIdle(); |
264 | 261 |
265 // Deprecated: use RunLoop instead. | 262 // Deprecated: use RunLoop instead. |
266 // | 263 // |
267 // This method is a variant of Quit, that does not wait for pending messages | 264 // This method is a variant of Quit, that does not wait for pending messages |
268 // to be processed before returning from Run. | 265 // to be processed before returning from Run. |
269 void QuitNow(); | 266 void QuitNow(); |
270 | 267 |
271 // TODO(jbates) remove this. crbug.com/131220. See QuitWhenIdleClosure(). | |
272 static Closure QuitClosure() { return QuitWhenIdleClosure(); } | |
273 | |
274 // Deprecated: use RunLoop instead. | 268 // Deprecated: use RunLoop instead. |
275 // Construct a Closure that will call QuitWhenIdle(). Useful to schedule an | 269 // Construct a Closure that will call QuitWhenIdle(). Useful to schedule an |
276 // arbitrary MessageLoop to QuitWhenIdle. | 270 // arbitrary MessageLoop to QuitWhenIdle. |
277 static Closure QuitWhenIdleClosure(); | 271 static Closure QuitWhenIdleClosure(); |
278 | 272 |
279 // Set the timer slack for this message loop. | 273 // Set the timer slack for this message loop. |
280 void SetTimerSlack(TimerSlack timer_slack) { | 274 void SetTimerSlack(TimerSlack timer_slack) { |
281 pump_->SetTimerSlack(timer_slack); | 275 pump_->SetTimerSlack(timer_slack); |
282 } | 276 } |
283 | 277 |
(...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
687 | 681 |
688 // Do not add any member variables to MessageLoopForIO! This is important b/c | 682 // Do not add any member variables to MessageLoopForIO! This is important b/c |
689 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 683 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
690 // data that you need should be stored on the MessageLoop's pump_ instance. | 684 // data that you need should be stored on the MessageLoop's pump_ instance. |
691 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 685 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
692 MessageLoopForIO_should_not_have_extra_member_variables); | 686 MessageLoopForIO_should_not_have_extra_member_variables); |
693 | 687 |
694 } // namespace base | 688 } // namespace base |
695 | 689 |
696 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 690 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |