Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / base / message_loop / message_pump_default.h
blob19e720013fd69ca635bfa9801d114236562d83cc
1 // Copyright (c) 2012 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.
5 #ifndef BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
6 #define BASE_MESSAGE_LOOP_MESSAGE_PUMP_DEFAULT_H_
8 #include "base/base_export.h"
9 #include "base/message_loop/message_pump.h"
10 #include "base/synchronization/waitable_event.h"
11 #include "base/time/time.h"
13 namespace base {
15 class BASE_EXPORT MessagePumpDefault : public MessagePump {
16 public:
17 MessagePumpDefault();
18 virtual ~MessagePumpDefault();
20 // MessagePump methods:
21 virtual void Run(Delegate* delegate) OVERRIDE;
22 virtual void Quit() OVERRIDE;
23 virtual void ScheduleWork() OVERRIDE;
24 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE;
26 private:
27 // This flag is set to false when Run should return.
28 bool keep_running_;
30 // Used to sleep until there is more work to do.
31 WaitableEvent event_;
33 // The time at which we should call DoDelayedWork.
34 TimeTicks delayed_work_time_;
36 DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault);
39 } // namespace base
41 #endif // BASE__MESSAGE_LOOPMESSAGE_PUMP_DEFAULT_H_