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

Unified Diff: Source/core/dom/FrameRequestCallbackCollection.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/dom/FrameRequestCallback.idl ('k') | Source/core/dom/FrameRequestCallbackCollection.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/FrameRequestCallbackCollection.h
diff --git a/Source/core/dom/FrameRequestCallbackCollection.h b/Source/core/dom/FrameRequestCallbackCollection.h
new file mode 100644
index 0000000000000000000000000000000000000000..9990fc8d8e895d86de6e9f3a4d81a3df0c856c09
--- /dev/null
+++ b/Source/core/dom/FrameRequestCallbackCollection.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 FrameRequestCallbackCollection_h
+#define FrameRequestCallbackCollection_h
+
+#include "platform/heap/Handle.h"
+
+namespace blink {
+
+class ExecutionContext;
+class FrameRequestCallback;
+
+class FrameRequestCallbackCollection final {
+public:
+ explicit FrameRequestCallbackCollection(ExecutionContext*);
+
+ typedef int CallbackId;
+ CallbackId registerCallback(FrameRequestCallback*);
+ void cancelCallback(CallbackId);
+ void executeCallbacks(double highResNowMs, double highResNowMsLegacy);
+
+ bool isEmpty() const { return !m_callbacks.size(); }
+
+ DECLARE_TRACE();
+
+private:
+ typedef PersistentHeapVectorWillBeHeapVector<Member<FrameRequestCallback>> CallbackList;
+ CallbackList m_callbacks;
+ CallbackList m_callbacksToInvoke; // only non-empty while inside executeCallbacks
+
+ CallbackId m_nextCallbackId = 0;
+
+ ExecutionContext* m_context = nullptr;
+};
+
+} // namespace blink
+
+#endif // FrameRequestCallbackCollection_h
« no previous file with comments | « Source/core/dom/FrameRequestCallback.idl ('k') | Source/core/dom/FrameRequestCallbackCollection.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698