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

Unified Diff: content/browser/child_process_launcher_helper_android.cc

Issue 2839353002: Revert of Remove post_launch_on_client_thread_called (Closed)
Patch Set: Created 3 years, 8 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
« no previous file with comments | « content/browser/child_process_launcher_helper.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/child_process_launcher_helper_android.cc
diff --git a/content/browser/child_process_launcher_helper_android.cc b/content/browser/child_process_launcher_helper_android.cc
index fafbc5d54a1bde0c2eea81f1a9f17ab75225911a..b498bb4f522b5c2e33d51f80e57f728f7dccac1d 100644
--- a/content/browser/child_process_launcher_helper_android.cc
+++ b/content/browser/child_process_launcher_helper_android.cc
@@ -199,14 +199,14 @@
return base::File(base::android::OpenApkAsset(path.value(), region));
}
-// Called from ChildProcessLauncher.java when the ChildProcess was started.
+// Called from ChildProcessLauncher.java when the ChildProcess was
+// started.
// |handle| is the processID of the child process as originated in Java, 0 if
// the ChildProcess could not be created.
void ChildProcessLauncherHelper::OnChildProcessStarted(
JNIEnv*,
const base::android::JavaParamRef<jobject>& obj,
jint handle) {
- DCHECK_CURRENTLY_ON(BrowserThread::PROCESS_LAUNCHER);
scoped_refptr<ChildProcessLauncherHelper> ref(this);
Release(); // Balances with LaunchProcessOnLauncherThread.
@@ -214,9 +214,28 @@
? LAUNCH_RESULT_FAILURE
: LAUNCH_RESULT_SUCCESS;
+ // TODO(jcivelli): Remove this by defining better what happens on what thread
+ // in the corresponding Java code.
ChildProcessLauncherHelper::Process process;
process.process = base::Process(handle);
- PostLaunchOnLauncherThread(std::move(process), launch_result);
+ if (BrowserThread::CurrentlyOn(BrowserThread::PROCESS_LAUNCHER)) {
+ PostLaunchOnLauncherThread(std::move(process), launch_result,
+ false); // post_launch_on_client_thread_called
+ return;
+ }
+
+ bool on_client_thread = BrowserThread::CurrentlyOn(
+ static_cast<BrowserThread::ID>(client_thread_id()));
+ BrowserThread::PostTask(
+ BrowserThread::PROCESS_LAUNCHER, FROM_HERE,
+ base::Bind(&ChildProcessLauncherHelper::PostLaunchOnLauncherThread, this,
+ base::Passed(std::move(process)), launch_result,
+ on_client_thread));
+ if (on_client_thread) {
+ ChildProcessLauncherHelper::Process process;
+ process.process = base::Process(handle);
+ PostLaunchOnClientThread(std::move(process), launch_result);
+ }
}
// static
« no previous file with comments | « content/browser/child_process_launcher_helper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698