OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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" |
11 #include "base/eintr_wrapper.h" | 11 #include "base/eintr_wrapper.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/mac/scoped_nsautorelease_pool.h" | 13 #include "base/mac/scoped_nsautorelease_pool.h" |
| 14 #include "base/memory/scoped_ptr.h" |
14 #include "base/observer_list.h" | 15 #include "base/observer_list.h" |
15 #include "base/scoped_ptr.h" | |
16 #include "base/time.h" | 16 #include "base/time.h" |
17 #if defined(USE_SYSTEM_LIBEVENT) | 17 #if defined(USE_SYSTEM_LIBEVENT) |
18 #include <event.h> | 18 #include <event.h> |
19 #else | 19 #else |
20 #include "third_party/libevent/event.h" | 20 #include "third_party/libevent/event.h" |
21 #endif | 21 #endif |
22 | 22 |
23 // Lifecycle of struct event | 23 // Lifecycle of struct event |
24 // Libevent uses two main data structures: | 24 // Libevent uses two main data structures: |
25 // struct event_base (of which there is one per message pump), and | 25 // struct event_base (of which there is one per message pump), and |
(...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
346 | 346 |
347 // Remove and discard the wakeup byte. | 347 // Remove and discard the wakeup byte. |
348 char buf; | 348 char buf; |
349 int nread = HANDLE_EINTR(read(socket, &buf, 1)); | 349 int nread = HANDLE_EINTR(read(socket, &buf, 1)); |
350 DCHECK_EQ(nread, 1); | 350 DCHECK_EQ(nread, 1); |
351 // Tell libevent to break out of inner loop. | 351 // Tell libevent to break out of inner loop. |
352 event_base_loopbreak(that->event_base_); | 352 event_base_loopbreak(that->event_base_); |
353 } | 353 } |
354 | 354 |
355 } // namespace base | 355 } // namespace base |
OLD | NEW |