Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(331)

Issue 15350006: Decode GIF image frames on demand. (Closed)

Created:
7 years, 7 months ago by Xianzhu
Modified:
7 years, 6 months ago
CC:
blink-reviews, eae+blinkwatch, jeez
Base URL:
https://chromium.googlesource.com/chromium/blink.git@master
Visibility:
Public.

Description

Decode GIF image frames on demand. Previously GIFImageDecoder::frameBufferAtIndex() decodes all frames from the last decoded frame to the requested frame. This causes delays when skipping to specific frames. With this change, GIFImageDecoder decodes only necessary frames based on previous frames' disposal methods. Added ImageDecoder::findRequiredPreviousFrame() to find the required previous frame based on the disposal methods. Also changed the behavior of GIFImageDecoder::clearFrameBufferCache() (moved to ImageDecoder because it can be shared between multi-frame decoders) because the original semantics no longer apply with on-demand frame decoding. Instead of clearing before the given frame, now clear from the whole frame buffer cache, preserving the frames that are likely to be used soon. BUG=238242 TEST=ImageDecoderTest.findRequiredPreviousFrame, ImageDecoderTest.clearFrameBufferCache, GIFImageDecoderTest.randomFrameDecode, GIFImageDecoderTest.decodeAfterClearFrameBufferCache R=abarth@chromium.org, pkasting@chromium.org Committed: https://src.chromium.org/viewvc/blink?view=rev&revision=151560

Patch Set 1 #

Total comments: 25

Patch Set 2 : Don't preserve the last frame and frames at intervals #

Total comments: 41

Patch Set 3 : #

Total comments: 36

Patch Set 4 : #

Total comments: 30

Patch Set 5 : #

Total comments: 2

Patch Set 6 : For landing #

Total comments: 1

Patch Set 7 : For landing #

Patch Set 8 : Fix 2 misplaced OVERRIDE #

Patch Set 9 : Rebased #

Unified diffs Side-by-side diffs Delta from patch set Stats (+727 lines, -671 lines) Patch
M Source/WebKit/chromium/WebKit.gypi View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -1 line 0 comments Download
M Source/WebKit/chromium/tests/DragImageTest.cpp View 1 2 3 4 2 chunks +6 lines, -8 lines 0 comments Download
D Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp View 1 2 3 4 5 6 7 8 1 chunk +0 lines, -324 lines 0 comments Download
M Source/WebKit/chromium/tests/ImageLayerChromiumTest.cpp View 1 2 3 4 5 6 7 8 3 chunks +9 lines, -11 lines 0 comments Download
M Source/core/core.gypi View 1 2 3 4 5 6 7 8 1 chunk +2 lines, -0 lines 0 comments Download
M Source/core/platform/graphics/BitmapImage.h View 1 2 3 4 5 chunks +20 lines, -24 lines 0 comments Download
M Source/core/platform/graphics/BitmapImage.cpp View 1 2 3 4 4 chunks +12 lines, -26 lines 0 comments Download
M Source/core/platform/graphics/GeneratedImage.h View 1 2 3 4 1 chunk +10 lines, -11 lines 0 comments Download
M Source/core/platform/graphics/Image.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/platform/graphics/ImageSource.h View 1 2 3 4 2 chunks +15 lines, -23 lines 0 comments Download
M Source/core/platform/graphics/ImageSource.cpp View 1 2 3 4 1 chunk +2 lines, -11 lines 0 comments Download
M Source/core/platform/graphics/chromium/DeferredImageDecoder.h View 1 2 3 1 chunk +1 line, -1 line 0 comments Download
M Source/core/platform/graphics/chromium/DeferredImageDecoder.cpp View 1 2 3 4 1 chunk +2 lines, -3 lines 0 comments Download
M Source/core/platform/image-decoders/ImageDecoder.h View 1 2 3 4 5 5 chunks +50 lines, -4 lines 0 comments Download
M Source/core/platform/image-decoders/ImageDecoder.cpp View 1 2 3 4 2 chunks +70 lines, -1 line 0 comments Download
A Source/core/platform/image-decoders/ImageDecoderTest.cpp View 1 2 3 4 5 6 1 chunk +216 lines, -0 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageDecoder.h View 1 2 3 4 5 2 chunks +27 lines, -21 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp View 1 2 3 8 chunks +86 lines, -133 lines 0 comments Download
A + Source/core/platform/image-decoders/gif/GIFImageDecoderTest.cpp View 1 2 3 4 5 6 7 8 12 chunks +157 lines, -15 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageReader.h View 1 2 3 7 chunks +6 lines, -8 lines 0 comments Download
M Source/core/platform/image-decoders/gif/GIFImageReader.cpp View 1 2 3 4 5 6 7 8 3 chunks +14 lines, -31 lines 0 comments Download
M Source/core/platform/image-decoders/ico/ICOImageDecoder.cpp View 1 2 3 4 1 chunk +3 lines, -1 line 0 comments Download
M Source/core/platform/image-decoders/skia/ImageDecoderSkia.cpp View 1 2 3 4 2 chunks +5 lines, -0 lines 0 comments Download
M Source/core/svg/graphics/SVGImage.h View 1 2 3 4 5 6 7 2 chunks +11 lines, -11 lines 0 comments Download
M Source/core/svg/graphics/SVGImageForContainer.h View 1 2 3 1 chunk +2 lines, -2 lines 0 comments Download

Messages

Total messages: 35 (0 generated)
Xianzhu
Untested. For preview. Will add/update unit tests.
7 years, 7 months ago (2013-05-17 23:17:56 UTC) #1
Alpha Left Google
https://codereview.chromium.org/15350006/diff/1/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp File Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp (right): https://codereview.chromium.org/15350006/diff/1/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp#newcode192 Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp:192: ASSERT(j->status() != ImageFrame::FramePartial); This condition can fail now with ...
7 years, 7 months ago (2013-05-18 00:39:35 UTC) #2
Xianzhu
https://codereview.chromium.org/15350006/diff/1/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp File Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp (right): https://codereview.chromium.org/15350006/diff/1/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp#newcode192 Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp:192: ASSERT(j->status() != ImageFrame::FramePartial); On 2013/05/18 00:39:35, Alpha wrote: > ...
7 years, 7 months ago (2013-05-20 04:30:59 UTC) #3
Xianzhu
There is some bug in the changed code, causing the animated gifs drawn blank. Now ...
7 years, 7 months ago (2013-05-20 17:06:39 UTC) #4
Xianzhu
https://codereview.chromium.org/15350006/diff/13001/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp File Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp (right): https://codereview.chromium.org/15350006/diff/13001/Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp#newcode357 Source/core/platform/image-decoders/gif/GIFImageDecoder.cpp:357: for (size_t i = 0; i < framesToDecode.size(); ++i) ...
7 years, 7 months ago (2013-05-20 17:27:11 UTC) #5
Xianzhu
PTAL. Patch Set 4 is tested.
7 years, 7 months ago (2013-05-20 19:45:06 UTC) #6
Peter Kasting
Some general questions. Can we instrument Chrome somehow to measure the memory impact of keeping ...
7 years, 7 months ago (2013-05-20 23:20:07 UTC) #7
Xianzhu
On 2013/05/20 23:20:07, Peter Kasting wrote: > Some general questions. > > Can we instrument ...
7 years, 7 months ago (2013-05-21 00:26:25 UTC) #8
Alpha Left Google
> > Is it still necessary to have BitmapImage ask the decoders to destroy decoded ...
7 years, 7 months ago (2013-05-21 00:40:17 UTC) #9
Xianzhu
PTAL. I removed the code to preserve frames at intervals, so that this change doesn't ...
7 years, 7 months ago (2013-05-21 16:32:03 UTC) #10
Xianzhu
On 2013/05/21 16:32:03, Xianzhu wrote: > PTAL. I removed the code to preserve frames at ...
7 years, 7 months ago (2013-05-21 16:35:36 UTC) #11
Xianzhu
Sorry for the multiple versions. Deleted intermediate versions, keeping only the last one for review.
7 years, 7 months ago (2013-05-21 17:47:58 UTC) #12
Alpha Left Google
https://codereview.chromium.org/15350006/diff/32001/Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp File Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp (right): https://codereview.chromium.org/15350006/diff/32001/Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp#newcode37 Source/WebKit/chromium/tests/GIFImageDecoderTest.cpp:37: #include "wtf/OwnPtr.h" nit: I'm not sure whether we are ...
7 years, 7 months ago (2013-05-22 20:18:09 UTC) #13
Xianzhu
Thanks for review! Will upload a new patch set after we determine where to put ...
7 years, 7 months ago (2013-05-22 23:43:29 UTC) #14
Xianzhu
https://codereview.chromium.org/15350006/diff/32001/Source/core/platform/image-decoders/ImageDecoder.cpp File Source/core/platform/image-decoders/ImageDecoder.cpp (right): https://codereview.chromium.org/15350006/diff/32001/Source/core/platform/image-decoders/ImageDecoder.cpp#newcode258 Source/core/platform/image-decoders/ImageDecoder.cpp:258: if (frame.status() == ImageFrame::FrameComplete) // 3. On 2013/05/22 23:43:29, ...
7 years, 7 months ago (2013-05-23 00:33:49 UTC) #15
Xianzhu
PTAL. Still keep ImageDecoder::clearImageFrameBuffer() but I'd move it back to GIFImageDecoder if it could not ...
7 years, 7 months ago (2013-05-23 01:07:38 UTC) #16
Peter Kasting
https://codereview.chromium.org/15350006/diff/42001/Source/core/platform/graphics/BitmapImage.cpp File Source/core/platform/graphics/BitmapImage.cpp (right): https://codereview.chromium.org/15350006/diff/42001/Source/core/platform/graphics/BitmapImage.cpp#newcode503 Source/core/platform/graphics/BitmapImage.cpp:503: destroyDecodedDataIfNecessary(true); Since we're resetting m_currentFrame to 0 here, and ...
7 years, 7 months ago (2013-05-24 03:15:22 UTC) #17
Xianzhu
Thanks for review! PTAL. https://codereview.chromium.org/15350006/diff/42001/Source/core/platform/graphics/BitmapImage.cpp File Source/core/platform/graphics/BitmapImage.cpp (right): https://codereview.chromium.org/15350006/diff/42001/Source/core/platform/graphics/BitmapImage.cpp#newcode503 Source/core/platform/graphics/BitmapImage.cpp:503: destroyDecodedDataIfNecessary(true); On 2013/05/24 03:15:22, Peter ...
7 years, 6 months ago (2013-05-28 22:54:21 UTC) #18
Peter Kasting
This is pretty close, just a couple of substantive comments. Most things below are just ...
7 years, 6 months ago (2013-05-29 02:02:17 UTC) #19
Xianzhu
PTAL. I like your suggestions for the comments :) https://codereview.chromium.org/15350006/diff/60001/Source/core/platform/graphics/BitmapImage.cpp File Source/core/platform/graphics/BitmapImage.cpp (right): https://codereview.chromium.org/15350006/diff/60001/Source/core/platform/graphics/BitmapImage.cpp#newcode124 Source/core/platform/graphics/BitmapImage.cpp:124: ...
7 years, 6 months ago (2013-05-29 18:37:01 UTC) #20
Alpha Left Google
Functionally this change looks good to me. I'll let Peter to the final approval.
7 years, 6 months ago (2013-05-29 20:47:03 UTC) #21
Peter Kasting
LGTM https://codereview.chromium.org/15350006/diff/77001/Source/core/platform/image-decoders/ImageDecoder.h File Source/core/platform/image-decoders/ImageDecoder.h (right): https://codereview.chromium.org/15350006/diff/77001/Source/core/platform/image-decoders/ImageDecoder.h#newcode412 Source/core/platform/image-decoders/ImageDecoder.h:412: // This function requires that the previous frame's ...
7 years, 6 months ago (2013-05-29 21:03:18 UTC) #22
Xianzhu
+abarth for approval of Source/WebKit/chromium/tests/, Source/core/svg/.
7 years, 6 months ago (2013-05-29 21:52:27 UTC) #23
abarth-chromium
Tests LGTM. Please consider moving the tests next to the classes they test so that ...
7 years, 6 months ago (2013-05-29 21:55:02 UTC) #24
Xianzhu
On 2013/05/29 21:55:02, abarth wrote: > Tests LGTM. > > Please consider moving the tests ...
7 years, 6 months ago (2013-05-29 23:28:13 UTC) #25
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/15350006/98001
7 years, 6 months ago (2013-05-29 23:28:37 UTC) #26
commit-bot: I haz the power
Sorry for I got bad news for ya. Compile failed with a clobber build on ...
7 years, 6 months ago (2013-05-29 23:47:57 UTC) #27
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/15350006/109001
7 years, 6 months ago (2013-05-29 23:52:46 UTC) #28
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7595
7 years, 6 months ago (2013-05-30 05:01:11 UTC) #29
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/15350006/109001
7 years, 6 months ago (2013-05-30 16:54:22 UTC) #30
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7824
7 years, 6 months ago (2013-05-30 19:58:02 UTC) #31
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/wangxianzhu@chromium.org/15350006/109001
7 years, 6 months ago (2013-05-30 22:21:12 UTC) #32
Alpha Left Google
Failures with win_layout_rel seems to be unrelated. They are not image related tests. I think ...
7 years, 6 months ago (2013-05-31 01:13:22 UTC) #33
commit-bot: I haz the power
Retried try job too often on win_layout_rel for step(s) webkit_tests http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=win_layout_rel&number=7906
7 years, 6 months ago (2013-05-31 01:53:19 UTC) #34
Xianzhu
7 years, 6 months ago (2013-05-31 16:47:44 UTC) #35
Message was sent while issue was closed.
Committed patchset #9 manually as r151560 (presubmit successful).

Powered by Google App Engine
This is Rietveld 408576698