[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 | |||||
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 5 | #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_ |
6 | #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_ | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 7 | |
[email protected] | 32857c0 | 2014-06-25 17:40:57 | [diff] [blame] | 8 | #include "base/base_export.h" |
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 9 | #include "base/message_loop/message_pump.h" |
[email protected] | 9bf0b36 | 2013-06-14 23:15:32 | [diff] [blame] | 10 | #include "base/synchronization/waitable_event.h" |
[email protected] | 99084f6 | 2013-06-28 00:49:07 | [diff] [blame] | 11 | #include "base/time/time.h" |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 12 | |
13 | namespace base { | ||||
14 | |||||
[email protected] | 32857c0 | 2014-06-25 17:40:57 | [diff] [blame] | 15 | class BASE_EXPORT MessagePumpDefault : public MessagePump { |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 16 | public: |
17 | MessagePumpDefault(); | ||||
dcheng | 5648818 | 2014-10-21 10:54:51 | [diff] [blame^] | 18 | ~MessagePumpDefault() override; |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 19 | |
20 | // MessagePump methods: | ||||
dcheng | 5648818 | 2014-10-21 10:54:51 | [diff] [blame^] | 21 | void Run(Delegate* delegate) override; |
22 | void Quit() override; | ||||
23 | void ScheduleWork() override; | ||||
24 | void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 25 | |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 26 | private: |
27 | // This flag is set to false when Run should return. | ||||
28 | bool keep_running_; | ||||
29 | |||||
30 | // Used to sleep until there is more work to do. | ||||
31 | WaitableEvent event_; | ||||
32 | |||||
33 | // The time at which we should call DoDelayedWork. | ||||
[email protected] | 7e7fab4 | 2010-11-06 22:23:29 | [diff] [blame] | 34 | TimeTicks delayed_work_time_; |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 35 | |
36 | DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault); | ||||
37 | }; | ||||
38 | |||||
39 | } // namespace base | ||||
40 | |||||
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 41 | #endif // BASE__MESSAGE_LOOPMESSAGE_PUMP_DEFAULT_H_ |