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

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

Issue 2557273004: android: Randomize initial child service bind order (Closed)
Patch Set: assertNotnull Created 4 years 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
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 4d58ca080f326b1454371c44c01de56e6ad3d701..b0c8feb632e44786a1098e44d795e48fd06b80be 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
@@ -34,6 +34,7 @@ import org.chromium.content.common.SurfaceWrapper;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collections;
import java.util.LinkedList;
import java.util.Map;
import java.util.Queue;
@@ -73,6 +74,12 @@ public class ChildProcessLauncher {
for (int i = 0; i < numChildServices; i++) {
mFreeConnectionIndices.add(i);
}
+ // Randomize the order of named child services to workaround this bug:
+ // Android restarts crashed services with the previous intent. If browser crashes and
+ // is restarted at the same time, then it's possible to bind to the restarted service
+ // with stale intent and bundle data. See crbug.com/664341#c84 for an example.
+ // Randomizing the start up order is a pure workaround to make this case less likely.
+ Collections.shuffle(mFreeConnectionIndices);
mChildClassName = serviceClassName;
mInSandbox = inSandbox;
}
« no previous file with comments | « no previous file | content/public/android/javatests/src/org/chromium/content/browser/ChildProcessLauncherTest.java » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698