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..2664b5bc20938b063dc73568382a1c317958726c 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() |
|
hiroshige
2016/06/29 07:04:06
The name data() here (and ImageSource) looks like
hajimehoshi
2016/07/04 10:46:25
This method is overriding Image::data. Do you mean
|
| +{ |
| + if (RefPtr<SharedBuffer> data = cachedData()) |
| + return data; |
|
f(malita)
2016/06/30 18:21:46
Nit: return data.release();
hajimehoshi
2016/07/04 10:46:25
Done.
|
| + return m_source.data(); |
|
f(malita)
2016/06/30 18:21:46
IIUC we clear the cached data as soon as we can, a
hajimehoshi
2016/07/04 10:46:25
IIUC the situation where this function is limited:
|
| +} |
| + |
| +PassRefPtr<SharedBuffer> BitmapImage::cachedData() |
|
scroggo_chromium
2016/06/28 15:33:44
A couple of thoughts on this method:
It is very s
hiroshige
2016/06/29 07:04:06
FYI using "cached" prefix near loading code might
hajimehoshi
2016/07/04 10:46:25
Removed.
|
| +{ |
| + return Image::data(); |
| +} |
| + |
| void BitmapImage::notifyMemoryChanged() |
| { |
| if (getImageObserver()) |
| @@ -218,8 +230,16 @@ 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()) { |
| + // Remove the cached data (encoded image data) from BitmapImage. Now |
| + // there is an encoded image data in DefferedImageDecoder on a skia |
|
scroggo_chromium
2016/06/28 15:33:44
nit: "there is encoded image data" (no need for "a
hajimehoshi
2016/07/04 10:46:25
Done.
|
| + // side, we won't need the same data in BitmapImage. |
| + resetCachedData(); |
|
scroggo_chromium
2016/06/28 15:33:44
Just to make sure I understand - this will drop th
hajimehoshi
2016/07/04 10:46:25
Yes.
|
| + DCHECK(!cachedData()); |
| + } |
| + } |
| m_haveFrameCount = false; |
| return isSizeAvailable(); |