OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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.h" | 5 #include "base/message_loop.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/lazy_instance.h" | 10 #include "base/lazy_instance.h" |
11 #include "base/logging.h" | 11 #include "base/logging.h" |
12 #include "base/message_pump_default.h" | 12 #include "base/message_pump_default.h" |
13 #include "base/string_util.h" | 13 #include "base/string_util.h" |
14 #include "base/thread_local.h" | 14 #include "base/thread_local.h" |
15 | 15 |
16 #if defined(OS_MACOSX) | 16 #if defined(OS_MACOSX) |
17 #include "base/message_pump_mac.h" | 17 #include "base/message_pump_mac.h" |
18 #endif | 18 #endif |
19 #if defined(OS_POSIX) | 19 #if defined(OS_POSIX) |
20 #include "base/message_pump_libevent.h" | 20 #include "base/message_pump_libevent.h" |
21 #endif | 21 #endif |
22 #if defined(OS_LINUX) | 22 #if defined(OS_LINUX) |
23 #include "base/message_pump_glib.h" | 23 #include "base/message_pump_glib.h" |
24 #endif | 24 #endif |
25 | 25 |
| 26 using base::Time; |
| 27 using base::TimeDelta; |
| 28 |
26 // A lazily created thread local storage for quick access to a thread's message | 29 // A lazily created thread local storage for quick access to a thread's message |
27 // loop, if one exists. This should be safe and free of static constructors. | 30 // loop, if one exists. This should be safe and free of static constructors. |
28 static base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr( | 31 static base::LazyInstance<base::ThreadLocalPointer<MessageLoop> > lazy_tls_ptr( |
29 base::LINKER_INITIALIZED); | 32 base::LINKER_INITIALIZED); |
30 | 33 |
31 //------------------------------------------------------------------------------ | 34 //------------------------------------------------------------------------------ |
32 | 35 |
33 // Logical events for Histogram profiling. Run with -message-loop-histogrammer | 36 // Logical events for Histogram profiling. Run with -message-loop-histogrammer |
34 // to get an accounting of messages and actions taken on each thread. | 37 // to get an accounting of messages and actions taken on each thread. |
35 static const int kTaskRunEvent = 0x1; | 38 static const int kTaskRunEvent = 0x1; |
(...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 | 600 |
598 void MessageLoopForIO::WatchSocket(int socket, short interest_mask, | 601 void MessageLoopForIO::WatchSocket(int socket, short interest_mask, |
599 struct event* e, Watcher* watcher) { | 602 struct event* e, Watcher* watcher) { |
600 pump_libevent()->WatchSocket(socket, interest_mask, e, watcher); | 603 pump_libevent()->WatchSocket(socket, interest_mask, e, watcher); |
601 } | 604 } |
602 | 605 |
603 void MessageLoopForIO::UnwatchSocket(struct event* e) { | 606 void MessageLoopForIO::UnwatchSocket(struct event* e) { |
604 pump_libevent()->UnwatchSocket(e); | 607 pump_libevent()->UnwatchSocket(e); |
605 } | 608 } |
606 #endif | 609 #endif |
OLD | NEW |