OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_ | 5 #ifndef BASE_MESSAGE_PUMP_LIBEVENT_H_ |
6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ | 6 #define BASE_MESSAGE_PUMP_LIBEVENT_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/message_pump.h" | 10 #include "base/message_pump.h" |
11 #include "base/observer_list.h" | 11 #include "base/observer_list.h" |
12 #include "base/time.h" | 12 #include "base/time.h" |
13 | 13 |
14 // Declare structs we need from libevent.h rather than including it | 14 // Declare structs we need from libevent.h rather than including it |
15 struct event_base; | 15 struct event_base; |
16 struct event; | 16 struct event; |
17 | 17 |
18 namespace base { | 18 namespace base { |
19 | 19 |
20 // Class to monitor sockets and issue callbacks when sockets are ready for I/O | 20 // Class to monitor sockets and issue callbacks when sockets are ready for I/O |
21 // TODO(dkegel): add support for background file IO somehow | 21 // TODO(dkegel): add support for background file IO somehow |
22 class MessagePumpLibevent : public MessagePump { | 22 class BASE_API MessagePumpLibevent : public MessagePump { |
23 public: | 23 public: |
24 class IOObserver { | 24 class IOObserver { |
25 public: | 25 public: |
26 IOObserver() {} | 26 IOObserver() {} |
27 | 27 |
28 // An IOObserver is an object that receives IO notifications from the | 28 // An IOObserver is an object that receives IO notifications from the |
29 // MessagePump. | 29 // MessagePump. |
30 // | 30 // |
31 // NOTE: An IOObserver implementation should be extremely fast! | 31 // NOTE: An IOObserver implementation should be extremely fast! |
32 virtual void WillProcessIOEvent() = 0; | 32 virtual void WillProcessIOEvent() = 0; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
157 event* wakeup_event_; | 157 event* wakeup_event_; |
158 | 158 |
159 ObserverList<IOObserver> io_observers_; | 159 ObserverList<IOObserver> io_observers_; |
160 | 160 |
161 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); | 161 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); |
162 }; | 162 }; |
163 | 163 |
164 } // namespace base | 164 } // namespace base |
165 | 165 |
166 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ | 166 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ |
OLD | NEW |