Chromium Code Reviews| Index: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
| diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
| index 17d815c5049c96f11bf0829b3427eecc716e092f..501c1d522a9f84ba0c94ff7b58e8ab5fb7a36b3e 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
| @@ -118,6 +118,11 @@ void BitmapImage::destroyDecodedData() |
| notifyMemoryChanged(); |
| } |
| +PassRefPtr<SharedBuffer> BitmapImage::data() |
| +{ |
| + return m_source.data(); |
| +} |
| + |
| void BitmapImage::notifyMemoryChanged() |
| { |
| if (getImageObserver()) |
| @@ -184,6 +189,19 @@ bool BitmapImage::getHotSpot(IntPoint& hotSpot) const |
| return m_source.getHotSpot(hotSpot); |
| } |
| +bool BitmapImage::setData(PassRefPtr<SharedBuffer> data, bool allDataReceived) |
| +{ |
| + m_temporaryEncodedImageData = data; |
|
f(malita)
2016/07/08 15:34:40
Do we need m_temporaryEncodedImageData at all? Lo
hajimehoshi
2016/07/11 06:15:07
Done.
f(malita)
2016/07/12 17:10:59
Thanks, LGTM!
|
| + if (!m_temporaryEncodedImageData.get()) |
| + return true; |
| + |
| + int length = m_temporaryEncodedImageData->size(); |
| + if (!length) |
| + return true; |
| + |
| + return dataChanged(allDataReceived); |
| +} |
| + |
| bool BitmapImage::dataChanged(bool allDataReceived) |
| { |
| TRACE_EVENT0("blink", "BitmapImage::dataChanged"); |
| @@ -218,8 +236,11 @@ bool BitmapImage::dataChanged(bool allDataReceived) |
| // Feed all the data we've seen so far to the image decoder. |
| m_allDataReceived = allDataReceived; |
| - ASSERT(data()); |
| - m_source.setData(*data(), allDataReceived); |
| + // |m_temporaryEncodedImageData| can be null only when testing. |
| + if (m_temporaryEncodedImageData) { |
| + m_source.setData(*m_temporaryEncodedImageData, allDataReceived); |
| + m_temporaryEncodedImageData.clear(); |
| + } |
| m_haveFrameCount = false; |
| return isSizeAvailable(); |