Index: Source/platform/image-decoders/ImageAnimation.h |
diff --git a/Source/core/dom/ActiveDOMObject.h b/Source/platform/image-decoders/ImageAnimation.h |
similarity index 54% |
copy from Source/core/dom/ActiveDOMObject.h |
copy to Source/platform/image-decoders/ImageAnimation.h |
index 4690c91c757766550079f8f1eb0e39894c0e4513..4e6faabf3a4ef6625bd4edf972040956e2bf8bbd 100644 |
--- a/Source/core/dom/ActiveDOMObject.h |
+++ b/Source/platform/image-decoders/ImageAnimation.h |
@@ -1,5 +1,5 @@ |
/* |
- * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
+ * Copyright (C) 2015 Google Inc. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -21,49 +21,31 @@ |
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
- * |
*/ |
-#ifndef ActiveDOMObject_h |
-#define ActiveDOMObject_h |
- |
-#include "core/dom/ContextLifecycleObserver.h" |
-#include "wtf/Assertions.h" |
+#ifndef ImageAnimation_h |
+#define ImageAnimation_h |
namespace blink { |
-class ActiveDOMObject : public ContextLifecycleObserver { |
-public: |
- ActiveDOMObject(ExecutionContext*); |
- |
- // suspendIfNeeded() should be called exactly once after object construction to synchronize |
- // the suspend state with that in ExecutionContext. |
- void suspendIfNeeded(); |
-#if ENABLE(ASSERT) |
- bool suspendIfNeededCalled() const { return m_suspendIfNeededCalled; } |
-#endif |
- |
- // Should return true if there's any pending asynchronous activity, and so |
- // this object must not be garbage collected. |
- virtual bool hasPendingActivity() const; |
- |
- // These methods have an empty default implementation so that subclasses |
- // which don't need special treatment can skip implementation. |
- virtual void suspend(); |
- virtual void resume(); |
- virtual void stop(); |
- |
- void didMoveToNewExecutionContext(ExecutionContext*); |
- |
-protected: |
- virtual ~ActiveDOMObject(); |
- |
-private: |
-#if ENABLE(ASSERT) |
- bool m_suspendIfNeededCalled; |
-#endif |
-}; |
+// GIF and WebP support animation. The explanation below is in terms of GIF, |
+// but the same constants are used for WebP, too. |
+// GIFs have an optional 16-bit unsigned loop count that describes how an |
+// animated GIF should be cycled. If the loop count is absent, the animation |
+// cycles once; if it is 0, the animation cycles infinitely; otherwise the |
+// animation plays n + 1 cycles (where n is the specified loop count). If the |
+// GIF decoder defaults to cAnimationLoopOnce in the absence of any loop count |
+// and translates an explicit "0" loop count to cAnimationLoopInfinite, then we |
+// get a couple of nice side effects: |
+// * By making cAnimationLoopOnce be 0, we allow the animation cycling code in |
+// BitmapImage.cpp to avoid special-casing it, and simply treat all |
+// non-negative loop counts identically. |
+// * By making the other two constants negative, we avoid conflicts with any |
+// real loop count values. |
+const int cAnimationLoopOnce = 0; |
+const int cAnimationLoopInfinite = -1; |
+const int cAnimationNone = -2; |
} // namespace blink |
-#endif // ActiveDOMObject_h |
+#endif |