summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorzbowling <zbowling@chromium.org>2015-06-23 15:11:09 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-23 22:11:52 +0000
commit4f3fde9522466af7d678eebe9f6a0a1356a0326e (patch)
tree794ccb235b05a7456f53eb4270a5ba8b576b363b
parentfd7f4646661ae21fce8658b0a39b9ffe9616b897 (diff)
downloadchromium_src-4f3fde9522466af7d678eebe9f6a0a1356a0326e.zip
chromium_src-4f3fde9522466af7d678eebe9f6a0a1356a0326e.tar.gz
chromium_src-4f3fde9522466af7d678eebe9f6a0a1356a0326e.tar.bz2
Disable domain reliability on low-mem Android
Domain reliability uses 400k+ of memory on the heap. Disabling it until it's refactored when running on low memory devices. BUG=495342 Review URL: https://codereview.chromium.org/1203573002 Cr-Commit-Position: refs/heads/master@{#335767}
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java6
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java11
-rw-r--r--chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java16
3 files changed, 33 insertions, 0 deletions
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java b/chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java
index d307ecc..064c03b 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/ChromeSwitches.java
@@ -156,6 +156,12 @@ public abstract class ChromeSwitches {
*/
public static final String ENABLE_READER_MODE_BUTTON = "enable-reader-mode-toolbar-icon";
+ /**
+ * Disable domain reliability
+ * Native switch - switches::kDisableDomainReliability
+ */
+ public static final String DISABLE_DOMAIN_RELIABILITY = "disable-domain-reliability";
+
// Prevent instantiation.
private ChromeSwitches() {}
}
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java b/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java
index 0782840..81fad7e 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/device/DeviceClassManager.java
@@ -31,6 +31,8 @@ public class DeviceClassManager {
private boolean mEnableToolbarSwipe;
private boolean mEnableToolbarSwipeInDocumentMode;
private boolean mEnableUndo;
+ private boolean mDisableDomainReliability;
+
private final boolean mEnableFullscreen;
private static DeviceClassManager getInstance() {
@@ -54,6 +56,7 @@ public class DeviceClassManager {
mEnablePrerendering = false;
mEnableToolbarSwipe = false;
mEnableInstantSearchClicks = false;
+ mDisableDomainReliability = true;
} else {
mEnableSnapshots = true;
mEnableLayerDecorationCache = true;
@@ -62,6 +65,7 @@ public class DeviceClassManager {
mEnablePrerendering = true;
mEnableToolbarSwipe = true;
mEnableInstantSearchClicks = true;
+ mDisableDomainReliability = false;
}
if (DeviceFormFactor.isTablet(ApplicationStatus.getApplicationContext())) {
@@ -154,6 +158,13 @@ public class DeviceClassManager {
return getInstance().mEnableUndo || isAccessibilityModeEnabled(context);
}
+ /**
+ * @return Whether or not to disable domain reliability.
+ */
+ public static boolean disableDomainReliability() {
+ return getInstance().mDisableDomainReliability;
+ }
+
public static boolean isAccessibilityModeEnabled(Context context) {
TraceEvent.begin("DeviceClassManager::isAccessibilityModeEnabled");
AccessibilityManager manager = (AccessibilityManager)
diff --git a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
index 07cca22..c85204a 100644
--- a/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
+++ b/chrome/android/java/src/org/chromium/chrome/browser/init/ChromeBrowserInitializer.java
@@ -22,6 +22,7 @@ import org.chromium.base.library_loader.ProcessInitException;
import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.ChromiumApplication;
import org.chromium.chrome.browser.FileProviderHelper;
+import org.chromium.chrome.browser.device.DeviceClassManager;
import org.chromium.content.app.ContentApplication;
import org.chromium.content.browser.BrowserStartupController;
import org.chromium.content.browser.DeviceUtils;
@@ -82,11 +83,26 @@ public class ChromeBrowserInitializer {
public void handlePreNativeStartup(final BrowserParts parts) {
preInflationStartup();
parts.preInflationStartup();
+ preInflationStatupDone();
parts.setContentViewAndLoadLibrary();
postInflationStartup();
parts.postInflationStartup();
}
+ /**
+ * This is needed for device class manager which depends on commandline args that are
+ * initialized in preInflationStartup()
+ */
+ private void preInflationStatupDone() {
+ // Domain reliability uses significant enough memory that we should disable it on low memory
+ // devices for now.
+ // TODO(zbowling): remove this after domain reliability is refactored. (crbug.com/495342)
+ if (DeviceClassManager.disableDomainReliability()) {
+ CommandLine.getInstance().appendSwitch(ChromeSwitches.DISABLE_DOMAIN_RELIABILITY);
+ }
+ }
+
+
private void preInflationStartup() {
ThreadUtils.assertOnUiThread();
if (mPreInflationStartupComplete) return;