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