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 21 matching lines...) Expand all Loading... |
32 // message pump would otherwise sleep waiting for more work. Returns true | 32 // message pump would otherwise sleep waiting for more work. Returns true |
33 // to indicate that delayed work was done. DoIdleWork will not be called | 33 // to indicate that delayed work was done. DoIdleWork will not be called |
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. Returning false means |
| 43 // the pump will now wait. |
43 virtual bool DoIdleWork() = 0; | 44 virtual bool DoIdleWork() = 0; |
44 }; | 45 }; |
45 | 46 |
46 MessagePump(); | 47 MessagePump(); |
47 virtual ~MessagePump(); | 48 virtual ~MessagePump(); |
48 | 49 |
49 // 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. |
50 // | 51 // |
51 // Within the method, the message pump is responsible for processing native | 52 // Within the method, the message pump is responsible for processing native |
52 // 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 |
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 // used on the thread that called Run. | 123 // used on the thread that called Run. |
123 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; | 124 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) = 0; |
124 | 125 |
125 // Sets the timer slack to the specified value. | 126 // Sets the timer slack to the specified value. |
126 virtual void SetTimerSlack(TimerSlack timer_slack); | 127 virtual void SetTimerSlack(TimerSlack timer_slack); |
127 }; | 128 }; |
128 | 129 |
129 } // namespace base | 130 } // namespace base |
130 | 131 |
131 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ | 132 #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_H_ |
OLD | NEW |