Backed out changeset 9d8b4c0b99ed (bug 1945683) for causing btime failures. CLOSED...
[gecko.git] / dom / base / AnimationFrameProvider.h
blob06a828ecbe2fbc1b8333e7a65ebd36f0aac5ac52
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this
5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_AnimationFrameProvider_h
8 #define mozilla_dom_AnimationFrameProvider_h
10 #include "mozilla/dom/AnimationFrameProviderBinding.h"
11 #include "mozilla/dom/RequestCallbackManager.h"
13 namespace mozilla::dom {
15 class HTMLVideoElement;
17 using FrameRequest = RequestCallbackEntry<FrameRequestCallback>;
18 using FrameRequestManagerBase = RequestCallbackManager<FrameRequestCallback>;
20 class FrameRequestManager final : public FrameRequestManagerBase {
21 public:
22 FrameRequestManager();
23 ~FrameRequestManager();
25 using FrameRequestManagerBase::Cancel;
26 using FrameRequestManagerBase::Schedule;
27 using FrameRequestManagerBase::Take;
29 void Schedule(HTMLVideoElement*);
30 bool Cancel(HTMLVideoElement*);
31 bool IsEmpty() const {
32 return FrameRequestManagerBase::IsEmpty() && mVideoCallbacks.IsEmpty();
34 void Take(nsTArray<RefPtr<HTMLVideoElement>>&);
35 void Unlink();
36 void Traverse(nsCycleCollectionTraversalCallback&);
38 private:
39 nsTArray<RefPtr<HTMLVideoElement>> mVideoCallbacks;
42 } // namespace mozilla::dom
44 #endif