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

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

Issue 10696025: Upstream ChildProcessLauncher changes for Android. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add additional assert and comments 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
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SandboxedProcessConnection.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/SandboxedProcessLauncher.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessLauncher.java
index 83264c260cebcd74d7f2702f1d52330d47d675bc..36275235cfd0fef7521f7676d692a198330232be 100644
--- a/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessLauncher.java
+++ b/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessLauncher.java
@@ -13,6 +13,8 @@ import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
import org.chromium.base.CalledByNative;
+import org.chromium.base.ThreadUtils;
+import org.chromium.content.app.LibraryLoader;
import org.chromium.content.common.CommandLine;
import org.chromium.content.common.ISandboxedProcessCallback;
import org.chromium.content.common.ISandboxedProcessService;
@@ -74,7 +76,10 @@ public class SandboxedProcessLauncher {
String[] commandLine) {
SandboxedProcessConnection connection = allocateConnection(context);
if (connection != null) {
- connection.bind(commandLine);
+ String libraryName = LibraryLoader.getLibraryToLoad();
+ assert libraryName != null : "Attempting to launch a sandbox process without first "
+ + "calling LibraryLoader.setLibraryToLoad";
+ connection.bind(libraryName, commandLine);
}
return connection;
}
@@ -136,10 +141,11 @@ public class SandboxedProcessLauncher {
/**
* Should be called early in startup so the work needed to spawn the sandboxed process can
- * be done in parallel to other startup work.
+ * be done in parallel to other startup work. Must not be called on the UI thread.
* @param context the application context used for the connection.
*/
public static synchronized void warmUp(Context context) {
+ assert !ThreadUtils.runningOnUiThread();
if (mSpareConnection == null) {
mSpareConnection = allocateBoundConnection(context, null);
}
@@ -155,14 +161,13 @@ public class SandboxedProcessLauncher {
* @param commandLine The sandboxed process command line argv.
* @param ipcFd File descriptor used to set up IPC.
* @param clientContext Arbitrary parameter used by the client to distinguish this connection.
- * @return Connection object which maybe used with subsequent call to {@link #cancelStart}
*/
@CalledByNative
- static SandboxedProcessConnection start(
+ static void start(
Context context,
final String[] commandLine,
int ipcFd,
- int crashFd,
+ int[] fileToRegisterIdFds,
final int clientContext) {
assert clientContext != 0;
SandboxedProcessConnection allocatedConnection;
@@ -173,7 +178,7 @@ public class SandboxedProcessLauncher {
if (allocatedConnection == null) {
allocatedConnection = allocateBoundConnection(context, commandLine);
if (allocatedConnection == null) {
- return null;
+ return;
}
}
final SandboxedProcessConnection connection = allocatedConnection;
@@ -192,21 +197,8 @@ public class SandboxedProcessLauncher {
nativeOnSandboxedProcessStarted(clientContext, pid);
}
};
- connection.setupConnection(commandLine, ipcFd, crashFd, createCallback(), onConnect);
- return connection;
- }
-
- /**
- * Cancels a pending connection to a sandboxed process. This may be called from any thread.
- *
- * @param connection the object that was returned from the corresponding call to {@link #start}.
- */
- @CalledByNative
- static void cancelStart(SandboxedProcessConnection connection) {
- assert connection != null;
- assert !mServiceMap.containsValue(connection);
- connection.unbind();
- freeConnection(connection);
+ connection.setupConnection(commandLine, ipcFd, fileToRegisterIdFds, createCallback(),
+ onConnect);
}
/**
« no previous file with comments | « content/public/android/java/src/org/chromium/content/browser/SandboxedProcessConnection.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698