[email protected] | f2ebbf06 | 2012-04-06 03:14:30 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
5 | #ifndef BASE_MESSAGE_PUMP_DEFAULT_H_ | ||||
6 | #define BASE_MESSAGE_PUMP_DEFAULT_H_ | ||||
7 | |||||
8 | #include "base/message_pump.h" | ||||
9 | #include "base/time.h" | ||||
[email protected] | 44f9c95 | 2011-01-02 06:05:39 | [diff] [blame] | 10 | #include "base/synchronization/waitable_event.h" |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 11 | |
12 | namespace base { | ||||
13 | |||||
14 | class MessagePumpDefault : public MessagePump { | ||||
15 | public: | ||||
16 | MessagePumpDefault(); | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 17 | |
18 | // MessagePump methods: | ||||
[email protected] | b171946 | 2011-11-16 00:08:08 | [diff] [blame] | 19 | virtual void Run(Delegate* delegate) OVERRIDE; |
20 | virtual void Quit() OVERRIDE; | ||||
21 | virtual void ScheduleWork() OVERRIDE; | ||||
22 | virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE; | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 23 | |
[email protected] | f2ebbf06 | 2012-04-06 03:14:30 | [diff] [blame] | 24 | protected: |
25 | virtual ~MessagePumpDefault() {} | ||||
26 | |||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 27 | private: |
28 | // This flag is set to false when Run should return. | ||||
29 | bool keep_running_; | ||||
30 | |||||
31 | // Used to sleep until there is more work to do. | ||||
32 | WaitableEvent event_; | ||||
33 | |||||
34 | // The time at which we should call DoDelayedWork. | ||||
[email protected] | 7e7fab4 | 2010-11-06 22:23:29 | [diff] [blame] | 35 | TimeTicks delayed_work_time_; |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 36 | |
37 | DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault); | ||||
38 | }; | ||||
39 | |||||
40 | } // namespace base | ||||
41 | |||||
42 | #endif // BASE_MESSAGE_PUMP_DEFAULT_H_ |