blob: e545f16a8870262ed5ebc6174ad368cef7988fbd [file] [log] [blame]
[email protected]f2ebbf062012-04-06 03:14:301// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]b2e97292008-09-02 18:20:342// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]59e69e742013-06-18 20:27:525#ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
6#define BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
[email protected]b2e97292008-09-02 18:20:347
[email protected]32857c02014-06-25 17:40:578#include "base/base_export.h"
avi9b6f42932015-12-26 22:15:149#include "base/macros.h"
[email protected]59e69e742013-06-18 20:27:5210#include "base/message_loop/message_pump.h"
[email protected]9bf0b362013-06-14 23:15:3211#include "base/synchronization/waitable_event.h"
[email protected]99084f62013-06-28 00:49:0712#include "base/time/time.h"
Robert Sesekd5ebd4b2017-09-22 23:09:0713#include "build/build_config.h"
[email protected]b2e97292008-09-02 18:20:3414
15namespace base {
16
[email protected]32857c02014-06-25 17:40:5717class BASE_EXPORT MessagePumpDefault : public MessagePump {
[email protected]b2e97292008-09-02 18:20:3418 public:
19 MessagePumpDefault();
Peter Boström7319bbd2021-09-15 22:59:3820
21 MessagePumpDefault(const MessagePumpDefault&) = delete;
22 MessagePumpDefault& operator=(const MessagePumpDefault&) = delete;
23
dcheng56488182014-10-21 10:54:5124 ~MessagePumpDefault() override;
[email protected]b2e97292008-09-02 18:20:3425
26 // MessagePump methods:
dcheng56488182014-10-21 10:54:5127 void Run(Delegate* delegate) override;
28 void Quit() override;
29 void ScheduleWork() override;
30 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
Avi Drissman5b286372020-07-28 21:59:3831#if defined(OS_APPLE)
Robert Sesekd5ebd4b2017-09-22 23:09:0732 void SetTimerSlack(TimerSlack timer_slack) override;
33#endif
[email protected]b2e97292008-09-02 18:20:3434
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]b2e97292008-09-02 18:20:3441};
42
43} // namespace base
44
danakj0a448602015-03-10 00:31:1645#endif // BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_