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

Unified Diff: content/public/android/java/src/org/chromium/content/app/ChildProcessServiceImpl.java

Issue 2796453003: android: Limit bindToCaller check to webview (Closed)
Patch Set: rebase, removed final from chrome Created 3 years, 8 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/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 bdc45088a95564f670104e1f24e18f94b6c4fa2c..e74e97f00e19285c5acc92d0db208924c1010b2f 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 IGpuProcessCallback mGpuCallback;
- // 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, IBinder 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,12 +138,11 @@ public class ChildProcessServiceImpl {
}
return -1;
}
-
- mGpuCallback =
- callback != null ? IGpuProcessCallback.Stub.asInterface(callback) : null;
- getServiceInfo(args);
- return Process.myPid();
}
+
+ mGpuCallback = callback != null ? IGpuProcessCallback.Stub.asInterface(callback) : null;
+ getServiceInfo(args);
+ return Process.myPid();
}
@Override
@@ -341,6 +342,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) {

Powered by Google App Engine
This is Rietveld 408576698