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.h" | 5 #include "base/message_loop.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
141 message_loop_proxy_ = new base::MessageLoopProxyImpl(); | 141 message_loop_proxy_ = new base::MessageLoopProxyImpl(); |
142 | 142 |
143 // TODO(rvargas): Get rid of the OS guards. | 143 // TODO(rvargas): Get rid of the OS guards. |
144 #if defined(OS_WIN) | 144 #if defined(OS_WIN) |
145 #define MESSAGE_PUMP_UI new base::MessagePumpForUI() | 145 #define MESSAGE_PUMP_UI new base::MessagePumpForUI() |
146 #define MESSAGE_PUMP_IO new base::MessagePumpForIO() | 146 #define MESSAGE_PUMP_IO new base::MessagePumpForIO() |
147 #elif defined(OS_MACOSX) | 147 #elif defined(OS_MACOSX) |
148 #define MESSAGE_PUMP_UI base::MessagePumpMac::Create() | 148 #define MESSAGE_PUMP_UI base::MessagePumpMac::Create() |
149 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent() | 149 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent() |
150 #elif defined(OS_NACL) | 150 #elif defined(OS_NACL) |
151 // Currently NaCl doesn't have a UI or an IO MessageLoop. | 151 // Currently NaCl doesn't have a UI MessageLoop. |
152 // TODO(abarth): Figure out if we need these. | 152 // TODO(abarth): Figure out if we need this. |
153 #define MESSAGE_PUMP_UI NULL | 153 #define MESSAGE_PUMP_UI NULL |
154 #define MESSAGE_PUMP_IO NULL | 154 // ipc_channel_nacl.cc uses a worker thread to do socket reads currently, and |
| 155 // doesn't require extra support for watching file descriptors. |
| 156 #define MESSAGE_PUMP_IO new base::MessagePumpDefault(); |
155 #elif defined(OS_POSIX) // POSIX but not MACOSX. | 157 #elif defined(OS_POSIX) // POSIX but not MACOSX. |
156 #define MESSAGE_PUMP_UI new base::MessagePumpForUI() | 158 #define MESSAGE_PUMP_UI new base::MessagePumpForUI() |
157 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent() | 159 #define MESSAGE_PUMP_IO new base::MessagePumpLibevent() |
158 #else | 160 #else |
159 #error Not implemented | 161 #error Not implemented |
160 #endif | 162 #endif |
161 | 163 |
162 if (type_ == TYPE_UI) { | 164 if (type_ == TYPE_UI) { |
163 if (message_pump_for_ui_factory_) | 165 if (message_pump_for_ui_factory_) |
164 pump_ = message_pump_for_ui_factory_(); | 166 pump_ = message_pump_for_ui_factory_(); |
(...skipping 629 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
794 Watcher *delegate) { | 796 Watcher *delegate) { |
795 return pump_libevent()->WatchFileDescriptor( | 797 return pump_libevent()->WatchFileDescriptor( |
796 fd, | 798 fd, |
797 persistent, | 799 persistent, |
798 static_cast<base::MessagePumpLibevent::Mode>(mode), | 800 static_cast<base::MessagePumpLibevent::Mode>(mode), |
799 controller, | 801 controller, |
800 delegate); | 802 delegate); |
801 } | 803 } |
802 | 804 |
803 #endif | 805 #endif |
OLD | NEW |