Chromium Code Reviews| Index: base/message_pump_android.cc |
| diff --git a/base/message_pump_android.cc b/base/message_pump_android.cc |
| index 2daf98db3157fa8ac9aed43ce34052745119836b..dcf6a7d7ae1258d6a076edcacd8b7e6738c161f7 100644 |
| --- a/base/message_pump_android.cc |
| +++ b/base/message_pump_android.cc |
| @@ -10,6 +10,7 @@ |
| #include "base/android/scoped_java_ref.h" |
| #include "base/lazy_instance.h" |
| #include "base/logging.h" |
| +#include "base/run_loop.h" |
| #include "jni/system_message_handler_jni.h" |
| using base::android::ScopedJavaLocalRef; |
| @@ -61,7 +62,7 @@ static jboolean DoRunLoopOnce(JNIEnv* env, jobject obj, jint native_delegate) { |
| namespace base { |
| MessagePumpForUI::MessagePumpForUI() |
| - : state_(NULL) { |
| + : run_loop_(NULL) { |
| } |
| MessagePumpForUI::~MessagePumpForUI() { |
| @@ -73,7 +74,9 @@ void MessagePumpForUI::Run(Delegate* delegate) { |
| } |
| void MessagePumpForUI::Start(Delegate* delegate) { |
| - state_ = new MessageLoop::AutoRunState(MessageLoop::current()); |
| + run_loop_ = new base::RunLoop(); |
| + if (!run_loop_->BeforeRun()) |
| + NOTREACHED(); |
|
jar (doing other things)
2012/06/25 21:19:43
Should you actually return? I the semantics of t
jbates
2012/06/27 02:06:37
Added some comments.
|
| DCHECK(g_system_message_handler_obj.Get().is_null()); |
| @@ -94,9 +97,10 @@ void MessagePumpForUI::Quit() { |
| g_system_message_handler_obj.Get().Reset(); |
| } |
| - if (state_) { |
| - delete state_; |
| - state_ = NULL; |
| + if (run_loop_) { |
| + run_loop_->AfterRun(); |
| + delete run_loop_; |
| + run_loop_ = NULL; |
| } |
| } |