OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #include "base/message_loop/message_pump_libevent.h" | 5 #include "base/message_loop/message_pump_libevent.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 | 10 |
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
118 if (!Init()) | 118 if (!Init()) |
119 NOTREACHED(); | 119 NOTREACHED(); |
120 } | 120 } |
121 | 121 |
122 MessagePumpLibevent::~MessagePumpLibevent() { | 122 MessagePumpLibevent::~MessagePumpLibevent() { |
123 DCHECK(wakeup_event_); | 123 DCHECK(wakeup_event_); |
124 DCHECK(event_base_); | 124 DCHECK(event_base_); |
125 event_del(wakeup_event_); | 125 event_del(wakeup_event_); |
126 delete wakeup_event_; | 126 delete wakeup_event_; |
127 if (wakeup_pipe_in_ >= 0) { | 127 if (wakeup_pipe_in_ >= 0) { |
128 if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0) | 128 if (IGNORE_EINTR(close(wakeup_pipe_in_)) < 0) |
129 DPLOG(ERROR) << "close"; | 129 DPLOG(ERROR) << "close"; |
130 } | 130 } |
131 if (wakeup_pipe_out_ >= 0) { | 131 if (wakeup_pipe_out_ >= 0) { |
132 if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0) | 132 if (IGNORE_EINTR(close(wakeup_pipe_out_)) < 0) |
133 DPLOG(ERROR) << "close"; | 133 DPLOG(ERROR) << "close"; |
134 } | 134 } |
135 event_base_free(event_base_); | 135 event_base_free(event_base_); |
136 } | 136 } |
137 | 137 |
138 bool MessagePumpLibevent::WatchFileDescriptor(int fd, | 138 bool MessagePumpLibevent::WatchFileDescriptor(int fd, |
139 bool persistent, | 139 bool persistent, |
140 int mode, | 140 int mode, |
141 FileDescriptorWatcher *controller, | 141 FileDescriptorWatcher *controller, |
142 Watcher *delegate) { | 142 Watcher *delegate) { |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // Remove and discard the wakeup byte. | 366 // Remove and discard the wakeup byte. |
367 char buf; | 367 char buf; |
368 int nread = HANDLE_EINTR(read(socket, &buf, 1)); | 368 int nread = HANDLE_EINTR(read(socket, &buf, 1)); |
369 DCHECK_EQ(nread, 1); | 369 DCHECK_EQ(nread, 1); |
370 that->processed_io_events_ = true; | 370 that->processed_io_events_ = true; |
371 // Tell libevent to break out of inner loop. | 371 // Tell libevent to break out of inner loop. |
372 event_base_loopbreak(that->event_base_); | 372 event_base_loopbreak(that->event_base_); |
373 } | 373 } |
374 | 374 |
375 } // namespace base | 375 } // namespace base |
OLD | NEW |