[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" |
avi | 9b6f4293 | 2015-12-26 22:15:14 | [diff] [blame] | 9 | #include "base/macros.h" |
[email protected] | 59e69e74 | 2013-06-18 20:27:52 | [diff] [blame] | 10 | #include "base/message_loop/message_pump.h" |
[email protected] | 9bf0b36 | 2013-06-14 23:15:32 | [diff] [blame] | 11 | #include "base/synchronization/waitable_event.h" |
[email protected] | 99084f6 | 2013-06-28 00:49:07 | [diff] [blame] | 12 | #include "base/time/time.h" |
Robert Sesek | d5ebd4b | 2017-09-22 23:09:07 | [diff] [blame] | 13 | #include "build/build_config.h" |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 14 | |
15 | namespace base { | ||||
16 | |||||
[email protected] | 32857c0 | 2014-06-25 17:40:57 | [diff] [blame] | 17 | class BASE_EXPORT MessagePumpDefault : public MessagePump { |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 18 | public: |
19 | MessagePumpDefault(); | ||||
Peter Boström | 7319bbd | 2021-09-15 22:59:38 | [diff] [blame^] | 20 | |
21 | MessagePumpDefault(const MessagePumpDefault&) = delete; | ||||
22 | MessagePumpDefault& operator=(const MessagePumpDefault&) = delete; | ||||
23 | |||||
dcheng | 5648818 | 2014-10-21 10:54:51 | [diff] [blame] | 24 | ~MessagePumpDefault() override; |
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 25 | |
26 | // MessagePump methods: | ||||
dcheng | 5648818 | 2014-10-21 10:54:51 | [diff] [blame] | 27 | void Run(Delegate* delegate) override; |
28 | void Quit() override; | ||||
29 | void ScheduleWork() override; | ||||
30 | void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override; | ||||
Avi Drissman | 5b28637 | 2020-07-28 21:59:38 | [diff] [blame] | 31 | #if defined(OS_APPLE) |
Robert Sesek | d5ebd4b | 2017-09-22 23:09:07 | [diff] [blame] | 32 | void SetTimerSlack(TimerSlack timer_slack) override; |
33 | #endif | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 34 | |
35 | private: | ||||
36 | // This flag is set to false when Run should return. | ||||
37 | bool keep_running_; | ||||
38 | |||||
39 | // Used to sleep until there is more work to do. | ||||
40 | WaitableEvent event_; | ||||
[email protected] | b2e9729 | 2008-09-02 18:20:34 | [diff] [blame] | 41 | }; |
42 | |||||
43 | } // namespace base | ||||
44 | |||||
danakj | 0a44860 | 2015-03-10 00:31:16 | [diff] [blame] | 45 | #endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_ |