summaryrefslogtreecommitdiff
path: root/Source/WebCore/dom/ScriptedAnimationController.h
diff options
context:
space:
mode:
Diffstat (limited to 'Source/WebCore/dom/ScriptedAnimationController.h')
-rw-r--r--Source/WebCore/dom/ScriptedAnimationController.h59
1 files changed, 30 insertions, 29 deletions
diff --git a/Source/WebCore/dom/ScriptedAnimationController.h b/Source/WebCore/dom/ScriptedAnimationController.h
index f2808e78d..012c25862 100644
--- a/Source/WebCore/dom/ScriptedAnimationController.h
+++ b/Source/WebCore/dom/ScriptedAnimationController.h
@@ -23,22 +23,24 @@
*
*/
-#ifndef ScriptedAnimationController_h
-#define ScriptedAnimationController_h
+#pragma once
-#if ENABLE(REQUEST_ANIMATION_FRAME)
#include "DOMTimeStamp.h"
-#if USE(REQUEST_ANIMATION_FRAME_TIMER)
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
-#include "DisplayRefreshMonitor.h"
-#endif
-#include "Timer.h"
-#endif
#include "PlatformScreen.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
+#if USE(REQUEST_ANIMATION_FRAME_TIMER)
+#include "Timer.h"
+#endif
+
+#if USE(REQUEST_ANIMATION_FRAME_TIMER) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+#include "Chrome.h"
+#include "ChromeClient.h"
+#include "DisplayRefreshMonitorClient.h"
+#endif
+
namespace WebCore {
class Document;
@@ -50,22 +52,24 @@ class ScriptedAnimationController : public RefCounted<ScriptedAnimationControlle
#endif
{
public:
- static PassRefPtr<ScriptedAnimationController> create(Document* document, PlatformDisplayID displayID)
+ static Ref<ScriptedAnimationController> create(Document* document, PlatformDisplayID displayID)
{
- return adoptRef(new ScriptedAnimationController(document, displayID));
+ return adoptRef(*new ScriptedAnimationController(document, displayID));
}
~ScriptedAnimationController();
- void clearDocumentPointer() { m_document = 0; }
+ void clearDocumentPointer() { m_document = nullptr; }
+ bool requestAnimationFrameEnabled() const;
typedef int CallbackId;
- CallbackId registerCallback(PassRefPtr<RequestAnimationFrameCallback>);
+ CallbackId registerCallback(Ref<RequestAnimationFrameCallback>&&);
void cancelCallback(CallbackId);
- void serviceScriptedAnimations(double monotonicTimeNow);
+ void serviceScriptedAnimations(double timestamp);
void suspend();
void resume();
void setThrottled(bool);
+ WEBCORE_EXPORT bool isThrottled() const;
void windowScreenDidChange(PlatformDisplayID);
@@ -76,28 +80,25 @@ private:
CallbackList m_callbacks;
Document* m_document;
- CallbackId m_nextCallbackId;
- int m_suspendCount;
+ CallbackId m_nextCallbackId { 0 };
+ int m_suspendCount { 0 };
void scheduleAnimation();
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
- void animationTimerFired(Timer<ScriptedAnimationController>&);
- Timer<ScriptedAnimationController> m_animationTimer;
- double m_lastAnimationFrameTimeMonotonic;
+ void animationTimerFired();
+ Timer m_animationTimer;
+ double m_lastAnimationFrameTimestamp { 0 };
+#endif
-#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+#if USE(REQUEST_ANIMATION_FRAME_TIMER) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
// Override for DisplayRefreshMonitorClient
- virtual void displayRefreshFired(double timestamp) override;
+ void displayRefreshFired() override;
+ RefPtr<DisplayRefreshMonitor> createDisplayRefreshMonitor(PlatformDisplayID) const override;
- bool m_isUsingTimer;
- bool m_isThrottled;
-#endif
+ bool m_isUsingTimer { false };
+ bool m_isThrottled { false };
#endif
};
-}
-
-#endif // ENABLE(REQUEST_ANIMATION_FRAME)
-
-#endif // ScriptedAnimationController_h
+} // namespace WebCore