| 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 2f3b925fa0913a5cab7cee801239036ab77c9431..947e48343529fe5407e5313a48e0ef66bd540bd5 100644
|
| --- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
|
| +++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp
|
| @@ -117,6 +117,18 @@ void BitmapImage::destroyDecodedData()
|
| notifyMemoryChanged();
|
| }
|
|
|
| +PassRefPtr<SharedBuffer> BitmapImage::data()
|
| +{
|
| + if (SharedBuffer* data = cachedData())
|
| + return data;
|
| + return m_source.data();
|
| +}
|
| +
|
| +SharedBuffer* BitmapImage::cachedData()
|
| +{
|
| + return Image::data().get();
|
| +}
|
| +
|
| void BitmapImage::notifyMemoryChanged()
|
| {
|
| if (getImageObserver())
|
| @@ -217,8 +229,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();
|
| + DCHECK(!cachedData());
|
| + }
|
| + }
|
|
|
| m_haveFrameCount = false;
|
| return isSizeAvailable();
|
|
|