Chromium Code Reviews| Index: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp |
| diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp |
| index bf46ddc90833f8c0fe7fa1b33465bbf42a2a3daf..fa0051211b03ce8da25d28a77227366c1c61a8bd 100644 |
| --- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp |
| +++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp |
| @@ -27,6 +27,7 @@ |
| #include <limits> |
| #include "platform/image-decoders/gif/GIFImageReader.h" |
| +#include "public/platform/Platform.h" |
| #include "wtf/NotFound.h" |
| #include "wtf/PassOwnPtr.h" |
| @@ -34,7 +35,7 @@ namespace blink { |
| GIFImageDecoder::GIFImageDecoder(AlphaOption alphaOption, GammaAndColorProfileOption colorOptions, size_t maxDecodedBytes) |
| : ImageDecoder(alphaOption, colorOptions, maxDecodedBytes) |
| - , m_repetitionCount(cAnimationLoopOnce) |
| + , m_repetitionCount(cAnimationLoopOnce), m_sizeOffset(0), m_sizeOffsetOptimized(0) |
| { |
| } |
| @@ -178,6 +179,16 @@ bool GIFImageDecoder::parseCompleted() const |
| return m_reader && m_reader->parseCompleted(); |
| } |
| +void GIFImageDecoder::setSizeOffset(size_t sizeOffset) |
| +{ |
| + m_sizeOffset = sizeOffset; |
| +} |
| + |
| +void GIFImageDecoder::setSizeOffsetOptimized(size_t sizeOffsetOptimized) |
| +{ |
| + m_sizeOffsetOptimized = sizeOffsetOptimized; |
| +} |
| + |
| bool GIFImageDecoder::frameComplete(size_t frameIndex) |
| { |
| // Initialize the frame if necessary. Some GIFs insert do-nothing frames, |
| @@ -321,8 +332,14 @@ void GIFImageDecoder::decode(size_t index) |
| // It is also a fatal error if all data is received and we have decoded all |
| // frames available but the file is truncated. |
| - if (index >= m_frameBufferCache.size() - 1 && isAllDataReceived() && m_reader && !m_reader->parseCompleted()) |
| + if (index >= m_frameBufferCache.size() - 1 && isAllDataReceived() && m_reader && !m_reader->parseCompleted()) { |
| setFailed(); |
| + return; |
| + } |
| + Platform::current()->histogramCustomCounts( |
| + "Blink.Images.SizeOffsetOptimized_GIF", m_sizeOffsetOptimized, 1, 1000000, 50); |
|
Alexei Svitkine (slow)
2016/02/01 20:51:11
If you prefer, you can use . instead of _ and spec
|
| + Platform::current()->histogramCustomCounts( |
| + "Blink.Images.SizeOffset_GIF", m_sizeOffset, 1, 1000000, 50); |
| } |
| void GIFImageDecoder::parse(GIFParseQuery query) |