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

Unified Diff: base/message_pump_libevent.cc

Issue 11412101: Provide an iOS message pump for IO implementation. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Response to reviews Created 8 years, 1 month 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
« base/message_pump_io_ios.cc ('K') | « 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
diff --git a/base/message_pump_libevent.cc b/base/message_pump_libevent.cc
index 66acd86e6e0abef5559600f615d7c0c5b5217adf..9db4c071d6c134ddd4128b5bc79fea650b392bd7 100644
--- a/base/message_pump_libevent.cc
+++ b/base/message_pump_libevent.cc
@@ -144,22 +144,23 @@ MessagePumpLibevent::~MessagePumpLibevent() {
bool MessagePumpLibevent::WatchFileDescriptor(int fd,
bool persistent,
- Mode mode,
+ int mode,
FileDescriptorWatcher *controller,
Watcher *delegate) {
DCHECK_GE(fd, 0);
DCHECK(controller);
DCHECK(delegate);
- DCHECK(mode == WATCH_READ || mode == WATCH_WRITE || mode == WATCH_READ_WRITE);
+ DCHECK(mode == WATCH_READ || mode == WATCH_WRITE ||
+ mode == (WATCH_READ | WATCH_WRITE));
wtc 2012/11/26 22:17:42 Can you use WATCH_READ_WRITE here?
blundell 2012/11/27 10:58:43 Done.
// WatchFileDescriptor should be called on the pump thread. It is not
// threadsafe, and your watcher may never be registered.
DCHECK(watch_file_descriptor_caller_checker_.CalledOnValidThread());
int event_mask = persistent ? EV_PERSIST : 0;
- if ((mode & WATCH_READ) != 0) {
+ if (mode & WATCH_READ) {
event_mask |= EV_READ;
}
- if ((mode & WATCH_WRITE) != 0) {
+ if (mode & WATCH_WRITE) {
event_mask |= EV_WRITE;
}
@@ -190,12 +191,12 @@ bool MessagePumpLibevent::WatchFileDescriptor(int fd,
event_set(evt.get(), fd, event_mask, OnLibeventNotification, controller);
// Tell libevent which message pump this socket will belong to when we add it.
- if (event_base_set(event_base_, evt.get()) != 0) {
+ if (event_base_set(event_base_, evt.get())) {
return false;
}
// Add this socket to the list of monitored sockets.
- if (event_add(evt.get(), NULL) != 0) {
+ if (event_add(evt.get(), NULL)) {
return false;
}
« base/message_pump_io_ios.cc ('K') | « base/message_pump_libevent.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698