Chromium Code Reviews| 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) |