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

Unified Diff: base/message_pump_libevent.cc

Issue 7291010: Change MessagePumpLibevent::Run to process I/O events before doing idle (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Update comment, set processed_io_events_ in OnLibeventNotification Created 9 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « base/message_pump_libevent.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/message_pump_libevent.cc
===================================================================
--- base/message_pump_libevent.cc (revision 91167)
+++ base/message_pump_libevent.cc (working copy)
@@ -107,6 +107,7 @@
MessagePumpLibevent::MessagePumpLibevent()
: keep_running_(true),
in_run_(false),
+ processed_io_events_(false),
event_base_(event_base_new()),
wakeup_pipe_in_(-1),
wakeup_pipe_out_(-1) {
@@ -226,6 +227,12 @@
if (!keep_running_)
break;
+ event_base_loop(event_base_, EVLOOP_NONBLOCK);
+ did_work |= processed_io_events_;
+ processed_io_events_ = false;
+ if (!keep_running_)
+ break;
+
did_work |= delegate->DoDelayedWork(&delayed_work_time_);
if (!keep_running_)
break;
@@ -331,6 +338,7 @@
static_cast<FileDescriptorWatcher*>(context);
MessagePumpLibevent* pump = controller->pump();
+ pump->processed_io_events_ = true;
if (flags & EV_WRITE) {
controller->OnFileCanWriteWithoutBlocking(fd, pump);
@@ -351,6 +359,7 @@
char buf;
int nread = HANDLE_EINTR(read(socket, &buf, 1));
DCHECK_EQ(nread, 1);
+ that->processed_io_events_ = true;
// Tell libevent to break out of inner loop.
event_base_loopbreak(that->event_base_);
}
« no previous file with comments | « base/message_pump_libevent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698