OLD | NEW |
(Empty) | |
| 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_LIBEVENT_H_ |
| 6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ |
| 7 |
| 8 #include "base/message_pump.h" |
| 9 #include "base/time.h" |
| 10 |
| 11 // from libevent |
| 12 struct event_base; |
| 13 struct event; |
| 14 |
| 15 namespace base { |
| 16 |
| 17 class MessagePumpLibevent : public MessagePump { |
| 18 public: |
| 19 MessagePumpLibevent(); |
| 20 virtual ~MessagePumpLibevent(); |
| 21 |
| 22 // MessagePump methods: |
| 23 virtual void Run(Delegate* delegate); |
| 24 virtual void Quit(); |
| 25 virtual void ScheduleWork(); |
| 26 virtual void ScheduleDelayedWork(const Time& delayed_work_time); |
| 27 |
| 28 struct event_base* getEventbase() { return evbase_; } |
| 29 |
| 30 private: |
| 31 // This flag is set to false when Run should return. |
| 32 bool keep_running_; |
| 33 |
| 34 // The time at which we should call DoDelayedWork. |
| 35 Time delayed_work_time_; |
| 36 |
| 37 // Wakeup pipe to let other threads break us out of libevent loop. |
| 38 int wakeup_pipe_gazinta_; |
| 39 // need to fix friendship. |
| 40 public: |
| 41 int wakeup_pipe_gazouta_; |
| 42 |
| 43 // Libevent dispatcher |
| 44 ::event_base *evbase_; |
| 45 private: |
| 46 struct event *wakeup_event_; |
| 47 |
| 48 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); |
| 49 }; |
| 50 |
| 51 } // namespace base |
| 52 |
| 53 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ |
| 54 |
OLD | NEW |