Commit 2d0bf9ec authored by Aaron Krajeski's avatar Aaron Krajeski Committed by Commit Bot

Add experiment for accelerating all canvases in webview

It used to be the case that all small canvases were rendered in software.
This was changed to improve performance, simplify code and improve
testing. Unfortunately it caused a ton of crashes for webview devices.
crbug.com/994310

A kludge was introduced to prevent these crashes for webview devices
only: https://chromium-review.googlesource.com/c/chromium/src/+/1800346

Now that more than a year has gone by and there's been a lot of movement
in all the relevant codebases (skia, webview, canvas, oop-r, etc.) it's
worth seeing if this spike in crashes still happens. To remove this
kludge would allow us to finally clear up the code path and greatly
simplify testing.

Bug: 1136603
Change-Id: Idca3844ee13f064adf8043ebcdc43808c6588f24
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2463328
Commit-Queue: Aaron Krajeski <aaronhk@chromium.org>
Reviewed-by: default avatarBo <boliu@chromium.org>
Reviewed-by: default avatarFernando Serboncini <fserb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#817977}
parent b456da4d
...@@ -96,5 +96,7 @@ public final class ProductionSupportedFlagList { ...@@ -96,5 +96,7 @@ public final class ProductionSupportedFlagList {
"Enables display cutout (notch) support in WebView for Android P and above."), "Enables display cutout (notch) support in WebView for Android P and above."),
Flag.commandLine(AwSwitches.WEBVIEW_FORCE_LITTLE_CORES, Flag.commandLine(AwSwitches.WEBVIEW_FORCE_LITTLE_CORES,
"Forces WebView to do rendering work in little cores"), "Forces WebView to do rendering work in little cores"),
Flag.baseFeature(BlinkFeatures.WEBVIEW_ACCELERATE_SMALL_CANVASES,
"Accelerate all canvases in webview."),
}; };
} }
...@@ -521,6 +521,10 @@ const base::Feature kLowLatencyWebGLSwapChain{"LowLatencyWebGLSwapChain", ...@@ -521,6 +521,10 @@ const base::Feature kLowLatencyWebGLSwapChain{"LowLatencyWebGLSwapChain",
const base::Feature kDawn2dCanvas{"Dawn2dCanvas", const base::Feature kDawn2dCanvas{"Dawn2dCanvas",
base::FEATURE_DISABLED_BY_DEFAULT}; base::FEATURE_DISABLED_BY_DEFAULT};
// Enables small accelerated canvases for webview (crbug.com/1004304)
const base::Feature kWebviewAccelerateSmallCanvases{
"WebviewAccelerateSmallCanvases", base::FEATURE_DISABLED_BY_DEFAULT};
const base::Feature kCSSReducedFontLoadingLayoutInvalidations{ const base::Feature kCSSReducedFontLoadingLayoutInvalidations{
"CSSReducedFontLoadingLayoutInvalidations", "CSSReducedFontLoadingLayoutInvalidations",
base::FEATURE_ENABLED_BY_DEFAULT}; base::FEATURE_ENABLED_BY_DEFAULT};
......
...@@ -158,6 +158,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kLowLatencyWebGLSwapChain; ...@@ -158,6 +158,8 @@ BLINK_COMMON_EXPORT extern const base::Feature kLowLatencyWebGLSwapChain;
BLINK_COMMON_EXPORT extern const base::Feature kDawn2dCanvas; BLINK_COMMON_EXPORT extern const base::Feature kDawn2dCanvas;
BLINK_COMMON_EXPORT extern const base::Feature kWebviewAccelerateSmallCanvases;
BLINK_COMMON_EXPORT extern const base::Feature BLINK_COMMON_EXPORT extern const base::Feature
kCSSReducedFontLoadingLayoutInvalidations; kCSSReducedFontLoadingLayoutInvalidations;
......
...@@ -1136,8 +1136,11 @@ bool HTMLCanvasElement::ShouldAccelerate() const { ...@@ -1136,8 +1136,11 @@ bool HTMLCanvasElement::ShouldAccelerate() const {
return false; return false;
} }
// Webview crashes with accelerated small canvases TODO(crbug.com/1004304) // Webview crashes with accelerated small canvases (crbug.com/1004304)
if (!RuntimeEnabledFeatures::AcceleratedSmallCanvasesEnabled()) { // Experimenting to see if this still causes crashes (crbug.com/1136603)
if (!RuntimeEnabledFeatures::AcceleratedSmallCanvasesEnabled() &&
!base::FeatureList::IsEnabled(
features::kWebviewAccelerateSmallCanvases)) {
base::CheckedNumeric<int> checked_canvas_pixel_count = base::CheckedNumeric<int> checked_canvas_pixel_count =
Size().Width() * Size().Height(); Size().Width() * Size().Height();
if (!checked_canvas_pixel_count.IsValid()) if (!checked_canvas_pixel_count.IsValid())
......
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