Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
4 : // Use of this source code is governed by a BSD-style license that can be
5 : // found in the LICENSE file.
6 :
7 : #ifndef BASE_MESSAGE_PUMP_DEFAULT_H_
8 : #define BASE_MESSAGE_PUMP_DEFAULT_H_
9 :
10 : #include "base/message_pump.h"
11 : #include "base/time.h"
12 : #include "base/waitable_event.h"
13 :
14 : namespace base {
15 :
16 : class MessagePumpDefault : public MessagePump {
17 : public:
18 : MessagePumpDefault();
19 1 : ~MessagePumpDefault() {}
20 :
21 : // MessagePump methods:
22 : virtual void Run(Delegate* delegate);
23 : virtual void Quit();
24 : virtual void ScheduleWork();
25 : virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time);
26 :
27 : protected:
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.
35 : TimeTicks delayed_work_time_;
36 :
37 : private:
38 : DISALLOW_COPY_AND_ASSIGN(MessagePumpDefault);
39 : };
40 :
41 : } // namespace base
42 :
43 : #endif // BASE_MESSAGE_PUMP_DEFAULT_H_
|