blob: d63e8101a933b0a3494f746fe76e90e218d4748d [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"
[email protected]59e69e742013-06-18 20:27:529#include "base/message_loop/message_pump.h"
[email protected]9bf0b362013-06-14 23:15:3210#include "base/synchronization/waitable_event.h"
[email protected]99084f62013-06-28 00:49:0711#include "base/time/time.h"
[email protected]b2e97292008-09-02 18:20:3412
13namespace base {
14
[email protected]32857c02014-06-25 17:40:5715class BASE_EXPORT MessagePumpDefault : public MessagePump {
[email protected]b2e97292008-09-02 18:20:3416 public:
17 MessagePumpDefault();
dcheng56488182014-10-21 10:54:5118 ~MessagePumpDefault() override;
[email protected]b2e97292008-09-02 18:20:3419
20 // MessagePump methods:
dcheng56488182014-10-21 10:54:5121 void Run(Delegate* delegate) override;
22 void Quit() override;
23 void ScheduleWork() override;
24 void ScheduleDelayedWork(const TimeTicks& delayed_work_time) override;
[email protected]b2e97292008-09-02 18:20:3425
[email protected]b2e97292008-09-02 18:20:3426 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]7e7fab42010-11-06 22:23:2934 TimeTicks delayed_work_time_;
[email protected]b2e97292008-09-02 18:20:3435
36 DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault);
37};
38
39} // namespace base
40
[email protected]59e69e742013-06-18 20:27:5241#endif // BASE__MESSAGE_LOOPMESSAGE_PUMP_DEFAULT_H_