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

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

Issue 889013002: Android: Add strong binding for GPU process (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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/ChildProcessLauncher.java
diff --git a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
index 9234b594dfce7c1cf06de8880c8b37daa6f61657..eae1698e3363a4e38e8cade7ff987bec1a9a5139 100644
--- a/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
+++ b/content/public/android/java/src/org/chromium/content/browser/ChildProcessLauncher.java
@@ -74,7 +74,8 @@ public class ChildProcessLauncher {
public ChildProcessConnection allocate(
Context context, ChildProcessConnection.DeathCallback deathCallback,
- ChromiumLinkerParams chromiumLinkerParams) {
+ ChromiumLinkerParams chromiumLinkerParams,
+ boolean alwaysInForeground) {
synchronized (mConnectionLock) {
if (mFreeConnectionIndices.isEmpty()) {
Log.d(TAG, "Ran out of services to allocate.");
@@ -83,7 +84,8 @@ public class ChildProcessLauncher {
int slot = mFreeConnectionIndices.remove(0);
assert mChildProcessConnections[slot] == null;
mChildProcessConnections[slot] = new ChildProcessConnectionImpl(context, slot,
- mInSandbox, deathCallback, mChildClass, chromiumLinkerParams);
+ mInSandbox, deathCallback, mChildClass, chromiumLinkerParams,
+ alwaysInForeground);
Log.d(TAG, "Allocator allocated a connection, sandbox: " + mInSandbox
+ ", slot: " + slot);
return mChildProcessConnections[slot];
@@ -245,8 +247,8 @@ public class ChildProcessLauncher {
? sSandboxedChildConnectionAllocator : sPrivilegedChildConnectionAllocator;
}
- private static ChildProcessConnection allocateConnection(Context context,
- boolean inSandbox, ChromiumLinkerParams chromiumLinkerParams) {
+ private static ChildProcessConnection allocateConnection(Context context, boolean inSandbox,
+ ChromiumLinkerParams chromiumLinkerParams, boolean alwaysInForeground) {
ChildProcessConnection.DeathCallback deathCallback =
new ChildProcessConnection.DeathCallback() {
@Override
@@ -260,7 +262,7 @@ public class ChildProcessLauncher {
};
initConnectionAllocatorsIfNecessary(context);
return getConnectionAllocator(inSandbox).allocate(context, deathCallback,
- chromiumLinkerParams);
+ chromiumLinkerParams, alwaysInForeground);
}
private static boolean sLinkerInitialized = false;
@@ -288,10 +290,10 @@ public class ChildProcessLauncher {
}
private static ChildProcessConnection allocateBoundConnection(Context context,
- String[] commandLine, boolean inSandbox) {
+ String[] commandLine, boolean inSandbox, boolean alwaysInForeground) {
ChromiumLinkerParams chromiumLinkerParams = getLinkerParamsForNewConnection();
ChildProcessConnection connection =
- allocateConnection(context, inSandbox, chromiumLinkerParams);
+ allocateConnection(context, inSandbox, chromiumLinkerParams, alwaysInForeground);
if (connection != null) {
connection.start(commandLine);
}
@@ -451,7 +453,7 @@ public class ChildProcessLauncher {
synchronized (ChildProcessLauncher.class) {
assert !ThreadUtils.runningOnUiThread();
if (sSpareSandboxedConnection == null) {
- sSpareSandboxedConnection = allocateBoundConnection(context, null, true);
+ sSpareSandboxedConnection = allocateBoundConnection(context, null, true, false);
}
}
}
@@ -539,7 +541,10 @@ public class ChildProcessLauncher {
}
}
if (allocatedConnection == null) {
- allocatedConnection = allocateBoundConnection(context, commandLine, inSandbox);
+ boolean alwaysInForeground = false;
+ if (callbackType == CALLBACK_FOR_GPU_PROCESS) alwaysInForeground = true;
+ allocatedConnection = allocateBoundConnection(
+ context, commandLine, inSandbox, alwaysInForeground);
if (allocatedConnection == null) {
Log.d(TAG, "Allocation of new service failed. Queuing up pending spawn.");
sPendingSpawnQueue.enqueue(new PendingSpawnData(context, commandLine,
@@ -697,7 +702,7 @@ public class ChildProcessLauncher {
@VisibleForTesting
static ChildProcessConnection allocateBoundConnectionForTesting(Context context) {
- return allocateBoundConnection(context, null, true);
+ return allocateBoundConnection(context, null, true, false);
}
/**

Powered by Google App Engine
This is Rietveld 408576698