Commit bc6463c6 authored by Wei-Yin Chen (陳威尹)'s avatar Wei-Yin Chen (陳威尹) Committed by Commit Bot

Reduce capacity of thumbnail cache when GridTabSwitcher is used

With Grid Tab Switcher, the only users of thumbnail cache are
StaticLayout and ToolbarSwipeLayout. To avoid visible degradation,
StaticLayout needs the cache size to be at least 1, and
ToolbarSwipeLayout needs 2.

Bug: 959054
Change-Id: I8f9bfd376e7b52bb61165b33b201cec09397a44e
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1594427
Commit-Queue: Wei-Yin Chen (陳威尹) <wychen@chromium.org>
Reviewed-by: default avatarYusuf Ozuysal <yusufo@chromium.org>
Reviewed-by: default avatarMatthew Jones <mdjones@chromium.org>
Cr-Commit-Position: refs/heads/master@{#659760}
parent c6707330
...@@ -22,6 +22,7 @@ import org.chromium.chrome.R; ...@@ -22,6 +22,7 @@ import org.chromium.chrome.R;
import org.chromium.chrome.browser.ChromeSwitches; import org.chromium.chrome.browser.ChromeSwitches;
import org.chromium.chrome.browser.native_page.NativePage; import org.chromium.chrome.browser.native_page.NativePage;
import org.chromium.chrome.browser.tab.Tab; import org.chromium.chrome.browser.tab.Tab;
import org.chromium.chrome.browser.util.FeatureUtilities;
import org.chromium.ui.base.DeviceFormFactor; import org.chromium.ui.base.DeviceFormFactor;
import org.chromium.ui.display.DisplayAndroid; import org.chromium.ui.display.DisplayAndroid;
...@@ -64,7 +65,18 @@ public class TabContentManager { ...@@ -64,7 +65,18 @@ public class TabContentManager {
*/ */
private static int getIntegerResourceWithOverride(Context context, int resourceId, private static int getIntegerResourceWithOverride(Context context, int resourceId,
String commandLineSwitch) { String commandLineSwitch) {
int val = context.getResources().getInteger(resourceId); int val = -1;
// TODO(crbug/959054): Convert this to Finch config.
if (FeatureUtilities.isGridTabSwitcherEnabled()
|| FeatureUtilities.isTabGroupsAndroidEnabled()) {
// With Grid Tab Switcher, we can greatly reduce the capacity of thumbnail cache.
// See crbug.com/959054 for more details.
if (resourceId == R.integer.default_thumbnail_cache_size) val = 2;
if (resourceId == R.integer.default_approximation_thumbnail_cache_size) val = 8;
assert val != -1;
} else {
val = context.getResources().getInteger(resourceId);
}
String switchCount = CommandLine.getInstance().getSwitchValue(commandLineSwitch); String switchCount = CommandLine.getInstance().getSwitchValue(commandLineSwitch);
if (switchCount != null) { if (switchCount != null) {
int count = Integer.parseInt(switchCount); int count = Integer.parseInt(switchCount);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment