Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(832)

Side by Side Diff: base/message_pump_libevent.h

Issue 7262011: Change MessagePumpLibevent::Run to handle IO events before doing idle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: A better solution Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | base/message_pump_libevent.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 the message pump has processed I/O events for
148 // registered FDs.
149 bool processed_io_events_;
150
147 // The time at which we should call DoDelayedWork. 151 // The time at which we should call DoDelayedWork.
148 TimeTicks delayed_work_time_; 152 TimeTicks delayed_work_time_;
149 153
150 // Libevent dispatcher. Watches all sockets registered with it, and sends 154 // Libevent dispatcher. Watches all sockets registered with it, and sends
151 // readiness callbacks when a socket is ready for I/O. 155 // readiness callbacks when a socket is ready for I/O.
152 event_base* event_base_; 156 event_base* event_base_;
153 157
154 // ... write end; ScheduleWork() writes a single byte to it 158 // ... write end; ScheduleWork() writes a single byte to it
155 int wakeup_pipe_in_; 159 int wakeup_pipe_in_;
156 // ... read end; OnWakeup reads it and then breaks Run() out of its sleep 160 // ... read end; OnWakeup reads it and then breaks Run() out of its sleep
157 int wakeup_pipe_out_; 161 int wakeup_pipe_out_;
158 // ... libevent wrapper for read end 162 // ... libevent wrapper for read end
159 event* wakeup_event_; 163 event* wakeup_event_;
160 164
161 ObserverList<IOObserver> io_observers_; 165 ObserverList<IOObserver> io_observers_;
162 ThreadChecker watch_file_descriptor_caller_checker_; 166 ThreadChecker watch_file_descriptor_caller_checker_;
163 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent); 167 DISALLOW_COPY_AND_ASSIGN(MessagePumpLibevent);
164 }; 168 };
165 169
166 } // namespace base 170 } // namespace base
167 171
168 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_ 172 #endif // BASE_MESSAGE_PUMP_LIBEVENT_H_
OLDNEW
« no previous file with comments | « no previous file | base/message_pump_libevent.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698