DocumentAnimationScheduler.h [plain text]
#pragma once
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
#include "DisplayRefreshMonitorClient.h"
#include "PlatformScreen.h"
#include <wtf/Ref.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/Seconds.h>
namespace WebCore {
class Document;
class DocumentAnimationScheduler : public RefCounted<DocumentAnimationScheduler>
, public DisplayRefreshMonitorClient {
public:
static Ref<DocumentAnimationScheduler> create(Document&, PlatformDisplayID);
~DocumentAnimationScheduler();
void detachFromDocument();
void windowScreenDidChange(PlatformDisplayID);
bool scheduleWebAnimationsResolution();
void unscheduleWebAnimationsResolution();
bool scheduleScriptedAnimationResolution();
Seconds lastTimestamp() { return m_lastTimestamp; }
bool isFiring() const { return m_isFiring; }
private:
DocumentAnimationScheduler(Document&, PlatformDisplayID);
RefPtr<Document> m_document;
bool m_scheduledWebAnimationsResolution { false };
bool m_scheduledScriptedAnimationResolution { false };
bool m_isFiring { false };
Seconds m_lastTimestamp { 0_s };
void displayRefreshFired() override;
RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
};
}
#endif // USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)