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

Unified Diff: Source/core/dom/RequestAnimationFrameCallbackCollection.h

Issue 1043903003: rAF: Introduce FrameRequestCallbackCollection for managing rAF callbacks. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 5 years, 9 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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/RequestAnimationFrameCallbackCollection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/core/core.gypi ('k') | Source/core/dom/RequestAnimationFrameCallbackCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698