Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.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/ChildProcessLauncher.java |
similarity index 80% |
rename from content/public/android/java/src/org/chromium/content/browser/SandboxedProcessLauncher.java |
rename to content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
index 4ea75bdf7b623cf5889b5e20a017e3b0556f4564..1af0bd36a727277c8897d9088b50767e15b7817a 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/SandboxedProcessLauncher.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java |
@@ -18,24 +18,24 @@ import org.chromium.base.JNINamespace; |
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; |
+import org.chromium.content.common.IChildProcessCallback; |
+import org.chromium.content.common.IChildProcessService; |
/** |
- * This class provides the method to start/stop SandboxedProcess called by |
+ * This class provides the method to start/stop ChildProcess called by |
* native. |
*/ |
@JNINamespace("content") |
-public class SandboxedProcessLauncher { |
- private static String TAG = "SandboxedProcessLauncher"; |
+public class ChildProcessLauncher { |
+ private static String TAG = "ChildProcessLauncher"; |
// The upper limit on the number of simultaneous service process instances supported. |
// This must not exceed total number of SandboxedProcessServiceX classes declared in |
// this package, and defined as services in the embedding application's manifest file. |
- // (See {@link SandboxedProcessService} for more details on defining the services.) |
+ // (See {@link ChildProcessService} for more details on defining the services.) |
/* package */ static final int MAX_REGISTERED_SERVICES = 6; |
- private static final SandboxedProcessConnection[] mConnections = |
- new SandboxedProcessConnection[MAX_REGISTERED_SERVICES]; |
+ private static final ChildProcessConnection[] mConnections = |
+ new ChildProcessConnection[MAX_REGISTERED_SERVICES]; |
// The list of free slots in mConnections. When looking for a free connection, |
// the first index in that list should be used. When a connection is freed, its index |
// is added to the end of the list. This is so that we avoid immediately reusing a freed |
@@ -52,11 +52,11 @@ public class SandboxedProcessLauncher { |
} |
} |
- private static SandboxedProcessConnection allocateConnection(Context context) { |
- SandboxedProcessConnection.DeathCallback deathCallback = |
- new SandboxedProcessConnection.DeathCallback() { |
+ private static ChildProcessConnection allocateConnection(Context context) { |
+ ChildProcessConnection.DeathCallback deathCallback = |
+ new ChildProcessConnection.DeathCallback() { |
@Override |
- public void onSandboxedProcessDied(int pid) { |
+ public void onChildProcessDied(int pid) { |
stop(pid); |
} |
}; |
@@ -67,14 +67,14 @@ public class SandboxedProcessLauncher { |
} |
int slot = mFreeConnectionIndices.remove(0); |
assert mConnections[slot] == null; |
- mConnections[slot] = new SandboxedProcessConnection(context, slot, deathCallback); |
+ mConnections[slot] = new ChildProcessConnection(context, slot, deathCallback); |
return mConnections[slot]; |
} |
} |
- private static SandboxedProcessConnection allocateBoundConnection(Context context, |
+ private static ChildProcessConnection allocateBoundConnection(Context context, |
String[] commandLine) { |
- SandboxedProcessConnection connection = allocateConnection(context); |
+ ChildProcessConnection connection = allocateConnection(context); |
if (connection != null) { |
String libraryName = LibraryLoader.getLibraryToLoad(); |
assert libraryName != null : "Attempting to launch a sandbox process without first " |
Yaron
2013/03/08 03:10:31
Update comment
kjyoun
2013/03/11 14:17:43
Done.
|
@@ -84,7 +84,7 @@ public class SandboxedProcessLauncher { |
return connection; |
} |
- private static void freeConnection(SandboxedProcessConnection connection) { |
+ private static void freeConnection(ChildProcessConnection connection) { |
if (connection == null) { |
return; |
} |
@@ -113,12 +113,12 @@ public class SandboxedProcessLauncher { |
// Represents an invalid process handle; same as base/process.h kNullProcessHandle. |
private static final int NULL_PROCESS_HANDLE = 0; |
- // Map from pid to SandboxedService connection. |
- private static Map<Integer, SandboxedProcessConnection> mServiceMap = |
- new ConcurrentHashMap<Integer, SandboxedProcessConnection>(); |
+ // Map from pid to ChildService connection. |
+ private static Map<Integer, ChildProcessConnection> mServiceMap = |
+ new ConcurrentHashMap<Integer, ChildProcessConnection>(); |
// A pre-allocated and pre-bound connection ready for connection setup, or null. |
- static SandboxedProcessConnection mSpareConnection = null; |
+ static ChildProcessConnection mSpareConnection = null; |
/** |
* Returns the sandboxed process service interface for the given pid. This may be called on |
Yaron
2013/03/08 03:10:31
Update comment
kjyoun
2013/03/11 14:17:43
Done.
|
@@ -126,10 +126,10 @@ public class SandboxedProcessLauncher { |
* service calls should catch and handle android.os.RemoteException. |
* |
* @param pid The pid (process handle) of the service obtained from {@link #start}. |
- * @return The ISandboxedProcessService or null if the service no longer exists. |
+ * @return The IChildProcessService or null if the service no longer exists. |
*/ |
- public static ISandboxedProcessService getSandboxedService(int pid) { |
- SandboxedProcessConnection connection = mServiceMap.get(pid); |
+ public static IChildProcessService getChildService(int pid) { |
+ ChildProcessConnection connection = mServiceMap.get(pid); |
if (connection != null) { |
return connection.getService(); |
} |
@@ -150,7 +150,7 @@ public class SandboxedProcessLauncher { |
/** |
* Spawns and connects to a sandboxed process. May be called on any thread. It will not |
Yaron
2013/03/08 03:10:31
Update comment
kjyoun
2013/03/11 14:17:43
Done.
|
- * block, but will instead callback to {@link #nativeOnSandboxedProcessStarted} when the |
+ * block, but will instead callback to {@link #nativeOnChildProcessStarted} when the |
* connection is established. Note this callback will not necessarily be from the same thread |
* (currently it always comes from the main thread). |
* |
@@ -177,8 +177,8 @@ public class SandboxedProcessLauncher { |
new FileDescriptorInfo(fileIds[i], fileFds[i], fileAutoClose[i]); |
} |
assert clientContext != 0; |
- SandboxedProcessConnection allocatedConnection; |
- synchronized (SandboxedProcessLauncher.class) { |
+ ChildProcessConnection allocatedConnection; |
+ synchronized (ChildProcessLauncher.class) { |
allocatedConnection = mSpareConnection; |
mSpareConnection = null; |
} |
@@ -186,11 +186,11 @@ public class SandboxedProcessLauncher { |
allocatedConnection = allocateBoundConnection(context, commandLine); |
if (allocatedConnection == null) { |
// Notify the native code so it can free the heap allocated callback. |
- nativeOnSandboxedProcessStarted(clientContext, 0); |
+ nativeOnChildProcessStarted(clientContext, 0); |
return; |
} |
} |
- final SandboxedProcessConnection connection = allocatedConnection; |
+ final ChildProcessConnection connection = allocatedConnection; |
Log.d(TAG, "Setting up connection to process: slot=" + connection.getServiceNumber()); |
// Note: This runnable will be executed when the sandboxed connection is setup. |
final Runnable onConnect = new Runnable() { |
@@ -203,7 +203,7 @@ public class SandboxedProcessLauncher { |
} else { |
freeConnection(connection); |
} |
- nativeOnSandboxedProcessStarted(clientContext, pid); |
+ nativeOnChildProcessStarted(clientContext, pid); |
} |
}; |
connection.setupConnection(commandLine, filesToBeMapped, createCallback(), onConnect); |
@@ -218,7 +218,7 @@ public class SandboxedProcessLauncher { |
static void stop(int pid) { |
Log.d(TAG, "stopping sandboxed connection: pid=" + pid); |
- SandboxedProcessConnection connection = mServiceMap.remove(pid); |
+ ChildProcessConnection connection = mServiceMap.remove(pid); |
if (connection == null) { |
Log.w(TAG, "Tried to stop non-existent connection to pid: " + pid); |
return; |
@@ -235,7 +235,7 @@ public class SandboxedProcessLauncher { |
* @param pid The process handle of the service connection obtained from {@link #start}. |
*/ |
static void bindAsHighPriority(int pid) { |
- SandboxedProcessConnection connection = mServiceMap.get(pid); |
+ ChildProcessConnection connection = mServiceMap.get(pid); |
if (connection == null) { |
Log.w(TAG, "Tried to bind a non-existent connection to pid: " + pid); |
return; |
@@ -249,7 +249,7 @@ public class SandboxedProcessLauncher { |
* @param pid The process handle of the service obtained from {@link #start}. |
*/ |
static void unbindAsHighPriority(int pid) { |
- SandboxedProcessConnection connection = mServiceMap.get(pid); |
+ ChildProcessConnection connection = mServiceMap.get(pid); |
if (connection == null) { |
Log.w(TAG, "Tried to unbind non-existent connection to pid: " + pid); |
return; |
@@ -260,8 +260,8 @@ public class SandboxedProcessLauncher { |
/** |
* This implementation is used to receive callbacks from the remote service. |
*/ |
- private static ISandboxedProcessCallback createCallback() { |
- return new ISandboxedProcessCallback.Stub() { |
+ private static IChildProcessCallback createCallback() { |
+ return new IChildProcessCallback.Stub() { |
/** |
* This is called by the remote service regularly to tell us about |
* new values. Note that IPC calls are dispatched through a thread |
@@ -277,5 +277,5 @@ public class SandboxedProcessLauncher { |
}; |
}; |
- private static native void nativeOnSandboxedProcessStarted(int clientContext, int pid); |
+ private static native void nativeOnChildProcessStarted(int clientContext, int pid); |
} |