Chromium Code Reviews| 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..5010f283f31454e5fcd2d2fac589dcd4fd5c9c53 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,22 @@ 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) { |
| + } finally { |
|
Torne
2017/01/16 12:44:43
Unless there's another exception type that can hap
Robert Sesek
2017/01/17 19:51:22
Done.
|
| + 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 +308,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 +316,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. |