|
7 | 7 | #ifndef mozilla_dom_AnimationFrameProvider_h
|
8 | 8 | #define mozilla_dom_AnimationFrameProvider_h
|
9 | 9 |
|
10 |
| -#include "MainThreadUtils.h" |
11 |
| -#include "mozilla/Assertions.h" |
12 | 10 | #include "mozilla/dom/AnimationFrameProviderBinding.h"
|
13 |
| -#include "mozilla/dom/HTMLVideoElement.h" |
14 | 11 | #include "mozilla/dom/RequestCallbackManager.h"
|
15 | 12 |
|
16 | 13 | namespace mozilla::dom {
|
17 | 14 |
|
| 15 | +class HTMLVideoElement; |
| 16 | + |
18 | 17 | using FrameRequest = RequestCallbackEntry<FrameRequestCallback>;
|
19 | 18 | using FrameRequestManagerBase = RequestCallbackManager<FrameRequestCallback>;
|
20 | 19 |
|
21 | 20 | class FrameRequestManager final : public FrameRequestManagerBase {
|
22 | 21 | public:
|
23 |
| - FrameRequestManager() = default; |
24 |
| - ~FrameRequestManager() = default; |
| 22 | + FrameRequestManager(); |
| 23 | + ~FrameRequestManager(); |
25 | 24 |
|
26 | 25 | using FrameRequestManagerBase::Cancel;
|
27 | 26 | using FrameRequestManagerBase::Schedule;
|
28 | 27 | using FrameRequestManagerBase::Take;
|
29 | 28 |
|
30 |
| - void Schedule(HTMLVideoElement* aElement) { |
31 |
| - if (!mVideoCallbacks.Contains(aElement)) { |
32 |
| - mVideoCallbacks.AppendElement(aElement); |
33 |
| - } |
34 |
| - } |
35 |
| - |
36 |
| - bool Cancel(HTMLVideoElement* aElement) { |
37 |
| - return mVideoCallbacks.RemoveElement(aElement); |
38 |
| - } |
39 |
| - |
| 29 | + void Schedule(HTMLVideoElement*); |
| 30 | + bool Cancel(HTMLVideoElement*); |
40 | 31 | bool IsEmpty() const {
|
41 | 32 | return FrameRequestManagerBase::IsEmpty() && mVideoCallbacks.IsEmpty();
|
42 | 33 | }
|
43 |
| - |
44 |
| - void Take(nsTArray<RefPtr<HTMLVideoElement>>& aVideoCallbacks) { |
45 |
| - MOZ_ASSERT(NS_IsMainThread()); |
46 |
| - aVideoCallbacks = std::move(mVideoCallbacks); |
47 |
| - } |
48 |
| - |
49 |
| - void Unlink() { |
50 |
| - FrameRequestManagerBase::Unlink(); |
51 |
| - mVideoCallbacks.Clear(); |
52 |
| - } |
53 |
| - |
54 |
| - void Traverse(nsCycleCollectionTraversalCallback& aCB) { |
55 |
| - FrameRequestManagerBase::Traverse(aCB); |
56 |
| - for (auto& i : mVideoCallbacks) { |
57 |
| - NS_CYCLE_COLLECTION_NOTE_EDGE_NAME( |
58 |
| - aCB, "FrameRequestManager::mVideoCallbacks[i]"); |
59 |
| - aCB.NoteXPCOMChild(ToSupports(i)); |
60 |
| - } |
61 |
| - } |
| 34 | + void Take(nsTArray<RefPtr<HTMLVideoElement>>&); |
| 35 | + void Unlink(); |
| 36 | + void Traverse(nsCycleCollectionTraversalCallback&); |
62 | 37 |
|
63 | 38 | private:
|
64 | 39 | nsTArray<RefPtr<HTMLVideoElement>> mVideoCallbacks;
|
|
0 commit comments