1// Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef BASE_MESSAGE_PUMP_DEFAULT_H_
6#define BASE_MESSAGE_PUMP_DEFAULT_H_
7#pragma once
8
9#include "base/message_pump.h"
10#include "base/time.h"
11#include "base/synchronization/waitable_event.h"
12
13namespace base {
14
15class MessagePumpDefault : public MessagePump {
16 public:
17  MessagePumpDefault();
18  ~MessagePumpDefault() {}
19
20  // MessagePump methods:
21  virtual void Run(Delegate* delegate);
22  virtual void Quit();
23  virtual void ScheduleWork();
24  virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
25
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.
34  TimeTicks delayed_work_time_;
35
36  DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault);
37};
38
39}  // namespace base
40
41#endif  // BASE_MESSAGE_PUMP_DEFAULT_H_
42