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

Unified Diff: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp

Issue 2714103002: Revert of Make disabling 2d canvas GPU acceleration for getImageData less aggressive. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageBuffer.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
index b1e788dadf5f83019e5716a571d01107c87b4678..2e38b192ed37b338fecca618ef940f34a33e00fa 100644
--- a/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
+++ b/third_party/WebKit/Source/platform/graphics/ImageBuffer.cpp
@@ -99,8 +99,6 @@
m_snapshotState(InitialSnapshotState),
m_surface(std::move(surface)),
m_client(0),
- m_gpuReadbackInvokedInCurrentFrame(false),
- m_gpuReadbackSuccessiveFrames(0),
m_gpuMemoryUsage(0) {
m_surface->setImageBuffer(this);
updateGPUMemoryUsage();
@@ -151,22 +149,6 @@
}
void ImageBuffer::finalizeFrame() {
- if (isAccelerated() &&
- ExpensiveCanvasHeuristicParameters::GPUReadbackForcesNoAcceleration &&
- !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled()) {
- if (m_gpuReadbackInvokedInCurrentFrame) {
- m_gpuReadbackSuccessiveFrames++;
- m_gpuReadbackInvokedInCurrentFrame = false;
- } else {
- m_gpuReadbackSuccessiveFrames = 0;
- }
-
- if (m_gpuReadbackSuccessiveFrames >=
- ExpensiveCanvasHeuristicParameters::GPUReadbackMinSuccessiveFrames) {
- disableAcceleration();
- }
- }
-
m_surface->finalizeFrame();
}
@@ -376,6 +358,11 @@
}
DCHECK(canvas());
+
+ if (ExpensiveCanvasHeuristicParameters::GetImageDataForcesNoAcceleration &&
+ !RuntimeEnabledFeatures::canvas2dFixedRenderingModeEnabled()) {
+ const_cast<ImageBuffer*>(this)->disableAcceleration();
+ }
sk_sp<SkImage> snapshot = m_surface->newImageSnapshot(
PreferNoAcceleration, SnapshotReasonGetImageData);
@@ -422,7 +409,6 @@
snapshot->readPixels(info, result.data(), bytesPerPixel * rect.width(),
rect.x(), rect.y());
- m_gpuReadbackInvokedInCurrentFrame = true;
if (useF16Workaround) {
uint32_t* pixel = (uint32_t*)result.data();
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/ImageBuffer.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698