| Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessConnection.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
|
| similarity index 86%
|
| rename from content/public/android/java/src/org/chromium/content/browser/SandboxedProcessConnection.java
|
| rename to content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
|
| index 53d531827e8fbec81637440597078096f1c86b80..b1b8ba926a3544d6bdbe6bd93cce68668f31de68 100644
|
| --- a/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessConnection.java
|
| +++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnection.java
|
| @@ -23,59 +23,59 @@ import org.chromium.base.CalledByNative;
|
| import org.chromium.base.CpuFeatures;
|
| import org.chromium.base.ThreadUtils;
|
| import org.chromium.content.common.CommandLine;
|
| -import org.chromium.content.common.ISandboxedProcessCallback;
|
| -import org.chromium.content.common.ISandboxedProcessService;
|
| +import org.chromium.content.common.IChildProcessCallback;
|
| +import org.chromium.content.common.IChildProcessService;
|
| import org.chromium.content.common.TraceEvent;
|
|
|
| -public class SandboxedProcessConnection implements ServiceConnection {
|
| +public class ChildProcessConnection implements ServiceConnection {
|
| interface DeathCallback {
|
| - void onSandboxedProcessDied(int pid);
|
| + void onChildProcessDied(int pid);
|
| }
|
|
|
| // Names of items placed in the bind intent or connection bundle.
|
| public static final String EXTRA_COMMAND_LINE =
|
| - "com.google.android.apps.chrome.extra.sandbox_command_line";
|
| + "com.google.android.apps.chrome.extra.command_line";
|
| public static final String EXTRA_NATIVE_LIBRARY_NAME =
|
| - "com.google.android.apps.chrome.extra.sandbox_native_library_name";
|
| + "com.google.android.apps.chrome.extra.native_library_name";
|
| // Note the FDs may only be passed in the connection bundle.
|
| public static final String EXTRA_FILES_PREFIX =
|
| - "com.google.android.apps.chrome.extra.sandbox_extraFile_";
|
| + "com.google.android.apps.chrome.extra.extraFile_";
|
| public static final String EXTRA_FILES_ID_SUFFIX = "_id";
|
| public static final String EXTRA_FILES_FD_SUFFIX = "_fd";
|
|
|
| - // Used to pass the CPU core count to sandboxed processes.
|
| + // Used to pass the CPU core count to child processes.
|
| public static final String EXTRA_CPU_COUNT =
|
| "com.google.android.apps.chrome.extra.cpu_count";
|
| - // Used to pass the CPU features mask to sandboxed processes.
|
| + // Used to pass the CPU features mask to child processes.
|
| public static final String EXTRA_CPU_FEATURES =
|
| "com.google.android.apps.chrome.extra.cpu_features";
|
|
|
| private final Context mContext;
|
| private final int mServiceNumber;
|
| - private final SandboxedProcessConnection.DeathCallback mDeathCallback;
|
| + private final ChildProcessConnection.DeathCallback mDeathCallback;
|
|
|
| // Synchronization: While most internal flow occurs on the UI thread, the public API
|
| // (specifically bind and unbind) may be called from any thread, hence all entry point methods
|
| - // into the class are synchronized on the SandboxedProcessConnection instance to protect access
|
| + // into the class are synchronized on the ChildProcessConnection instance to protect access
|
| // to these members. But see also the TODO where AsyncBoundServiceConnection is created.
|
| - private ISandboxedProcessService mService = null;
|
| + private IChildProcessService mService = null;
|
| private boolean mServiceConnectComplete = false;
|
| - private int mPID = 0; // Process ID of the corresponding sandboxed process.
|
| + private int mPID = 0; // Process ID of the corresponding child process.
|
| private HighPriorityConnection mHighPriorityConnection = null;
|
| private int mHighPriorityConnectionCount = 0;
|
|
|
| - private static final String TAG = "SandboxedProcessConnection";
|
| + private static final String TAG = "ChildProcessConnection";
|
|
|
| private static class ConnectionParams {
|
| final String[] mCommandLine;
|
| final FileDescriptorInfo[] mFilesToBeMapped;
|
| - final ISandboxedProcessCallback mCallback;
|
| + final IChildProcessCallback mCallback;
|
| final Runnable mOnConnectionCallback;
|
|
|
| ConnectionParams(
|
| String[] commandLine,
|
| FileDescriptorInfo[] filesToBeMapped,
|
| - ISandboxedProcessCallback callback,
|
| + IChildProcessCallback callback,
|
| Runnable onConnectionCallback) {
|
| mCommandLine = commandLine;
|
| mFilesToBeMapped = filesToBeMapped;
|
| @@ -88,8 +88,8 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| private ConnectionParams mConnectionParams;
|
| private boolean mIsBound;
|
|
|
| - SandboxedProcessConnection(Context context, int number,
|
| - SandboxedProcessConnection.DeathCallback deathCallback) {
|
| + ChildProcessConnection(Context context, int number,
|
| + ChildProcessConnection.DeathCallback deathCallback) {
|
| mContext = context;
|
| mServiceNumber = number;
|
| mDeathCallback = deathCallback;
|
| @@ -99,26 +99,27 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| return mServiceNumber;
|
| }
|
|
|
| - synchronized ISandboxedProcessService getService() {
|
| + synchronized IChildProcessService getService() {
|
| return mService;
|
| }
|
|
|
| private Intent createServiceBindIntent() {
|
| Intent intent = new Intent();
|
| - String n = org.chromium.content.app.SandboxedProcessService.class.getName();
|
| + String n = org.chromium.content.app.SandboxedProcessService0.class.getName()
|
| + .replaceAll("[0-9]*$", "");
|
| intent.setClassName(mContext, n + mServiceNumber);
|
| intent.setPackage(mContext.getPackageName());
|
| return intent;
|
| }
|
|
|
| /**
|
| - * Bind to an ISandboxedProcessService. This must be followed by a call to setupConnection()
|
| + * Bind to an IChildProcessService. This must be followed by a call to setupConnection()
|
| * to setup the connection parameters. (These methods are separated to allow the client
|
| * to pass whatever parameters they have available here, and complete the remainder
|
| * later while reducing the connection setup latency).
|
| * @param nativeLibraryName The name of the shared native library to be loaded for the
|
| - * sandboxed process.
|
| - * @param commandLine (Optional) Command line for the sandboxed process. If omitted, then
|
| + * child process.
|
| + * @param commandLine (Optional) Command line for the child process. If omitted, then
|
| * the command line parameters must instead be passed to setupConnection().
|
| */
|
| synchronized void bind(String nativeLibraryName, String[] commandLine) {
|
| @@ -150,7 +151,7 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| synchronized void setupConnection(
|
| String[] commandLine,
|
| FileDescriptorInfo[] filesToBeMapped,
|
| - ISandboxedProcessCallback callback,
|
| + IChildProcessCallback callback,
|
| Runnable onConnectionCallback) {
|
| TraceEvent.begin();
|
| assert mConnectionParams == null;
|
| @@ -163,7 +164,7 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| }
|
|
|
| /**
|
| - * Unbind the ISandboxedProcessService. It is safe to call this multiple times.
|
| + * Unbind the IChildProcessService. It is safe to call this multiple times.
|
| */
|
| synchronized void unbind() {
|
| if (mIsBound) {
|
| @@ -186,7 +187,7 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| public void onServiceConnected(ComponentName className, IBinder service) {
|
| TraceEvent.begin();
|
| mServiceConnectComplete = true;
|
| - mService = ISandboxedProcessService.Stub.asInterface(service);
|
| + mService = IChildProcessService.Stub.asInterface(service);
|
| if (mConnectionParams != null) {
|
| doConnectionSetup();
|
| }
|
| @@ -270,7 +271,7 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| TraceEvent.end();
|
| }
|
|
|
| - // Called on the main thread to notify that the sandboxed service did not disconnect gracefully.
|
| + // Called on the main thread to notify that the child service did not disconnect gracefully.
|
| @Override
|
| public void onServiceDisconnected(ComponentName className) {
|
| int pid = mPID; // Stash pid & connection callback since unbind() will clear them.
|
| @@ -279,7 +280,7 @@ public class SandboxedProcessConnection implements ServiceConnection {
|
| Log.w(TAG, "onServiceDisconnected (crash?): pid=" + pid);
|
| unbind(); // We don't want to auto-restart on crash. Let the browser do that.
|
| if (pid != 0) {
|
| - mDeathCallback.onSandboxedProcessDied(pid);
|
| + mDeathCallback.onChildProcessDied(pid);
|
| }
|
| if (onConnectionCallback != null) {
|
| onConnectionCallback.run();
|
|
|