| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_loop.h" | 5 #include "base/message_loop/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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 }; | 85 }; |
| 86 | 86 |
| 87 bool enable_histogrammer_ = false; | 87 bool enable_histogrammer_ = false; |
| 88 | 88 |
| 89 MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL; | 89 MessageLoop::MessagePumpFactory* message_pump_for_ui_factory_ = NULL; |
| 90 | 90 |
| 91 // Returns true if MessagePump::ScheduleWork() must be called one | 91 // Returns true if MessagePump::ScheduleWork() must be called one |
| 92 // time for every task that is added to the MessageLoop incoming queue. | 92 // time for every task that is added to the MessageLoop incoming queue. |
| 93 bool AlwaysNotifyPump(MessageLoop::Type type) { | 93 bool AlwaysNotifyPump(MessageLoop::Type type) { |
| 94 #if defined(OS_ANDROID) | 94 #if defined(OS_ANDROID) |
| 95 return type == MessageLoop::TYPE_UI; | 95 return type == MessageLoop::TYPE_UI || type == MessageLoop::TYPE_JAVA; |
| 96 #else | 96 #else |
| 97 return false; | 97 return false; |
| 98 #endif | 98 #endif |
| 99 } | 99 } |
| 100 | 100 |
| 101 } // namespace | 101 } // namespace |
| 102 | 102 |
| 103 //------------------------------------------------------------------------------ | 103 //------------------------------------------------------------------------------ |
| 104 | 104 |
| 105 #if defined(OS_WIN) | 105 #if defined(OS_WIN) |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 177 #error Not implemented | 177 #error Not implemented |
| 178 #endif | 178 #endif |
| 179 | 179 |
| 180 if (type_ == TYPE_UI) { | 180 if (type_ == TYPE_UI) { |
| 181 if (message_pump_for_ui_factory_) | 181 if (message_pump_for_ui_factory_) |
| 182 pump_.reset(message_pump_for_ui_factory_()); | 182 pump_.reset(message_pump_for_ui_factory_()); |
| 183 else | 183 else |
| 184 pump_.reset(MESSAGE_PUMP_UI); | 184 pump_.reset(MESSAGE_PUMP_UI); |
| 185 } else if (type_ == TYPE_IO) { | 185 } else if (type_ == TYPE_IO) { |
| 186 pump_.reset(MESSAGE_PUMP_IO); | 186 pump_.reset(MESSAGE_PUMP_IO); |
| 187 #if defined(OS_ANDROID) |
| 188 } else if (type_ == TYPE_JAVA) { |
| 189 pump_.reset(MESSAGE_PUMP_UI); |
| 190 #endif |
| 187 } else { | 191 } else { |
| 188 DCHECK_EQ(TYPE_DEFAULT, type_); | 192 DCHECK_EQ(TYPE_DEFAULT, type_); |
| 189 pump_.reset(new MessagePumpDefault()); | 193 pump_.reset(new MessagePumpDefault()); |
| 190 } | 194 } |
| 191 } | 195 } |
| 192 | 196 |
| 193 MessageLoop::~MessageLoop() { | 197 MessageLoop::~MessageLoop() { |
| 194 DCHECK_EQ(this, current()); | 198 DCHECK_EQ(this, current()); |
| 195 | 199 |
| 196 DCHECK(!run_loop_); | 200 DCHECK(!run_loop_); |
| (...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 741 fd, | 745 fd, |
| 742 persistent, | 746 persistent, |
| 743 mode, | 747 mode, |
| 744 controller, | 748 controller, |
| 745 delegate); | 749 delegate); |
| 746 } | 750 } |
| 747 | 751 |
| 748 #endif | 752 #endif |
| 749 | 753 |
| 750 } // namespace base | 754 } // namespace base |
| OLD | NEW |