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

Unified Diff: Source/core/platform/graphics/ImageSource.h

Issue 15350006: Decode GIF image frames on demand. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 7 months 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: Source/core/platform/graphics/ImageSource.h
diff --git a/Source/core/platform/graphics/ImageSource.h b/Source/core/platform/graphics/ImageSource.h
index 084b3fa9cc58b056ef5bcbcb9b983097a1111f69..a3272689d5c7f214378b713636934cc833134cd7 100644
--- a/Source/core/platform/graphics/ImageSource.h
+++ b/Source/core/platform/graphics/ImageSource.h
@@ -80,30 +80,23 @@ public:
~ImageSource();
// Tells the ImageSource that the Image no longer cares about decoded frame
Peter Kasting 2013/05/29 02:02:18 Nit: How about this comment: Tells the ImageSourc
Xianzhu 2013/05/29 18:37:01 Done.
- // data -- at all (if |destroyAll| is true), or before frame
- // |clearBeforeFrame| (if |destroyAll| is false). The ImageSource should
- // delete cached decoded data for these frames where possible to keep memory
- // usage low. When |destroyAll| is true, the ImageSource should also reset
- // any local state so that decoding can begin again.
+ // data except the specified frame (|notFound| to clear all frames).
+ // The ImageSource should delete cached decoded data for these frames
+ // where possible to keep memory usage low.
//
- // Implementations that delete less than what's specified above waste
+ // The caller is supposed to request for a frame on/after the provided frame
+ // index after this call. If the caller violate this by clearing and then
+ // requesting a frame before the provided frame number, the decoder may need
+ // to redecode the image from the beginning.
+ //
+ // Implementations that delete less than what's specified above may waste
// memory. Implementations that delete more may burn CPU re-decoding frames
// that could otherwise have been cached, or encounter errors if they're
// asked to decode frames they can't decode due to the loss of previous
// decoded frames.
//
- // Callers should not call clear(false, n) and subsequently call
- // createFrameAtIndex(m) with m < n, unless they first call clear(true).
- // This ensures that stateful ImageSources/decoders will work properly.
- //
- // The |data| and |allDataReceived| parameters should be supplied by callers
- // who set |destroyAll| to true if they wish to be able to continue using
- // the ImageSource. This way implementations which choose to destroy their
- // decoders in some cases can reconstruct them correctly.
- void clear(bool destroyAll,
- size_t clearBeforeFrame = 0,
- SharedBuffer* data = NULL,
- bool allDataReceived = false);
+ // Returns number of bytes of the cleared frames.
+ size_t clearCacheExceptFrame(size_t);
bool initialized() const;

Powered by Google App Engine
This is Rietveld 408576698