Index: content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java |
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java |
index 9dac1747ef0d8ae6699866d8951d99f0b13f6514..d15a9ca287ab1eb57adadfe31470e04a34e132a5 100644 |
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java |
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java |
@@ -97,6 +97,9 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection { |
} |
} |
+ // This is set in start() and is used in onServiceConnected(). |
+ private ChildProcessConnection.StartCallback mStartCallback; |
+ |
// This is set in setupConnection() and is later used in doConnectionSetupLocked(), after which |
// the variable is cleared. Therefore this is only valid while the connection is being set up. |
private ConnectionParams mConnectionParams; |
@@ -168,6 +171,21 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection { |
"ChildProcessConnectionImpl.ChildServiceConnection.onServiceConnected"); |
mServiceConnectComplete = true; |
mService = IChildProcessService.Stub.asInterface(service); |
+ |
+ boolean boundToUs = false; |
+ try { |
+ boundToUs = mService.bindToCaller(); |
+ } catch (RemoteException ex) { |
+ } |
+ if (!boundToUs) { |
+ if (mStartCallback != null) { |
+ mStartCallback.onChildStartFailed(); |
+ } |
+ return; |
+ } else if (mStartCallback != null) { |
+ mStartCallback.onChildStarted(); |
+ } |
+ |
// Run the setup if the connection parameters have already been provided. If |
// not, doConnectionSetupLocked() will be called from setupConnection(). |
if (mConnectionParams != null) { |
@@ -289,7 +307,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection { |
} |
@Override |
- public void start(String[] commandLine) { |
+ public void start(String[] commandLine, ChildProcessConnection.StartCallback startCallback) { |
try { |
TraceEvent.begin("ChildProcessConnectionImpl.start"); |
synchronized (mLock) { |
@@ -297,6 +315,8 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection { |
assert mConnectionParams == null : |
"setupConnection() called before start() in ChildProcessConnectionImpl."; |
+ mStartCallback = startCallback; |
+ |
if (!mInitialBinding.bind(commandLine)) { |
Log.e(TAG, "Failed to establish the service connection."); |
// We have to notify the caller so that they can free-up associated resources. |