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/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/message_pump.h" | 11 #include "base/message_pump.h" |
12 #include "base/observer_list.h" | 12 #include "base/observer_list.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 | 15 |
16 // Declare structs we need from libevent.h rather than including it | 16 // Declare structs we need from libevent.h rather than including it |
17 struct event_base; | 17 struct event_base; |
18 struct event; | 18 struct event; |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 | 21 |
22 // Class to monitor sockets and issue callbacks when sockets are ready for I/O | 22 // Class to monitor sockets and issue callbacks when sockets are ready for I/O |
23 // TODO(dkegel): add support for background file IO somehow | 23 // TODO(dkegel): add support for background file IO somehow |
24 class BASE_API MessagePumpLibevent : public MessagePump { | 24 class BASE_EXPORT MessagePumpLibevent : public MessagePump { |
25 public: | 25 public: |
26 class IOObserver { | 26 class IOObserver { |
27 public: | 27 public: |
28 IOObserver() {} | 28 IOObserver() {} |
29 | 29 |
30 // An IOObserver is an object that receives IO notifications from the | 30 // An IOObserver is an object that receives IO notifications from the |
31 // MessagePump. | 31 // MessagePump. |
32 // | 32 // |
33 // NOTE: An IOObserver implementation should be extremely fast! | 33 // NOTE: An IOObserver implementation should be extremely fast! |
34 virtual void WillProcessIOEvent() = 0; | 34 virtual void WillProcessIOEvent() = 0; |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 event* wakeup_event_; | 169 event* wakeup_event_; |
170 | 170 |
171 ObserverList<IOObserver> io_observers_; | 171 ObserverList<IOObserver> io_observers_; |
172 ThreadChecker watch_file_descriptor_caller_checker_; | 172 ThreadChecker watch_file_descriptor_caller_checker_; |
173 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); | 173 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); |
174 }; | 174 }; |
175 | 175 |
176 } // namespace base | 176 } // namespace base |
177 | 177 |
178 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ | 178 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ |
OLD | NEW |