Title: [150159] trunk/Source/WebCore
- Revision
- 150159
- Author
- [email protected]
- Date
- 2013-05-15 17:28:59 -0700 (Wed, 15 May 2013)
Log Message
ScriptedAnimationController::setThrottled should extend MinimumAnimationInterval
https://bugs.webkit.org/show_bug.cgi?id=116193
Reviewed by Simon Fraser.
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::ScriptedAnimationController):
- initialize m_throttled
(WebCore::ScriptedAnimationController::setThrottled):
- sets m_throttled, reschedule when this changes.
(WebCore::ScriptedAnimationController::scheduleAnimation):
- if throtled don't use a display link, and extend the timeout.
* dom/ScriptedAnimationController.h:
(ScriptedAnimationController):
- Added m_throttled
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (150158 => 150159)
--- trunk/Source/WebCore/ChangeLog 2013-05-16 00:12:43 UTC (rev 150158)
+++ trunk/Source/WebCore/ChangeLog 2013-05-16 00:28:59 UTC (rev 150159)
@@ -1,3 +1,21 @@
+2013-05-15 Gavin Barraclough <[email protected]>
+
+ ScriptedAnimationController::setThrottled should extend MinimumAnimationInterval
+ https://bugs.webkit.org/show_bug.cgi?id=116193
+
+ Reviewed by Simon Fraser.
+
+ * dom/ScriptedAnimationController.cpp:
+ (WebCore::ScriptedAnimationController::ScriptedAnimationController):
+ - initialize m_throttled
+ (WebCore::ScriptedAnimationController::setThrottled):
+ - sets m_throttled, reschedule when this changes.
+ (WebCore::ScriptedAnimationController::scheduleAnimation):
+ - if throtled don't use a display link, and extend the timeout.
+ * dom/ScriptedAnimationController.h:
+ (ScriptedAnimationController):
+ - Added m_throttled
+
2013-05-08 Gavin Barraclough <[email protected]>
Process suppression should throttle scripted animations
Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.cpp (150158 => 150159)
--- trunk/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-05-16 00:12:43 UTC (rev 150158)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.cpp 2013-05-16 00:28:59 UTC (rev 150159)
@@ -43,6 +43,7 @@
// Allow a little more than 60fps to make sure we can at least hit that frame rate.
#define MinimumAnimationInterval 0.015
+#define MinimumThrottledAnimationInterval 10
#endif
namespace WebCore {
@@ -56,6 +57,7 @@
, m_lastAnimationFrameTimeMonotonic(0)
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
, m_useTimer(false)
+ , m_throttled(false)
#endif
#endif
{
@@ -85,7 +87,11 @@
void ScriptedAnimationController::setThrottled(bool isThrottled)
{
#if USE(REQUEST_ANIMATION_FRAME_TIMER) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
- m_useTimer = isThrottled;
+ m_throttled = isThrottled;
+ if (m_animationTimer.isActive()) {
+ m_animationTimer.stop();
+ scheduleAnimation();
+ }
#endif
}
@@ -174,7 +180,7 @@
#if USE(REQUEST_ANIMATION_FRAME_TIMER)
#if USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
- if (!m_useTimer) {
+ if (!m_useTimer && !m_throttled) {
if (DisplayRefreshMonitorManager::sharedManager()->scheduleAnimation(this))
return;
@@ -184,7 +190,12 @@
if (m_animationTimer.isActive())
return;
- double scheduleDelay = max<double>(MinimumAnimationInterval - (monotonicallyIncreasingTime() - m_lastAnimationFrameTimeMonotonic), 0);
+#if USE(REQUEST_ANIMATION_FRAME_TIMER) && USE(REQUEST_ANIMATION_FRAME_DISPLAY_MONITOR)
+ double animationInterval = m_throttled ? MinimumThrottledAnimationInterval : MinimumAnimationInterval;
+#else
+ double animationInterval = MinimumAnimationInterval;
+#endif
+ double scheduleDelay = max<double>(animationInterval - (monotonicallyIncreasingTime() - m_lastAnimationFrameTimeMonotonic), 0);
m_animationTimer.startOneShot(scheduleDelay);
#else
if (FrameView* frameView = m_document->view())
Modified: trunk/Source/WebCore/dom/ScriptedAnimationController.h (150158 => 150159)
--- trunk/Source/WebCore/dom/ScriptedAnimationController.h 2013-05-16 00:12:43 UTC (rev 150158)
+++ trunk/Source/WebCore/dom/ScriptedAnimationController.h 2013-05-16 00:28:59 UTC (rev 150159)
@@ -91,6 +91,7 @@
virtual void displayRefreshFired(double timestamp);
bool m_useTimer;
+ bool m_throttled;
#endif
#endif
};
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes