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