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

Unified Diff: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java

Issue 2199393002: Android: Make the spare renderer accessible to all Chrome tabs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments. Created 4 years, 4 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: chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
index 48bcfcf6290fb332c35f52e07806ffc7c6fa28d6..594f725d26974ff7825645b23c54206fa3d9a999 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/customtabs/CustomTabActivity.java
@@ -38,6 +38,7 @@ import org.chromium.chrome.browser.ChromeTabbedActivity;
import org.chromium.chrome.browser.IntentHandler;
import org.chromium.chrome.browser.IntentHandler.ExternalAppId;
import org.chromium.chrome.browser.KeyboardShortcuts;
+import org.chromium.chrome.browser.WarmupManager;
import org.chromium.chrome.browser.WebContentsFactory;
import org.chromium.chrome.browser.appmenu.AppMenuPropertiesDelegate;
import org.chromium.chrome.browser.compositor.layouts.LayoutManagerDocument;
@@ -92,10 +93,12 @@ public class CustomTabActivity extends ChromeActivity {
private boolean mHasCreatedTabEarly;
private boolean mIsInitialStart = true;
+ // Whether there is any prerender associated with the session.
private boolean mHasPrerender;
private CustomTabObserver mTabObserver;
private String mPrerenderedUrl;
+ // Whether a prerender is being used.
private boolean mHasPrerendered;
private static class PageLoadMetricsObserver implements PageLoadMetrics.Observer {
@@ -249,7 +252,8 @@ public class CustomTabActivity extends ChromeActivity {
@Override
public boolean shouldAllocateChildConnection() {
- return !mHasCreatedTabEarly && !mHasPrerender;
+ return !mHasCreatedTabEarly && !mHasPrerender
+ && !WarmupManager.getInstance().hasSpareWebContents();
}
@Override
@@ -411,7 +415,9 @@ public class CustomTabActivity extends ChromeActivity {
WebContents webContents =
customTabsConnection.takePrerenderedUrl(mSession, url, referrerUrl);
mHasPrerendered = webContents != null;
- if (webContents == null) webContents = customTabsConnection.takeSpareWebContents();
+ if (!mHasPrerendered) {
+ webContents = WarmupManager.getInstance().takeSpareWebContents(false, false);
+ }
if (webContents == null) webContents = WebContentsFactory.createWebContents(false, false);
tab.initialize(webContents, getTabContentManager(),
new CustomTabDelegateFactory(mIntentDataProvider.shouldEnableUrlBarHiding()), false,

Powered by Google App Engine
This is Rietveld 408576698