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

Issue 2516593003: Pull up clearCacheExceptFrame to ImageDecoder. (Closed)

Created:
4 years, 1 month ago by joostouwerling
Modified:
4 years ago
CC:
chromium-reviews, blink-reviews, jzern, skal, urvang
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Pull up clearCacheExceptFrame to ImageDecoder. Just a refactor, no changed behavior or new tests. This is a follow-up on crrev.com/2468233002 (Pull up clearCacheExceptFrame impl. to ImageDecoder), after a behavior change for WebP's cache clearing has landed in crrev.com/2499633002 (Always preserve provided frame in WebP::clearCacheExceptFrame). Pull up the implementation of clearCacheExceptFrame in WEBPImageDecoder and GIFImageDecoder to ImageDecoder. This increases code reuse, especially since PNGImageDecoder can use it for the Animated PNG implementation as well. Child classes of ImageDecoder only need to override clearFrameBuffer() and / or frameStatusIsSufficientForSuccessors(), if necessary. The baseline idea of the implementation is that the provided frame is always preserved, and that there are two cases in which a previous frame is also preserved: 1. The provided frame is not yet sufficiently decoded to decode subsequent frames, as indicated by frameStatusIsSufficientForSuccessors(). We need to keep the required previous frame to sufficiently decode the provided frame first. 2. The disposal method of the provided frame is DisposeOverwritePrevious. In this case, we need to keep the required previous frame in cache to prevent re-decoding that frame when the provided frame is disposed. WebP does not know DisposeOverwritePrevious, so the new implementation is effectively equivalent to the original method, because frameStatusIsSufficientForSuccessors returns true iff the status is FrameComplete. Gif's original implementation is somewhat different, in the sense that the roles of |clearExceptFrame| and |clearExceptFrame2| are interchanged. Now, |clearExpectFrame| is always kept and |clearExceptFrame2| contains any required previous frame. The resulting behavior is not changed, though, given the following case analysis: - The provided frame is FrameEmpty. The old implementation would only keep the nearest non-empty frame in cache, since the first block is a no-op due to the != FrameEmpty condition, and the second block would search for the nearest non-empty frame in cache. The new patch sets |clearExceptFrame2| to the required previous frame, since !frameStatusIsSufficientForSuccessors evaluates to true. The second block will find the nearest non-empty frame in cache. |clearExceptFrame| is also passed to clearCacheExceptTwoFrames, but is ignored since that method checks for FrameEmpty frames. - The provided frame is FrameComplete or FramePartial, and the disposal method is DisposeOverwritePrevious. In the old implementation this results in |clearExceptFrame| being set to the required previous frame in the first block, and |clearExceptFrame2| is set to the provided frame. The second block searches for the nearest non-empty frame, starting at |clearExceptFrame|. The new implementation stores the required previous frame in |clearExceptFrame2| because of the disposal method, and similarly searches for the nearest non-empty frame in the second block. - The provided frame is FrameComplete or FramePartial, and the disposal method is *not* DisposeOverwritePrevious. In this case, the old implementation only preserves the provided frame since the first block is a no-op due to the disposal condition, and the second block is a no-op as well since the frames' status is not FrameEmpty. The new implementation does not set |clearExceptFrame2| because of the disposal condition in the first block, and thus only preserves the provided frame. Committed: https://crrev.com/e0df7a9b0f7bab12de923b1f58d047e0ff4f4de4 Cr-Commit-Position: refs/heads/master@{#435636}

Patch Set 1 #

Patch Set 2 : Make clearCacheExceptFrame non-virtual #

Total comments: 2

Patch Set 3 : Reword comment describing clearExceptFrame2 #

Patch Set 4 : Merge from master to avoid merge conflicts #

Patch Set 5 : Make clearCacheExceptFrame virtual to allow MockImageDecoder override #

Total comments: 4

Patch Set 6 : Add todo for changing MockImageDecoder #

Messages

Total messages: 34 (18 generated)
joostouwerling
4 years, 1 month ago (2016-11-18 21:49:29 UTC) #4
cblume
On 2016/11/18 21:49:29, joostouwerling wrote: non-owner lgtm
4 years, 1 month ago (2016-11-19 02:49:55 UTC) #5
urvang
lgtm
4 years, 1 month ago (2016-11-21 20:13:52 UTC) #6
scroggo_chromium
lgtm > Gif's original implementation is somewhat different, in the sense that > the roles ...
4 years ago (2016-11-28 16:34:38 UTC) #7
joostouwerling
On 2016/11/28 16:34:38, scroggo_chromium wrote: > lgtm > > > Gif's original implementation is somewhat ...
4 years ago (2016-11-30 15:09:01 UTC) #9
joostouwerling
https://codereview.chromium.org/2516593003/diff/20001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp File third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp (right): https://codereview.chromium.org/2516593003/diff/20001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp#newcode238 third_party/WebKit/Source/platform/image-decoders/ImageDecoder.cpp:238: // Now |clearExceptFrame2| indicates the frame that future frames ...
4 years ago (2016-11-30 15:09:17 UTC) #10
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2516593003/40001
4 years ago (2016-11-30 15:09:52 UTC) #13
commit-bot: I haz the power
Try jobs failed on following builders: linux_chromium_chromeos_rel_ng on master.tryserver.chromium.linux (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.linux/builders/linux_chromium_chromeos_rel_ng/builds/324424)
4 years ago (2016-11-30 15:33:00 UTC) #15
scroggo_chromium
https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h File third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h (right): https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h#newcode253 third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h:253: // order to run the test ImageFrameGenerator::clearMultiFrameDecode. Instead of ...
4 years ago (2016-12-01 14:44:07 UTC) #22
joostouwerling
https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h File third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h (right): https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h#newcode253 third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h:253: // order to run the test ImageFrameGenerator::clearMultiFrameDecode. On 2016/12/01 ...
4 years ago (2016-12-01 15:05:06 UTC) #23
scroggo_chromium
https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h File third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h (right): https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h#newcode253 third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h:253: // order to run the test ImageFrameGenerator::clearMultiFrameDecode. On 2016/12/01 ...
4 years ago (2016-12-01 15:08:00 UTC) #24
joostouwerling
https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h File third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h (right): https://codereview.chromium.org/2516593003/diff/120001/third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h#newcode253 third_party/WebKit/Source/platform/image-decoders/ImageDecoder.h:253: // order to run the test ImageFrameGenerator::clearMultiFrameDecode. On 2016/12/01 ...
4 years ago (2016-12-01 15:25:21 UTC) #25
scroggo_chromium
lgtm
4 years ago (2016-12-01 15:28:40 UTC) #26
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2516593003/140001
4 years ago (2016-12-01 15:37:58 UTC) #29
commit-bot: I haz the power
Committed patchset #6 (id:140001)
4 years ago (2016-12-01 17:31:10 UTC) #32
commit-bot: I haz the power
4 years ago (2016-12-01 17:35:13 UTC) #34
Message was sent while issue was closed.
Patchset 6 (id:??) landed as
https://crrev.com/e0df7a9b0f7bab12de923b1f58d047e0ff4f4de4
Cr-Commit-Position: refs/heads/master@{#435636}

Powered by Google App Engine
This is Rietveld 408576698