diff options
author | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-08 17:36:06 +0000 |
---|---|---|
committer | jeremy@chromium.org <jeremy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2008-12-08 17:36:06 +0000 |
commit | 1d2eb13fa0a3e8b1e03a22b8dd4d2af38b85b626 (patch) | |
tree | 61a73bac98aade2aaeb07e342529f53b5dc41265 /base/message_loop.cc | |
parent | 118e6963e97ca9fa971589295742ff33b4073e47 (diff) | |
download | chromium_src-1d2eb13fa0a3e8b1e03a22b8dd4d2af38b85b626.zip chromium_src-1d2eb13fa0a3e8b1e03a22b8dd4d2af38b85b626.tar.gz chromium_src-1d2eb13fa0a3e8b1e03a22b8dd4d2af38b85b626.tar.bz2 |
Add FD watching support to message_pump_libevent.
This CL goes along the same lines as the WatchSocket code, but we really need better encapsulation for this class in generel.
Review URL: http://codereview.chromium.org/13129
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@6513 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'base/message_loop.cc')
-rw-r--r-- | base/message_loop.cc | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/base/message_loop.cc b/base/message_loop.cc index 1145439..898fbfa 100644 --- a/base/message_loop.cc +++ b/base/message_loop.cc @@ -193,7 +193,7 @@ void MessageLoop::RunInternal() { return; } #endif - + pump_->Run(this); } @@ -206,10 +206,10 @@ bool MessageLoop::ProcessNextDelayedNonNestableTask() { if (deferred_non_nestable_work_queue_.empty()) return false; - + Task* task = deferred_non_nestable_work_queue_.front().task; deferred_non_nestable_work_queue_.pop(); - + RunTask(task); return true; } @@ -420,7 +420,7 @@ bool MessageLoop::DoDelayedWork(Time* next_delayed_work_time) { *next_delayed_work_time = Time(); return false; } - + if (delayed_work_queue_.top().delayed_run_time > Time::Now()) { *next_delayed_work_time = delayed_work_queue_.top().delayed_run_time; return false; @@ -428,7 +428,7 @@ bool MessageLoop::DoDelayedWork(Time* next_delayed_work_time) { PendingTask pending_task = delayed_work_queue_.top(); delayed_work_queue_.pop(); - + if (!delayed_work_queue_.empty()) *next_delayed_work_time = delayed_work_queue_.top().delayed_run_time; @@ -593,12 +593,22 @@ bool MessageLoopForIO::WaitForIOCompletion(DWORD timeout, IOHandler* filter) { #elif defined(OS_POSIX) -void MessageLoopForIO::WatchSocket(int socket, short interest_mask, +void MessageLoopForIO::WatchSocket(int socket, short interest_mask, struct event* e, Watcher* watcher) { pump_libevent()->WatchSocket(socket, interest_mask, e, watcher); } +void MessageLoopForIO::WatchFileHandle(int fd, short interest_mask, + struct event* e, FileWatcher* watcher) { + pump_libevent()->WatchFileHandle(fd, interest_mask, e, watcher); +} + + void MessageLoopForIO::UnwatchSocket(struct event* e) { pump_libevent()->UnwatchSocket(e); } + +void MessageLoopForIO::UnwatchFileHandle(struct event* e) { + pump_libevent()->UnwatchFileHandle(e); +} #endif |