blob: 07a6c704c68dfd545d0f8dbc4a5be3b575f0dfbb [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]59e69e742013-06-18 20:27:528#include "base/message_loop/message_pump.h"
[email protected]9bf0b362013-06-14 23:15:329#include "base/synchronization/waitable_event.h"
[email protected]99084f62013-06-28 00:49:0710#include "base/time/time.h"
[email protected]b2e97292008-09-02 18:20:3411
12namespace base {
13
14class MessagePumpDefault : public MessagePump {
15 public:
16 MessagePumpDefault();
[email protected]b2e97292008-09-02 18:20:3417
18 // MessagePump methods:
[email protected]b1719462011-11-16 00:08:0819 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]b2e97292008-09-02 18:20:3423
[email protected]f2ebbf062012-04-06 03:14:3024 protected:
25 virtual ~MessagePumpDefault() {}
26
[email protected]b2e97292008-09-02 18:20:3427 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]7e7fab42010-11-06 22:23:2935 TimeTicks delayed_work_time_;
[email protected]b2e97292008-09-02 18:20:3436
37 DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault);
38};
39
40} // namespace base
41
[email protected]59e69e742013-06-18 20:27:5242#endif // BASE__MESSAGE_LOOPMESSAGE_PUMP_DEFAULT_H_