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 <unistd.h> | 8 #include <unistd.h> |
9 | 9 |
10 #include "base/auto_reset.h" | 10 #include "base/auto_reset.h" |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.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/third_party/libevent/event.h" |
17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
18 #include "base/trace_event/trace_event.h" | 19 #include "base/trace_event/trace_event.h" |
19 #include "third_party/libevent/event.h" | |
20 | 20 |
21 #if defined(OS_MACOSX) | 21 #if defined(OS_MACOSX) |
22 #include "base/mac/scoped_nsautorelease_pool.h" | 22 #include "base/mac/scoped_nsautorelease_pool.h" |
23 #endif | 23 #endif |
24 | 24 |
25 // Lifecycle of struct event | 25 // Lifecycle of struct event |
26 // Libevent uses two main data structures: | 26 // Libevent uses two main data structures: |
27 // struct event_base (of which there is one per message pump), and | 27 // struct event_base (of which there is one per message pump), and |
28 // struct event (of which there is roughly one per socket). | 28 // struct event (of which there is roughly one per socket). |
29 // The socket's struct event is created in | 29 // The socket's struct event is created in |
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 // Remove and discard the wakeup byte. | 373 // Remove and discard the wakeup byte. |
374 char buf; | 374 char buf; |
375 int nread = HANDLE_EINTR(read(socket, &buf, 1)); | 375 int nread = HANDLE_EINTR(read(socket, &buf, 1)); |
376 DCHECK_EQ(nread, 1); | 376 DCHECK_EQ(nread, 1); |
377 that->processed_io_events_ = true; | 377 that->processed_io_events_ = true; |
378 // Tell libevent to break out of inner loop. | 378 // Tell libevent to break out of inner loop. |
379 event_base_loopbreak(that->event_base_); | 379 event_base_loopbreak(that->event_base_); |
380 } | 380 } |
381 | 381 |
382 } // namespace base | 382 } // namespace base |
OLD | NEW |