Chromium Code Reviews| 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 23 matching lines...) Expand all Loading... | |
| 34 // if DoDelayedWork returns true. Upon return |next_delayed_work_time| | 34 // if DoDelayedWork returns true. Upon return |next_delayed_work_time| |
| 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. | 42 // Returns true to indicate that idle work was done. |
| 43 virtual bool DoIdleWork() = 0; | 43 virtual bool DoIdleWork() = 0; |
| 44 | |
| 45 // Called when the pump is about to sleep. The delegate should update the | |
| 46 // timer granularity to the appropriate value for the pending tasks. | |
| 47 virtual void UpdateTimerGranularity() {} | |
|
darin (slow to review)
2014/07/18 04:07:59
why don't you just use DoIdleWork for this? it is
jamesr
2014/07/18 04:45:37
it's also called before not sleeping (i.e. we have
darin (slow to review)
2014/07/18 04:55:54
I don't think that's quite right. In that case, Do
jamesr
2014/07/18 06:18:33
Good points. I agree doing this at the end of DoI
| |
| 44 }; | 48 }; |
| 45 | 49 |
| 46 MessagePump(); | 50 MessagePump(); |
| 47 virtual ~MessagePump(); | 51 virtual ~MessagePump(); |
| 48 | 52 |
| 49 // The Run method is called to enter the message pump's run loop. | 53 // The Run method is called to enter the message pump's run loop. |
| 50 // | 54 // |
| 51 // Within the method, the message pump is responsible for processing native | 55 // Within the method, the message pump is responsible for processing native |
| 52 // messages as well as for giving cycles to the delegate periodically. The | 56 // messages as well as for giving cycles to the delegate periodically. The |
| 53 // message pump should take care to mix delegate callbacks with native | 57 // message pump should take care to mix delegate callbacks with native |
| (...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 122 // used on the thread that called Run. | 126 // used on the thread that called Run. |
| 123 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; | 127 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; |
| 124 | 128 |
| 125 // Sets the timer slack to the specified value. | 129 // Sets the timer slack to the specified value. |
| 126 virtual void SetTimerSlack(TimerSlack timer_slack); | 130 virtual void SetTimerSlack(TimerSlack timer_slack); |
| 127 }; | 131 }; |
| 128 | 132 |
| 129 } // namespace base | 133 } // namespace base |
| 130 | 134 |
| 131 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 135 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
| OLD | NEW |