| 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_DEFAULT_H_ | 5 #ifndef BASE_MESSAGE_PUMP_DEFAULT_H_ |
| 6 #define BASE_MESSAGE_PUMP_DEFAULT_H_ | 6 #define BASE_MESSAGE_PUMP_DEFAULT_H_ |
| 7 | 7 |
| 8 #include "base/message_pump.h" | 8 #include "base/message_pump.h" |
| 9 #include "base/time.h" | 9 #include "base/time.h" |
| 10 #include "base/waitable_event.h" | 10 #include "base/waitable_event.h" |
| 11 | 11 |
| 12 namespace base { | 12 namespace base { |
| 13 | 13 |
| 14 class MessagePumpDefault : public MessagePump { | 14 class MessagePumpDefault : public MessagePump { |
| 15 public: | 15 public: |
| 16 MessagePumpDefault(); | 16 MessagePumpDefault(); |
| 17 ~MessagePumpDefault() {} | 17 ~MessagePumpDefault() {} |
| 18 | 18 |
| 19 // MessagePump methods: | 19 // MessagePump methods: |
| 20 virtual void Run(Delegate* delegate); | 20 virtual void Run(Delegate* delegate); |
| 21 virtual void Quit(); | 21 virtual void Quit(); |
| 22 virtual void ScheduleWork(); | 22 virtual void ScheduleWork(); |
| 23 virtual void ScheduleDelayedWork(const Time& delayed_work_time); | 23 virtual void ScheduleDelayedWork(const base::Time& delayed_work_time); |
| 24 | 24 |
| 25 private: | 25 private: |
| 26 // This flag is set to false when Run should return. | 26 // This flag is set to false when Run should return. |
| 27 bool keep_running_; | 27 bool keep_running_; |
| 28 | 28 |
| 29 // Used to sleep until there is more work to do. | 29 // Used to sleep until there is more work to do. |
| 30 WaitableEvent event_; | 30 WaitableEvent event_; |
| 31 | 31 |
| 32 // The time at which we should call DoDelayedWork. | 32 // The time at which we should call DoDelayedWork. |
| 33 Time delayed_work_time_; | 33 base::Time delayed_work_time_; |
| 34 | 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault); | 35 DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault); |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace base | 38 } // namespace base |
| 39 | 39 |
| 40 #endif // BASE_MESSAGE_PUMP_DEFAULT_H_ | 40 #endif // BASE_MESSAGE_PUMP_DEFAULT_H_ |
| 41 | 41 |
| OLD | NEW |