OLD | NEW |
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 #include "base/message_pump_libevent.h" | 5 #include "base/message_pump_libevent.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 NOTREACHED(); | 122 NOTREACHED(); |
123 } | 123 } |
124 | 124 |
125 MessagePumpLibevent::~MessagePumpLibevent() { | 125 MessagePumpLibevent::~MessagePumpLibevent() { |
126 DCHECK(wakeup_event_); | 126 DCHECK(wakeup_event_); |
127 DCHECK(event_base_); | 127 DCHECK(event_base_); |
128 event_del(wakeup_event_); | 128 event_del(wakeup_event_); |
129 delete wakeup_event_; | 129 delete wakeup_event_; |
130 if (wakeup_pipe_in_ >= 0) { | 130 if (wakeup_pipe_in_ >= 0) { |
131 if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0) | 131 if (HANDLE_EINTR(close(wakeup_pipe_in_)) < 0) |
132 PLOG(ERROR) << "close"; | 132 DPLOG(ERROR) << "close"; |
133 } | 133 } |
134 if (wakeup_pipe_out_ >= 0) { | 134 if (wakeup_pipe_out_ >= 0) { |
135 if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0) | 135 if (HANDLE_EINTR(close(wakeup_pipe_out_)) < 0) |
136 PLOG(ERROR) << "close"; | 136 DPLOG(ERROR) << "close"; |
137 } | 137 } |
138 event_base_free(event_base_); | 138 event_base_free(event_base_); |
139 } | 139 } |
140 | 140 |
141 bool MessagePumpLibevent::WatchFileDescriptor(int fd, | 141 bool MessagePumpLibevent::WatchFileDescriptor(int fd, |
142 bool persistent, | 142 bool persistent, |
143 Mode mode, | 143 Mode mode, |
144 FileDescriptorWatcher *controller, | 144 FileDescriptorWatcher *controller, |
145 Watcher *delegate) { | 145 Watcher *delegate) { |
146 DCHECK_GE(fd, 0); | 146 DCHECK_GE(fd, 0); |
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
368 // Remove and discard the wakeup byte. | 368 // Remove and discard the wakeup byte. |
369 char buf; | 369 char buf; |
370 int nread = HANDLE_EINTR(read(socket, &buf, 1)); | 370 int nread = HANDLE_EINTR(read(socket, &buf, 1)); |
371 DCHECK_EQ(nread, 1); | 371 DCHECK_EQ(nread, 1); |
372 that->processed_io_events_ = true; | 372 that->processed_io_events_ = true; |
373 // Tell libevent to break out of inner loop. | 373 // Tell libevent to break out of inner loop. |
374 event_base_loopbreak(that->event_base_); | 374 event_base_loopbreak(that->event_base_); |
375 } | 375 } |
376 | 376 |
377 } // namespace base | 377 } // namespace base |
OLD | NEW |