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/compiler_specific.h" |
10 #include "base/memory/weak_ptr.h" | 11 #include "base/memory/weak_ptr.h" |
11 #include "base/message_pump.h" | 12 #include "base/message_pump.h" |
12 #include "base/observer_list.h" | 13 #include "base/observer_list.h" |
13 #include "base/threading/thread_checker.h" | 14 #include "base/threading/thread_checker.h" |
14 #include "base/time.h" | 15 #include "base/time.h" |
15 | 16 |
16 // Declare structs we need from libevent.h rather than including it | 17 // Declare structs we need from libevent.h rather than including it |
17 struct event_base; | 18 struct event_base; |
18 struct event; | 19 struct event; |
19 | 20 |
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
116 bool WatchFileDescriptor(int fd, | 117 bool WatchFileDescriptor(int fd, |
117 bool persistent, | 118 bool persistent, |
118 Mode mode, | 119 Mode mode, |
119 FileDescriptorWatcher *controller, | 120 FileDescriptorWatcher *controller, |
120 Watcher *delegate); | 121 Watcher *delegate); |
121 | 122 |
122 void AddIOObserver(IOObserver* obs); | 123 void AddIOObserver(IOObserver* obs); |
123 void RemoveIOObserver(IOObserver* obs); | 124 void RemoveIOObserver(IOObserver* obs); |
124 | 125 |
125 // MessagePump methods: | 126 // MessagePump methods: |
126 virtual void Run(Delegate* delegate); | 127 virtual void Run(Delegate* delegate) OVERRIDE; |
127 virtual void Quit(); | 128 virtual void Quit() OVERRIDE; |
128 virtual void ScheduleWork(); | 129 virtual void ScheduleWork() OVERRIDE; |
129 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time); | 130 virtual void ScheduleDelayedWork(const TimeTicks& delayed_work_time) OVERRIDE; |
130 | 131 |
131 private: | 132 private: |
132 friend class MessagePumpLibeventTest; | 133 friend class MessagePumpLibeventTest; |
133 | 134 |
134 void WillProcessIOEvent(); | 135 void WillProcessIOEvent(); |
135 void DidProcessIOEvent(); | 136 void DidProcessIOEvent(); |
136 | 137 |
137 // Risky part of constructor. Returns true on success. | 138 // Risky part of constructor. Returns true on success. |
138 bool Init(); | 139 bool Init(); |
139 | 140 |
(...skipping 29 matching lines...) Expand all Loading... |
169 event* wakeup_event_; | 170 event* wakeup_event_; |
170 | 171 |
171 ObserverList<IOObserver> io_observers_; | 172 ObserverList<IOObserver> io_observers_; |
172 ThreadChecker watch_file_descriptor_caller_checker_; | 173 ThreadChecker watch_file_descriptor_caller_checker_; |
173 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); | 174 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); |
174 }; | 175 }; |
175 | 176 |
176 } // namespace base | 177 } // namespace base |
177 | 178 |
178 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ | 179 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ |
OLD | NEW |