| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_PUMP_H_ | 5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
| 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
| 7 | 7 |
| 8 #include "base/base_export.h" | 8 #include "base/base_export.h" |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/message_loop/timer_slack.h" | 10 #include "base/message_loop/timer_slack.h" |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 // indicates the time when DoDelayedWork should be called again. If | 35 // indicates the time when DoDelayedWork should be called again. If |
| 36 // |next_delayed_work_time| is null (per Time::is_null), then the queue of | 36 // |next_delayed_work_time| is null (per Time::is_null), then the queue of |
| 37 // future delayed work (timer events) is currently empty, and no additional | 37 // future delayed work (timer events) is currently empty, and no additional |
| 38 // calls to this function need to be scheduled. | 38 // calls to this function need to be scheduled. |
| 39 virtual bool DoDelayedWork(TimeTicks* next_delayed_work_time) = 0; | 39 virtual bool DoDelayedWork(TimeTicks* next_delayed_work_time) = 0; |
| 40 | 40 |
| 41 // Called from within Run just before the message pump goes to sleep. | 41 // Called from within Run just before the message pump goes to sleep. |
| 42 // Returns true to indicate that idle work was done. Returning false means | 42 // Returns true to indicate that idle work was done. Returning false means |
| 43 // the pump will now wait. | 43 // the pump will now wait. |
| 44 virtual bool DoIdleWork() = 0; | 44 virtual bool DoIdleWork() = 0; |
| 45 | |
| 46 // Returns the delay for the newly added task. | |
| 47 virtual TimeTicks GetNewlyAddedTaskDelay() = 0; | |
| 48 }; | 45 }; |
| 49 | 46 |
| 50 MessagePump(); | 47 MessagePump(); |
| 51 virtual ~MessagePump(); | 48 virtual ~MessagePump(); |
| 52 | 49 |
| 53 // The Run method is called to enter the message pump's run loop. | 50 // The Run method is called to enter the message pump's run loop. |
| 54 // | 51 // |
| 55 // Within the method, the message pump is responsible for processing native | 52 // Within the method, the message pump is responsible for processing native |
| 56 // messages as well as for giving cycles to the delegate periodically. The | 53 // messages as well as for giving cycles to the delegate periodically. The |
| 57 // message pump should take care to mix delegate callbacks with native | 54 // message pump should take care to mix delegate callbacks with native |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 126 // used on the thread that called Run. | 123 // used on the thread that called Run. |
| 127 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; | 124 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; |
| 128 | 125 |
| 129 // Sets the timer slack to the specified value. | 126 // Sets the timer slack to the specified value. |
| 130 virtual void SetTimerSlack(TimerSlack timer_slack); | 127 virtual void SetTimerSlack(TimerSlack timer_slack); |
| 131 }; | 128 }; |
| 132 | 129 |
| 133 } // namespace base | 130 } // namespace base |
| 134 | 131 |
| 135 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 132 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
| OLD | NEW |