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(); |