| OLD | NEW |
| 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_PUMP_H_ | 5 #ifndef BASE_MESSAGE_PUMP_H_ |
| 6 #define BASE_MESSAGE_PUMP_H_ | 6 #define BASE_MESSAGE_PUMP_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include "base/ref_counted.h" | 9 #include "base/ref_counted.h" |
| 10 | 10 |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 // |next_delayed_work_time| is null (per Time::is_null), then the queue of | 33 // |next_delayed_work_time| is null (per Time::is_null), then the queue of |
| 34 // future delayed work (timer events) is currently empty, and no additional | 34 // future delayed work (timer events) is currently empty, and no additional |
| 35 // calls to this function need to be scheduled. | 35 // calls to this function need to be scheduled. |
| 36 virtual bool DoDelayedWork(Time* next_delayed_work_time) = 0; | 36 virtual bool DoDelayedWork(Time* next_delayed_work_time) = 0; |
| 37 | 37 |
| 38 // Called from within Run just before the message pump goes to sleep. | 38 // Called from within Run just before the message pump goes to sleep. |
| 39 // Returns true to indicate that idle work was done. | 39 // Returns true to indicate that idle work was done. |
| 40 virtual bool DoIdleWork() = 0; | 40 virtual bool DoIdleWork() = 0; |
| 41 }; | 41 }; |
| 42 | 42 |
| 43 virtual ~MessagePump() {} | 43 MessagePump(); |
| 44 virtual ~MessagePump(); |
| 44 | 45 |
| 45 // The Run method is called to enter the message pump's run loop. | 46 // The Run method is called to enter the message pump's run loop. |
| 46 // | 47 // |
| 47 // Within the method, the message pump is responsible for processing native | 48 // Within the method, the message pump is responsible for processing native |
| 48 // messages as well as for giving cycles to the delegate periodically. The | 49 // messages as well as for giving cycles to the delegate periodically. The |
| 49 // message pump should take care to mix delegate callbacks with native | 50 // message pump should take care to mix delegate callbacks with native |
| 50 // message processing so neither type of event starves the other of cycles. | 51 // message processing so neither type of event starves the other of cycles. |
| 51 // | 52 // |
| 52 // The anatomy of a typical run loop: | 53 // The anatomy of a typical run loop: |
| 53 // | 54 // |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 115 |
| 115 // Schedule a DoDelayedWork callback to happen at the specified time, | 116 // Schedule a DoDelayedWork callback to happen at the specified time, |
| 116 // cancelling any pending DoDelayedWork callback. This method may only be | 117 // cancelling any pending DoDelayedWork callback. This method may only be |
| 117 // used on the thread that called Run. | 118 // used on the thread that called Run. |
| 118 virtual void ScheduleDelayedWork(const Time& delayed_work_time) = 0; | 119 virtual void ScheduleDelayedWork(const Time& delayed_work_time) = 0; |
| 119 }; | 120 }; |
| 120 | 121 |
| 121 } // namespace base | 122 } // namespace base |
| 122 | 123 |
| 123 #endif // BASE_MESSAGE_PUMP_H_ | 124 #endif // BASE_MESSAGE_PUMP_H_ |
| OLD | NEW |