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 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
295 } | 295 } |
296 | 296 |
297 void MessagePumpLibevent::ScheduleDelayedWork( | 297 void MessagePumpLibevent::ScheduleDelayedWork( |
298 const TimeTicks& delayed_work_time) { | 298 const TimeTicks& delayed_work_time) { |
299 // We know that we can't be blocked on Wait right now since this method can | 299 // We know that we can't be blocked on Wait right now since this method can |
300 // only be called on the same thread as Run, so we only need to update our | 300 // only be called on the same thread as Run, so we only need to update our |
301 // record of how long to sleep when we do sleep. | 301 // record of how long to sleep when we do sleep. |
302 delayed_work_time_ = delayed_work_time; | 302 delayed_work_time_ = delayed_work_time; |
303 } | 303 } |
304 | 304 |
| 305 void MessagePumpLibevent::Shutdown() { |
| 306 } |
| 307 |
305 void MessagePumpLibevent::WillProcessIOEvent() { | 308 void MessagePumpLibevent::WillProcessIOEvent() { |
306 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); | 309 FOR_EACH_OBSERVER(IOObserver, io_observers_, WillProcessIOEvent()); |
307 } | 310 } |
308 | 311 |
309 void MessagePumpLibevent::DidProcessIOEvent() { | 312 void MessagePumpLibevent::DidProcessIOEvent() { |
310 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); | 313 FOR_EACH_OBSERVER(IOObserver, io_observers_, DidProcessIOEvent()); |
311 } | 314 } |
312 | 315 |
313 bool MessagePumpLibevent::Init() { | 316 bool MessagePumpLibevent::Init() { |
314 int fds[2]; | 317 int fds[2]; |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 // Remove and discard the wakeup byte. | 369 // Remove and discard the wakeup byte. |
367 char buf; | 370 char buf; |
368 int nread = HANDLE_EINTR(read(socket, &buf, 1)); | 371 int nread = HANDLE_EINTR(read(socket, &buf, 1)); |
369 DCHECK_EQ(nread, 1); | 372 DCHECK_EQ(nread, 1); |
370 that->processed_io_events_ = true; | 373 that->processed_io_events_ = true; |
371 // Tell libevent to break out of inner loop. | 374 // Tell libevent to break out of inner loop. |
372 event_base_loopbreak(that->event_base_); | 375 event_base_loopbreak(that->event_base_); |
373 } | 376 } |
374 | 377 |
375 } // namespace base | 378 } // namespace base |
OLD | NEW |