OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef FrameRequestCallbackCollection_h | 5 #ifndef FrameRequestCallbackCollection_h |
6 #define FrameRequestCallbackCollection_h | 6 #define FrameRequestCallbackCollection_h |
7 | 7 |
8 #include "core/CoreExport.h" | 8 #include "core/CoreExport.h" |
9 #include "platform/heap/Handle.h" | 9 #include "platform/heap/Handle.h" |
10 | 10 |
11 namespace blink { | 11 namespace blink { |
12 | 12 |
13 class ExecutionContext; | 13 class ExecutionContext; |
14 class FrameRequestCallback; | 14 class FrameRequestCallback; |
15 | 15 |
16 class CORE_EXPORT FrameRequestCallbackCollection final { | 16 class CORE_EXPORT FrameRequestCallbackCollection final { |
17 DISALLOW_ALLOCATION(); | 17 DISALLOW_NEW(); |
18 public: | 18 public: |
19 explicit FrameRequestCallbackCollection(ExecutionContext*); | 19 explicit FrameRequestCallbackCollection(ExecutionContext*); |
20 | 20 |
21 using CallbackId = int; | 21 using CallbackId = int; |
22 CallbackId registerCallback(FrameRequestCallback*); | 22 CallbackId registerCallback(FrameRequestCallback*); |
23 void cancelCallback(CallbackId); | 23 void cancelCallback(CallbackId); |
24 void executeCallbacks(double highResNowMs, double highResNowMsLegacy); | 24 void executeCallbacks(double highResNowMs, double highResNowMsLegacy); |
25 | 25 |
26 bool isEmpty() const { return !m_callbacks.size(); } | 26 bool isEmpty() const { return !m_callbacks.size(); } |
27 | 27 |
28 DECLARE_TRACE(); | 28 DECLARE_TRACE(); |
29 | 29 |
30 private: | 30 private: |
31 using CallbackList = PersistentHeapVectorWillBeHeapVector<Member<FrameReques
tCallback>>; | 31 using CallbackList = PersistentHeapVectorWillBeHeapVector<Member<FrameReques
tCallback>>; |
32 CallbackList m_callbacks; | 32 CallbackList m_callbacks; |
33 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall
backs | 33 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall
backs |
34 | 34 |
35 CallbackId m_nextCallbackId = 0; | 35 CallbackId m_nextCallbackId = 0; |
36 | 36 |
37 RawPtrWillBeMember<ExecutionContext> m_context; | 37 RawPtrWillBeMember<ExecutionContext> m_context; |
38 }; | 38 }; |
39 | 39 |
40 } // namespace blink | 40 } // namespace blink |
41 | 41 |
42 #endif // FrameRequestCallbackCollection_h | 42 #endif // FrameRequestCallbackCollection_h |
OLD | NEW |