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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java

Issue 2063213002: Fix Chrome crashes on launch due to BIND_EXTERNAL_SERVICE error. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fire bug 620102. Created 4 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
index daa8aef6caa8d07814f24bbe61e1f2349597d96e..357062ac13bb573c6dde441f7ea6d7f6d51f7afb 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
@@ -652,20 +652,37 @@ public class ChildProcessLauncher {
boolean inSandbox = true;
String processType =
ContentSwitches.getSwitchValue(commandLine, ContentSwitches.SWITCH_PROCESS_TYPE);
- ChildProcessCreationParams params = null;
+ ChildProcessCreationParams params = ChildProcessCreationParams.get();
+ if (params != null) {
+ params = params.copy();
+ }
if (ContentSwitches.SWITCH_RENDERER_PROCESS.equals(processType)) {
callbackType = CALLBACK_FOR_RENDERER_PROCESS;
- if (ChildProcessCreationParams.get() != null) {
- params = ChildProcessCreationParams.get().copy();
- }
- } else if (ContentSwitches.SWITCH_GPU_PROCESS.equals(processType)) {
- callbackType = CALLBACK_FOR_GPU_PROCESS;
- inSandbox = false;
- } else if (ContentSwitches.SWITCH_UTILITY_PROCESS.equals(processType)) {
- // We only support sandboxed right now.
- callbackType = CALLBACK_FOR_UTILITY_PROCESS;
} else {
- assert false;
+ if (params != null && !params.getPackageName().equals(context.getPackageName())) {
+ // WebViews and WebAPKs have renderer processes running in their applications.
+ // When launching these renderer processes, {@link ChildProcessConnectionImpl}
+ // requires the package name of the application which holds the renderer process.
+ // Therefore, the package name in ChildProcessCreationParams could be the package
+ // name of WebViews, WebAPKs, or Chrome, depending on the host application.
+ // Except renderer process, all other child processes should use Chrome's package
+ // name. In WebAPK, ChildProcessCreationParams are initialized with WebAPK's
+ // package name. Make a copy of the WebAPK's params, but replace the package with
+ // Chrome's package to use when initializing a non-renderer processes.
+ // TODO(michaelbai | hanxi): crbug.com/620102. Cleans up the setting of
+ // ChildProcessCreationParams after using N sdk.
+ params = new ChildProcessCreationParams(context.getPackageName(),
+ params.getExtraBindFlags(), params.getLibraryProcessType());
+ }
+ if (ContentSwitches.SWITCH_GPU_PROCESS.equals(processType)) {
+ callbackType = CALLBACK_FOR_GPU_PROCESS;
+ inSandbox = false;
+ } else if (ContentSwitches.SWITCH_UTILITY_PROCESS.equals(processType)) {
+ // We only support sandboxed right now.
+ callbackType = CALLBACK_FOR_UTILITY_PROCESS;
+ } else {
+ assert false;
+ }
}
startInternal(context, commandLine, childProcessId, filesToBeMapped, clientContext,
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/ChildProcessCreationParams.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698