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

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

Issue 1146813010: Introduce moderate binding (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add "Tab.TotalTabCountBeforeLeavingApp" histogram Created 5 years, 6 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 e134d3625d3ab16879dfe1c59ed732eb93b97a4f..51441a5fbea9cfd541f0ff8dc5b3037a3ddab6d8 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
@@ -12,9 +12,9 @@ import android.os.Bundle;
import android.os.DeadObjectException;
import android.os.IBinder;
import android.os.RemoteException;
-import android.util.Log;
import org.chromium.base.CpuFeatures;
+import org.chromium.base.Log;
import org.chromium.base.ThreadUtils;
import org.chromium.base.TraceEvent;
import org.chromium.base.VisibleForTesting;
@@ -63,6 +63,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
private ChildServiceConnection mWaivedBinding = null;
// Incremented on addStrongBinding(), decremented on removeStrongBinding().
private int mStrongBindingCount = 0;
+ private ChildServiceConnection mModerateBinding = null;
Yaron 2015/06/11 16:54:35 Add comment
Jaekyun Seok (inactive) 2015/06/12 06:50:20 Done.
// Linker-related parameters.
private ChromiumLinkerParams mLinkerParams = null;
@@ -212,6 +213,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
Context.BIND_AUTO_CREATE | Context.BIND_IMPORTANT);
mWaivedBinding = new ChildServiceConnection(
Context.BIND_AUTO_CREATE | Context.BIND_WAIVE_PRIORITY);
+ mModerateBinding = new ChildServiceConnection(Context.BIND_AUTO_CREATE);
}
@Override
@@ -297,6 +299,7 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
mInitialBinding.unbind();
mStrongBinding.unbind();
mWaivedBinding.unbind();
+ mModerateBinding.unbind();
mStrongBindingCount = 0;
if (mService != null) {
mService = null;
@@ -398,6 +401,8 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
mStrongBindingCount = 0;
mStrongBinding.unbind();
+
+ mModerateBinding.unbind();
}
}
@@ -430,6 +435,35 @@ public class ChildProcessConnectionImpl implements ChildProcessConnection {
}
}
+ @Override
+ public boolean isModerateBindingBound() {
+ synchronized (mLock) {
+ return mModerateBinding.isBound();
+ }
+ }
+
+ @Override
+ public void addModerateBinding() {
+ synchronized (mLock) {
+ if (mService == null) {
+ Log.w(TAG, "The connection is not bound for " + mPid);
+ return;
+ }
+ mModerateBinding.bind(null);
+ }
+ }
+
+ @Override
+ public void removeModerateBinding() {
+ synchronized (mLock) {
+ if (mService == null) {
+ Log.w(TAG, "The connection is not bound for " + mPid);
+ return;
+ }
+ mModerateBinding.unbind();
+ }
+ }
+
@VisibleForTesting
public boolean crashServiceForTesting() throws RemoteException {
try {

Powered by Google App Engine
This is Rietveld 408576698