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

Unified Diff: base/test/android/java/src/org/chromium/base/MultiprocessTestClientService.java

Issue 2735113003: Changing SpawnChild to return a struct.
Patch Set: Created 3 years, 9 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
Index: base/test/android/java/src/org/chromium/base/MultiprocessTestClientService.java
diff --git a/base/test/android/java/src/org/chromium/base/MultiprocessTestClientService.java b/base/test/android/java/src/org/chromium/base/MultiprocessTestClientService.java
index c786438ceda23bdf7915934b868596265e5a04da..89f3a754d23394e6e1e8e7f08a9537be340e6a9e 100644
--- a/base/test/android/java/src/org/chromium/base/MultiprocessTestClientService.java
+++ b/base/test/android/java/src/org/chromium/base/MultiprocessTestClientService.java
@@ -30,12 +30,21 @@ public class MultiprocessTestClientService extends Service {
private final Object mResultLock = new Object();
+ // These values must be kept in sync with the ones in mojo/edk/embedder/embedder.cc
+ private static final int PARCELABLE_CHANNEL_CLIENT_ID = 1;
+ private static final int PARCELABLE_CHANNEL_SERVER_ID = 2;
+
@GuardedBy("mResultLock")
private MainReturnCodeResult mResult;
+ private final ParcelableChannelServer mParcelableChannelServer =
+ new ParcelableChannelServer("CHILD CHANNEL");
+ private ParcelableChannelClient mParcelableChannelClient;
+
private final ITestClient.Stub mBinder = new ITestClient.Stub() {
@Override
- public int launch(final String[] commandLine, FileDescriptorInfo[] fdsToMap) {
+ public IParcelableChannel launch(final String[] commandLine, FileDescriptorInfo[] fdsToMap,
+ IParcelableChannel parcelableChannel, int[] pid) {
final int[] fdKeys = new int[fdsToMap.length];
final int[] fdFds = new int[fdsToMap.length];
for (int i = 0; i < fdsToMap.length; i++) {
@@ -44,16 +53,28 @@ public class MultiprocessTestClientService extends Service {
// instances. Native code will own them.
fdFds[i] = fdsToMap[i].fd.detachFd();
}
+
+ mParcelableChannelClient = new ParcelableChannelClient(parcelableChannel);
+ final int[] globalObjectKeys = new int[2];
+ final Object[] globalObjectObjects = new Object[2];
+ globalObjectKeys[0] = PARCELABLE_CHANNEL_CLIENT_ID;
+ globalObjectObjects[0] = mParcelableChannelClient;
+ globalObjectKeys[1] = PARCELABLE_CHANNEL_SERVER_ID;
+ globalObjectObjects[1] = mParcelableChannelServer;
+
// Don't run main directly, it would block and the response would not be returned.
// We post to the main thread as this thread does not have a Looper.
mHandler.post(new Runnable() {
@Override
public void run() {
- int result = MainRunner.runMain(commandLine, fdKeys, fdFds);
+ int result = MainRunner.runMain(
+ commandLine, fdKeys, fdFds, globalObjectKeys, globalObjectObjects);
setMainReturnValue(result);
}
});
- return Process.myPid();
+
+ pid[0] = Process.myPid();
+ return mParcelableChannelServer;
}
@SuppressFBWarnings("RCN_REDUNDANT_NULLCHECK_OF_NULL_VALUE")
« no previous file with comments | « base/test/android/java/src/org/chromium/base/MultiprocessTestClientLauncher.java ('k') | base/test/android/jni_test_util.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698