, m_isGLAccelerationMode(true)
#endif
, m_animationsLocked(false)
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ , m_lastAnimationServiceTime(0)
+#endif
{
// Create a root layer.
m_rootLayer = GraphicsLayer::create(this);
#if ENABLE(REQUEST_ANIMATION_FRAME) && !USE(REQUEST_ANIMATION_FRAME_TIMER) && !USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
// Make sure that any previously registered animation callbacks are being executed before we flush the layers.
+ m_lastAnimationServiceTime = WTF::monotonicallyIncreasingTime();
m_webPage->corePage()->mainFrame()->view()->serviceScriptedAnimations(convertSecondsToDOMTimeStamp(currentTime()));
#endif
#if USE(UI_SIDE_COMPOSITING)
void LayerTreeCoordinator::scheduleAnimation()
{
- scheduleLayerFlush();
+ if (m_waitingForUIProcess)
+ return;
+
+ if (m_layerFlushTimer.isActive())
+ return;
+#if ENABLE(REQUEST_ANIMATION_FRAME)
+ // According to the requestAnimationFrame spec, rAF callbacks should not be faster than 60FPS.
+ static const double MinimalTimeoutForAnimations = 1. / 60.;
+ m_layerFlushTimer.startOneShot(std::max<double>(0., MinimalTimeoutForAnimations - WTF::monotonicallyIncreasingTime() + m_lastAnimationServiceTime));
+#else
+ static const double cAnimationTimerDelay = 0.015;
+ m_layerFlushTimer.startOneShot(cAnimationTimerDelay);
+#endif
+ scheduleLayerFlush();
}
#endif