| Index: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| diff --git a/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java b/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| index 063b876645868ecf4f5ba248a1e3cbdd3b155910..97a533877d7a4f8109e5f39d3daecdf29438d528 100644
|
| --- a/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| +++ b/content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java
|
| @@ -59,7 +59,8 @@ public class ChildProcessServiceImpl {
|
| // Lock that protects the following members.
|
| private final Object mBinderLock = new Object();
|
| private IChildProcessCallback mCallback;
|
| - // PID of the client of this service, set in bindToCaller().
|
| + private boolean mBindToCallerCheck;
|
| + // PID of the client of this service, set in bindToCaller(), if mBindToCallerCheck is true.
|
| private int mBoundCallingPid;
|
|
|
| // This is the native "Main" thread for the renderer / utility process.
|
| @@ -110,6 +111,7 @@ public class ChildProcessServiceImpl {
|
| // NOTE: Implement any IChildProcessService methods here.
|
| @Override
|
| public boolean bindToCaller() {
|
| + assert mBindToCallerCheck;
|
| synchronized (mBinderLock) {
|
| int callingPid = Binder.getCallingPid();
|
| if (mBoundCallingPid == 0) {
|
| @@ -127,7 +129,7 @@ public class ChildProcessServiceImpl {
|
| public int setupConnection(Bundle args, IChildProcessCallback callback) {
|
| int callingPid = Binder.getCallingPid();
|
| synchronized (mBinderLock) {
|
| - if (mBoundCallingPid != callingPid) {
|
| + if (mBindToCallerCheck && mBoundCallingPid != callingPid) {
|
| if (mBoundCallingPid == 0) {
|
| Log.e(TAG, "Service has not been bound with bindToCaller()");
|
| } else {
|
| @@ -136,11 +138,10 @@ public class ChildProcessServiceImpl {
|
| }
|
| return -1;
|
| }
|
| -
|
| - mCallback = callback;
|
| - getServiceInfo(args);
|
| - return Process.myPid();
|
| }
|
| + mCallback = callback;
|
| + getServiceInfo(args);
|
| + return Process.myPid();
|
| }
|
|
|
| @Override
|
| @@ -340,6 +341,10 @@ public class ChildProcessServiceImpl {
|
| mLibraryProcessType = ChildProcessCreationParams.getLibraryProcessType(intent);
|
| mMainThread.notifyAll();
|
| }
|
| + synchronized (mBinderLock) {
|
| + mBindToCallerCheck =
|
| + intent.getBooleanExtra(ChildProcessConstants.EXTRA_BIND_TO_CALLER, false);
|
| + }
|
| }
|
|
|
| private void getServiceInfo(Bundle bundle) {
|
|
|