gecko-dev/dom/base/AnimationFrameProvider.h
Emilio Cobos Álvarez 4ecaba1a91 Bug 1800882 - Keep includes in AnimationFrameProvider.h down. r=aosmond
This fixes rusttests. Otherwise we include HTMLVideoElement.h from
Document.h, which includes a bunch of media headers, which causes
rusttest failures because
https://searchfox.org/mozilla-central/rev/d353cfa1fbd207e13dc974f30e5f88535a4303ae/dom/media/platforms/EncoderConfig.h#95
hits https://github.com/rust-lang/rust-bindgen/issues/380.

We could hide those types from rust but it seems slightly nicer to keep
Document.h lean, since it's included in a gazillion places.

Differential Revision: https://phabricator.services.mozilla.com/D217733
2024-08-01 20:12:23 +00:00

44 lines
1.3 KiB
C++

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#ifndef mozilla_dom_AnimationFrameProvider_h
#define mozilla_dom_AnimationFrameProvider_h
#include "mozilla/dom/AnimationFrameProviderBinding.h"
#include "mozilla/dom/RequestCallbackManager.h"
namespace mozilla::dom {
class HTMLVideoElement;
using FrameRequest = RequestCallbackEntry<FrameRequestCallback>;
using FrameRequestManagerBase = RequestCallbackManager<FrameRequestCallback>;
class FrameRequestManager final : public FrameRequestManagerBase {
public:
FrameRequestManager();
~FrameRequestManager();
using FrameRequestManagerBase::Cancel;
using FrameRequestManagerBase::Schedule;
using FrameRequestManagerBase::Take;
void Schedule(HTMLVideoElement*);
bool Cancel(HTMLVideoElement*);
bool IsEmpty() const {
return FrameRequestManagerBase::IsEmpty() && mVideoCallbacks.IsEmpty();
}
void Take(nsTArray<RefPtr<HTMLVideoElement>>&);
void Unlink();
void Traverse(nsCycleCollectionTraversalCallback&);
private:
nsTArray<RefPtr<HTMLVideoElement>> mVideoCallbacks;
};
} // namespace mozilla::dom
#endif