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

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: 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..584125a61481f4410339c05572a29e8b920500d1 100644
--- a/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
+++ b/third_party/WebKit/Source/platform/graphics/DecodingImageGenerator.cpp
@@ -54,7 +54,17 @@ 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.)
f(malita) 2016/06/29 17:38:37 It seems a bit fragile to tweak this implementatio
reed1 2016/06/29 17:57:45 agreed, seems fragile. Can you imagine other ways
scroggo_chromium 2016/06/29 19:21:21 Tracking with a bug: skbug.com/5485
scroggo_chromium 2016/06/29 19:21:21 Agreed. Added a TODO.
+ 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