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 "platform/heap/Handle.h" | 8 #include "platform/heap/Handle.h" |
9 | 9 |
10 namespace blink { | 10 namespace blink { |
11 | 11 |
12 class ExecutionContext; | 12 class ExecutionContext; |
13 class FrameRequestCallback; | 13 class FrameRequestCallback; |
14 | 14 |
15 class FrameRequestCallbackCollection final { | 15 class FrameRequestCallbackCollection final { |
| 16 DISALLOW_ALLOCATION(); |
16 public: | 17 public: |
17 explicit FrameRequestCallbackCollection(ExecutionContext*); | 18 explicit FrameRequestCallbackCollection(ExecutionContext*); |
18 | 19 |
19 typedef int CallbackId; | 20 using CallbackId = int; |
20 CallbackId registerCallback(FrameRequestCallback*); | 21 CallbackId registerCallback(FrameRequestCallback*); |
21 void cancelCallback(CallbackId); | 22 void cancelCallback(CallbackId); |
22 void executeCallbacks(double highResNowMs, double highResNowMsLegacy); | 23 void executeCallbacks(double highResNowMs, double highResNowMsLegacy); |
23 | 24 |
24 bool isEmpty() const { return !m_callbacks.size(); } | 25 bool isEmpty() const { return !m_callbacks.size(); } |
25 | 26 |
26 DECLARE_TRACE(); | 27 DECLARE_TRACE(); |
27 | 28 |
28 private: | 29 private: |
29 typedef PersistentHeapVectorWillBeHeapVector<Member<FrameRequestCallback>> C
allbackList; | 30 using CallbackList = PersistentHeapVectorWillBeHeapVector<Member<FrameReques
tCallback>>; |
30 CallbackList m_callbacks; | 31 CallbackList m_callbacks; |
31 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall
backs | 32 CallbackList m_callbacksToInvoke; // only non-empty while inside executeCall
backs |
32 | 33 |
33 CallbackId m_nextCallbackId = 0; | 34 CallbackId m_nextCallbackId = 0; |
34 | 35 |
35 ExecutionContext* m_context = nullptr; | 36 RawPtrWillBeMember<ExecutionContext> m_context; |
36 }; | 37 }; |
37 | 38 |
38 } // namespace blink | 39 } // namespace blink |
39 | 40 |
40 #endif // FrameRequestCallbackCollection_h | 41 #endif // FrameRequestCallbackCollection_h |
OLD | NEW |