Index: Source/core/dom/RequestAnimationFrameCallbackCollection.h |
diff --git a/Source/core/dom/RequestAnimationFrameCallbackCollection.h b/Source/core/dom/RequestAnimationFrameCallbackCollection.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..f3754eb6c1671c34ef2d1b869d4fa8786fa47852 |
--- /dev/null |
+++ b/Source/core/dom/RequestAnimationFrameCallbackCollection.h |
@@ -0,0 +1,40 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef RequestAnimationFrameCallbackCollection_h |
+#define RequestAnimationFrameCallbackCollection_h |
+ |
+#include "platform/heap/Handle.h" |
+ |
+namespace blink { |
+ |
+class ExecutionContext; |
+class RequestAnimationFrameCallback; |
+ |
+class RequestAnimationFrameCallbackCollection { |
esprehn
2015/03/30 18:36:38
final
sadrul
2015/03/30 18:40:47
Done.
|
+public: |
+ explicit RequestAnimationFrameCallbackCollection(ExecutionContext*); |
+ |
+ typedef int CallbackId; |
+ CallbackId registerCallback(RequestAnimationFrameCallback*); |
+ void cancelCallback(CallbackId); |
+ void executeCallbacks(double highResNowMs, double highResNowMsLegacy); |
+ |
+ bool empty() const { return !m_callbacks.size() && !m_callbacksToInvoke.size(); } |
+ |
+ DECLARE_TRACE(); |
+ |
+private: |
+ typedef PersistentHeapVectorWillBeHeapVector<Member<RequestAnimationFrameCallback>> CallbackList; |
+ CallbackList m_callbacks; |
+ CallbackList m_callbacksToInvoke; // only non-empty while inside executeCallbacks |
+ |
+ CallbackId m_nextCallbackId = 0; |
+ |
+ ExecutionContext* m_context = nullptr; |
+}; |
+ |
+} // namespace blink |
+ |
+#endif // RequestAnimationFrameCallbackCollection_h |