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

Unified Diff: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp

Issue 2516593003: Pull up clearCacheExceptFrame to ImageDecoder. (Closed)
Patch Set: Add todo for changing MockImageDecoder Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
diff --git a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
index ca3575a40bbdc665eea76f231fcab10379125892..a1ac919863cd135d5abd05b3a38694a0fd4c49c2 100644
--- a/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
+++ b/third_party/WebKit/Source/platform/image-decoders/gif/GIFImageDecoder.cpp
@@ -229,42 +229,6 @@ bool GIFImageDecoder::frameComplete(size_t frameIndex) {
return true;
}
-size_t GIFImageDecoder::clearCacheExceptFrame(size_t clearExceptFrame) {
- // We expect that after this call, we'll be asked to decode frames after
- // this one. So we want to avoid clearing frames such that those requests
- // would force re-decoding from the beginning of the image.
- //
- // When |clearExceptFrame| is e.g. DisposeKeep, simply not clearing that
- // frame is sufficient, as the next frame will be based on it, and in
- // general future frames can't be based on anything previous.
- //
- // However, if this frame is DisposeOverwritePrevious, then subsequent
- // frames will depend on this frame's required previous frame. In this
- // case, we need to preserve both this frame and that one.
- size_t clearExceptFrame2 = kNotFound;
- if (clearExceptFrame < m_frameBufferCache.size()) {
- const ImageFrame& frame = m_frameBufferCache[clearExceptFrame];
- if ((frame.getStatus() != ImageFrame::FrameEmpty) &&
- (frame.getDisposalMethod() == ImageFrame::DisposeOverwritePrevious)) {
- clearExceptFrame2 = clearExceptFrame;
- clearExceptFrame = frame.requiredPreviousFrameIndex();
- }
- }
-
- // Now |clearExceptFrame| indicates the frame that future frames will
- // depend on. But if decoding is skipping forward past intermediate frames,
- // this frame may be FrameEmpty. So we need to keep traversing back through
- // the required previous frames until we find the nearest non-empty
- // ancestor. Preserving that will minimize the amount of future decoding
- // needed.
- while ((clearExceptFrame < m_frameBufferCache.size()) &&
- (m_frameBufferCache[clearExceptFrame].getStatus() ==
- ImageFrame::FrameEmpty))
- clearExceptFrame =
- m_frameBufferCache[clearExceptFrame].requiredPreviousFrameIndex();
- return clearCacheExceptTwoFrames(clearExceptFrame, clearExceptFrame2);
-}
-
void GIFImageDecoder::clearFrameBuffer(size_t frameIndex) {
if (m_reader &&
m_frameBufferCache[frameIndex].getStatus() == ImageFrame::FramePartial) {

Powered by Google App Engine
This is Rietveld 408576698