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

Unified Diff: mojo/android/system/base_run_loop.cc

Issue 2211473003: Remove calls to deprecated MessageLoop methods on Windows and Linux. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 4 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: mojo/android/system/base_run_loop.cc
diff --git a/mojo/android/system/base_run_loop.cc b/mojo/android/system/base_run_loop.cc
index e48d2f0e0199476d964da8339a01945cc801e632..44cf5d8d46b8f683b1e69a0cede3fb1d037ea32b 100644
--- a/mojo/android/system/base_run_loop.cc
+++ b/mojo/android/system/base_run_loop.cc
@@ -10,7 +10,10 @@
#include "base/android/jni_android.h"
#include "base/android/jni_registrar.h"
#include "base/bind.h"
+#include "base/logging.h"
#include "base/message_loop/message_loop.h"
+#include "base/run_loop.h"
+#include "base/single_thread_task_runner.h"
#include "jni/BaseRunLoop_jni.h"
#include "mojo/message_pump/message_pump_mojo.h"
@@ -27,13 +30,19 @@ static jlong CreateBaseRunLoop(JNIEnv* env,
static void Run(JNIEnv* env,
const JavaParamRef<jobject>& jcaller,
jlong runLoopID) {
- reinterpret_cast<base::MessageLoop*>(runLoopID)->Run();
+ DCHECK(reinterpret_cast<base::MessageLoop*>(runLoopID)
+ ->task_runner()
+ ->BelongsToCurrentThread());
+ base::RunLoop().Run();
}
static void RunUntilIdle(JNIEnv* env,
const JavaParamRef<jobject>& jcaller,
jlong runLoopID) {
- reinterpret_cast<base::MessageLoop*>(runLoopID)->RunUntilIdle();
+ DCHECK(reinterpret_cast<base::MessageLoop*>(runLoopID)
+ ->task_runner()
+ ->BelongsToCurrentThread());
+ base::RunLoop().RunUntilIdle();
}
static void Quit(JNIEnv* env,
@@ -58,9 +67,10 @@ static void PostDelayedTask(JNIEnv* env,
// use it across threads. |RunJavaRunnable| will acquire a new JNIEnv before
// running the Runnable.
runnable_ref.Reset(env, runnable);
- reinterpret_cast<base::MessageLoop*>(runLoopID)->PostDelayedTask(
- FROM_HERE, base::Bind(&RunJavaRunnable, runnable_ref),
- base::TimeDelta::FromMicroseconds(delay));
+ reinterpret_cast<base::MessageLoop*>(runLoopID)
+ ->task_runner()
+ ->PostDelayedTask(FROM_HERE, base::Bind(&RunJavaRunnable, runnable_ref),
+ base::TimeDelta::FromMicroseconds(delay));
}
static void DeleteMessageLoop(JNIEnv* env,

Powered by Google App Engine
This is Rietveld 408576698