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

Unified Diff: content/public/android/java/src/org/chromium/content/browser/ChildProcessConnectionImpl.java

Issue 2650013003: Bind Android ChildProcessServices to a specific client PID. (Closed)
Patch Set: Created 3 years, 11 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: 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.

Powered by Google App Engine
This is Rietveld 408576698