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 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 Type type, | 426 Type type, |
427 MessagePumpFactoryCallback pump_factory); | 427 MessagePumpFactoryCallback pump_factory); |
428 | 428 |
429 // Common private constructor. Other constructors delegate the initialization | 429 // Common private constructor. Other constructors delegate the initialization |
430 // to this constructor. | 430 // to this constructor. |
431 MessageLoop(Type type, MessagePumpFactoryCallback pump_factory); | 431 MessageLoop(Type type, MessagePumpFactoryCallback pump_factory); |
432 | 432 |
433 // Configure various members and bind this message loop to the current thread. | 433 // Configure various members and bind this message loop to the current thread. |
434 void BindToCurrentThread(); | 434 void BindToCurrentThread(); |
435 | 435 |
| 436 // Sets the ThreadTaskRunnerHandle for the current thread to point to the |
| 437 // task runner for this message loop. |
| 438 void SetThreadTaskRunnerHandle(); |
| 439 |
436 // Invokes the actual run loop using the message pump. | 440 // Invokes the actual run loop using the message pump. |
437 void RunHandler(); | 441 void RunHandler(); |
438 | 442 |
439 // Called to process any delayed non-nestable tasks. | 443 // Called to process any delayed non-nestable tasks. |
440 bool ProcessNextDelayedNonNestableTask(); | 444 bool ProcessNextDelayedNonNestableTask(); |
441 | 445 |
442 // Calls RunTask or queues the pending_task on the deferred task list if it | 446 // Calls RunTask or queues the pending_task on the deferred task list if it |
443 // cannot be run right now. Returns true if the task was run. | 447 // cannot be run right now. Returns true if the task was run. |
444 bool DeferOrRunPendingTask(const PendingTask& pending_task); | 448 bool DeferOrRunPendingTask(const PendingTask& pending_task); |
445 | 449 |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
683 | 687 |
684 // Do not add any member variables to MessageLoopForIO! This is important b/c | 688 // Do not add any member variables to MessageLoopForIO! This is important b/c |
685 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra | 689 // MessageLoopForIO is often allocated via MessageLoop(TYPE_IO). Any extra |
686 // data that you need should be stored on the MessageLoop's pump_ instance. | 690 // data that you need should be stored on the MessageLoop's pump_ instance. |
687 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), | 691 COMPILE_ASSERT(sizeof(MessageLoop) == sizeof(MessageLoopForIO), |
688 MessageLoopForIO_should_not_have_extra_member_variables); | 692 MessageLoopForIO_should_not_have_extra_member_variables); |
689 | 693 |
690 } // namespace base | 694 } // namespace base |
691 | 695 |
692 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ | 696 #endif // BASE_MESSAGE_LOOP_MESSAGE_LOOP_H_ |
OLD | NEW |