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

Unified Diff: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp

Issue 2192493003: Enable GPU acceleration in 2D OffscreenCanvases on main thread (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix dev tools failure 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: third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
diff --git a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
index e5c53023e278cb7e184deca631af9ea78433224e..bbde9b71a312b67966cf16c7235b98277353ed8a 100644
--- a/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
+++ b/third_party/WebKit/Source/core/html/HTMLCanvasElement.cpp
@@ -766,8 +766,13 @@ bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const
if (RuntimeEnabledFeatures::forceDisplayList2dCanvasEnabled())
return false;
- Settings* settings = document().settings();
- if (!settings || !settings->accelerated2dCanvasEnabled())
+ if (!RuntimeEnabledFeatures::accelerated2dCanvasEnabled())
+ return false;
+
+ // The following is necessary for handling the special case of canvases in the
+ // dev tools overlay, which run in a process that supports accelerated 2d canvas
+ // but in a special compositing context that does not.
+ if (layoutBox() && !layoutBox()->hasAcceleratedCompositing())
return false;
int canvasPixelCount = size.width() * size.height();
@@ -788,7 +793,8 @@ bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const
}
// Do not use acceleration for small canvas.
- if (canvasPixelCount < settings->minimumAccelerated2dCanvasSize())
+ Settings* settings = document().settings();
+ if (!settings || canvasPixelCount < settings->minimumAccelerated2dCanvasSize())
return false;
if (!Platform::current()->canAccelerate2dCanvas())

Powered by Google App Engine
This is Rietveld 408576698