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..47b364085b7224e83851190fef6a29383f747f66 100644 |
| --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
| +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
| @@ -118,6 +118,18 @@ void BitmapImage::destroyDecodedData() |
| notifyMemoryChanged(); |
| } |
| +PassRefPtr<SharedBuffer> BitmapImage::data() |
| +{ |
| + if (PassRefPtr<SharedBuffer> data = cachedData()) |
|
haraken
2016/06/23 01:26:41
PassRefPtr<SharedBuffer> => RefPtr<SharedBuffer>
hajimehoshi
2016/06/23 09:23:12
Done.
|
| + return data; |
| + return m_source.data(); |
| +} |
| + |
| +PassRefPtr<SharedBuffer> BitmapImage::cachedData() |
| +{ |
| + return Image::data(); |
| +} |
| + |
| void BitmapImage::notifyMemoryChanged() |
| { |
| if (getImageObserver()) |
| @@ -218,8 +230,13 @@ 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); |
| + if (cachedData()) { |
| + m_source.setData(*cachedData(), allDataReceived); |
| + if (m_source.hasData()) { |
| + resetEncodedImageData(); |
|
haraken
2016/06/23 01:26:40
Add a comment and explain what this is doing and w
hajimehoshi
2016/06/23 09:23:13
Done.
|
| + DCHECK(!cachedData()); |
|
haraken
2016/06/23 01:26:40
Would it be clearer to rename cachedData to encode
hajimehoshi
2016/06/23 09:23:13
Hmm, I want to emphasize BitmapImage no longer has
|
| + } |
| + } |
| m_haveFrameCount = false; |
| return isSizeAvailable(); |