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

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

Issue 2108163003: Fix dead-lock issue attempting to decode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@componentBuild
Patch Set: Add a TODO Created 4 years, 6 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 | « no previous file | 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/DecodingImageGenerator.cpp
diff --git a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
index 160ecd439c10e0ffc56a7cbc3f685abdacd469c0..bfe12625d9b40fd24892e7c195c3c23689a6a498 100644
--- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -54,7 +54,19 @@ SkData* DecodingImageGenerator::onRefEncodedData(GrContext* ctx)
{
TRACE_EVENT0("blink", "DecodingImageGenerator::refEncodedData");
- return m_allDataReceived ? m_data->getAsSkData().leakRef() : nullptr;
+ // The GPU only wants the data if it has all been received, since the GPU
+ // only wants a complete texture. getAsSkData() may require copying, so
+ // skip it and just return nullptr to avoid a slowdown. (See
+ // crbug.com/568016 for details about such a slowdown.)
+ // TODO (scroggo): Stop relying on the internal knowledge of how Skia uses
+ // this. skbug.com/5485
+ if (ctx && !m_allDataReceived)
+ return nullptr;
+
+ // Other clients are serializers, which want the data even if it requires
+ // copying, and even if the data is incomplete. (Otherwise they would
+ // potentially need to decode the partial image in order to re-encode it.)
+ return m_data->getAsSkData().leakRef();
}
bool DecodingImageGenerator::onGetPixels(const SkImageInfo& info, void* pixels, size_t rowBytes, SkPMColor table[], int* tableCount)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698