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
3 // found in the LICENSE file.
5 #ifndef FrameRequestCallbackCollection_h
6 #define FrameRequestCallbackCollection_h
8 #include "core/CoreExport.h"
9 #include "platform/heap/Handle.h"
13 class ExecutionContext
;
14 class FrameRequestCallback
;
16 class CORE_EXPORT FrameRequestCallbackCollection final
{
17 DISALLOW_ALLOCATION();
19 explicit FrameRequestCallbackCollection(ExecutionContext
*);
21 using CallbackId
= int;
22 CallbackId
registerCallback(FrameRequestCallback
*);
23 void cancelCallback(CallbackId
);
24 void executeCallbacks(double highResNowMs
, double highResNowMsLegacy
);
26 bool isEmpty() const { return !m_callbacks
.size(); }
31 using CallbackList
= PersistentHeapVectorWillBeHeapVector
<Member
<FrameRequestCallback
>>;
32 CallbackList m_callbacks
;
33 CallbackList m_callbacksToInvoke
; // only non-empty while inside executeCallbacks
35 CallbackId m_nextCallbackId
= 0;
37 RawPtrWillBeMember
<ExecutionContext
> m_context
;
42 #endif // FrameRequestCallbackCollection_h