Chromium Code Reviews| Index: content/browser/android/child_process_launcher_android.cc |
| diff --git a/content/browser/android/child_process_launcher_android.cc b/content/browser/android/child_process_launcher_android.cc |
| index 3b0473a9294ece42c21c18f4cfdcee3122bf8ce8..7265ae0c5636cb23dffb634900a6903ba1cc888c 100644 |
| --- a/content/browser/android/child_process_launcher_android.cc |
| +++ b/content/browser/android/child_process_launcher_android.cc |
| @@ -227,6 +227,31 @@ jboolean IsSingleProcess(JNIEnv* env, jclass clazz) { |
| switches::kSingleProcess); |
| } |
| +static void ExecuteOnLauncherThread( |
| + const base::android::JavaRef<jobject>& runnable) { |
| + JNIEnv* env = AttachCurrentThread(); |
| + DCHECK(env); |
| + Java_ChildProcessLauncher_executeOnLauncherThread(env, runnable.obj()); |
| +} |
| + |
| +jboolean RunOnLauncherThread(JNIEnv* env, jclass clazz, jobject runnable) { |
|
Yaron
2015/09/04 16:04:03
I think you're going to have to rebase on torne's
Jaekyun Seok (inactive)
2015/09/08 09:45:11
Done.
|
| + ScopedJavaGlobalRef<jobject> jrunnable; |
| + jrunnable.Reset(env, runnable); |
| + if (jrunnable.is_null()) |
| + return false; |
| + |
| + if (!BrowserThread::IsThreadInitialized(BrowserThread::PROCESS_LAUNCHER)) |
| + return false; |
| + |
| + if (BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)) { |
| + ExecuteOnLauncherThread(jrunnable); |
| + } else { |
| + BrowserThread::PostTask(BrowserThread::PROCESS_LAUNCHER, FROM_HERE, |
| + base::Bind(&ExecuteOnLauncherThread, jrunnable)); |
| + } |
| + return true; |
| +} |
| + |
| bool RegisterChildProcessLauncher(JNIEnv* env) { |
| return RegisterNativesImpl(env); |
| } |