Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(271)

Unified Diff: base/message_pump_android.cc

Issue 10479018: Add base::RunLoop and update ui_test_utils to use it to reduce flakiness (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: jar feedback, compile errors Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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;
}
}
« no previous file with comments | « base/message_pump_android.h ('k') | base/run_loop.h » ('j') | chrome/test/base/ui_test_utils.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698