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 |
11 #include "base/auto_reset.h" | 11 #include "base/auto_reset.h" |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/logging.h" | 13 #include "base/logging.h" |
14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
15 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
16 #include "base/posix/eintr_wrapper.h" | 16 #include "base/posix/eintr_wrapper.h" |
17 #include "base/time.h" | 17 #include "base/time/time.h" |
18 #include "third_party/libevent/event.h" | 18 #include "third_party/libevent/event.h" |
19 | 19 |
20 #if defined(OS_MACOSX) | 20 #if defined(OS_MACOSX) |
21 #include "base/mac/scoped_nsautorelease_pool.h" | 21 #include "base/mac/scoped_nsautorelease_pool.h" |
22 #endif | 22 #endif |
23 | 23 |
24 // Lifecycle of struct event | 24 // Lifecycle of struct event |
25 // Libevent uses two main data structures: | 25 // Libevent uses two main data structures: |
26 // struct event_base (of which there is one per message pump), and | 26 // struct event_base (of which there is one per message pump), and |
27 // struct event (of which there is roughly one per socket). | 27 // struct event (of which there is roughly one per socket). |
(...skipping 338 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 |