| 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" |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 137 // Unix pipe used to implement ScheduleWork() | 137 // Unix pipe used to implement ScheduleWork() |
| 138 // ... callback; called by libevent inside Run() when pipe is ready to read | 138 // ... callback; called by libevent inside Run() when pipe is ready to read |
| 139 static void OnWakeup(int socket, short flags, void* context); | 139 static void OnWakeup(int socket, short flags, void* context); |
| 140 | 140 |
| 141 // This flag is set to false when Run should return. | 141 // This flag is set to false when Run should return. |
| 142 bool keep_running_; | 142 bool keep_running_; |
| 143 | 143 |
| 144 // This flag is set when inside Run. | 144 // This flag is set when inside Run. |
| 145 bool in_run_; | 145 bool in_run_; |
| 146 | 146 |
| 147 // This flag is set if libevent has processed I/O events. |
| 148 bool processed_io_events_; |
| 149 |
| 147 // The time at which we should call DoDelayedWork. | 150 // The time at which we should call DoDelayedWork. |
| 148 TimeTicks delayed_work_time_; | 151 TimeTicks delayed_work_time_; |
| 149 | 152 |
| 150 // Libevent dispatcher. Watches all sockets registered with it, and sends | 153 // Libevent dispatcher. Watches all sockets registered with it, and sends |
| 151 // readiness callbacks when a socket is ready for I/O. | 154 // readiness callbacks when a socket is ready for I/O. |
| 152 event_base* event_base_; | 155 event_base* event_base_; |
| 153 | 156 |
| 154 // ... write end; ScheduleWork() writes a single byte to it | 157 // ... write end; ScheduleWork() writes a single byte to it |
| 155 int wakeup_pipe_in_; | 158 int wakeup_pipe_in_; |
| 156 // ... read end; OnWakeup reads it and then breaks Run() out of its sleep | 159 // ... read end; OnWakeup reads it and then breaks Run() out of its sleep |
| 157 int wakeup_pipe_out_; | 160 int wakeup_pipe_out_; |
| 158 // ... libevent wrapper for read end | 161 // ... libevent wrapper for read end |
| 159 event* wakeup_event_; | 162 event* wakeup_event_; |
| 160 | 163 |
| 161 ObserverList<IOObserver> io_observers_; | 164 ObserverList<IOObserver> io_observers_; |
| 162 ThreadChecker watch_file_descriptor_caller_checker_; | 165 ThreadChecker watch_file_descriptor_caller_checker_; |
| 163 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); | 166 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); |
| 164 }; | 167 }; |
| 165 | 168 |
| 166 } // namespace base | 169 } // namespace base |
| 167 | 170 |
| 168 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ | 171 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ |
| OLD | NEW |