Title: [148145] trunk/Source/WebCore
Revision
148145
Author
[email protected]
Date
2013-04-10 15:47:07 -0700 (Wed, 10 Apr 2013)

Log Message

Flesh out the Animations logging
https://bugs.webkit.org/show_bug.cgi?id=114388

Reviewed by Dean Jackson.

Log state changes and transition/animation creation and destruction
to the Animations log channel.

* page/animation/AnimationBase.cpp:
(WebCore::nameForState):
(WebCore::AnimationBase::updateStateMachine):
(WebCore::AnimationBase::fireAnimationEventsIfNeeded):
(WebCore::AnimationBase::goIntoEndingOrLoopingState):
(WebCore::AnimationBase::freezeAtTime):
* page/animation/CompositeAnimation.cpp:
(WebCore::CompositeAnimation::updateTransitions):
(WebCore::CompositeAnimation::updateKeyframeAnimations):
* page/animation/KeyframeAnimation.h:
(WebCore::KeyframeAnimation::keyframes):
(KeyframeAnimation):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (148144 => 148145)


--- trunk/Source/WebCore/ChangeLog	2013-04-10 22:45:35 UTC (rev 148144)
+++ trunk/Source/WebCore/ChangeLog	2013-04-10 22:47:07 UTC (rev 148145)
@@ -1,3 +1,26 @@
+2013-04-10  Simon Fraser  <[email protected]>
+
+        Flesh out the Animations logging
+        https://bugs.webkit.org/show_bug.cgi?id=114388
+
+        Reviewed by Dean Jackson.
+
+        Log state changes and transition/animation creation and destruction
+        to the Animations log channel.
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::nameForState):
+        (WebCore::AnimationBase::updateStateMachine):
+        (WebCore::AnimationBase::fireAnimationEventsIfNeeded):
+        (WebCore::AnimationBase::goIntoEndingOrLoopingState):
+        (WebCore::AnimationBase::freezeAtTime):
+        * page/animation/CompositeAnimation.cpp:
+        (WebCore::CompositeAnimation::updateTransitions):
+        (WebCore::CompositeAnimation::updateKeyframeAnimations):
+        * page/animation/KeyframeAnimation.h:
+        (WebCore::KeyframeAnimation::keyframes):
+        (KeyframeAnimation):
+
 2013-04-10  Alexey Proskuryakov  <[email protected]>
 
         <rdar://problem/13047266> External XML entities are not loaded with modern libxml2

Modified: trunk/Source/WebCore/page/animation/AnimationBase.cpp (148144 => 148145)


--- trunk/Source/WebCore/page/animation/AnimationBase.cpp	2013-04-10 22:45:35 UTC (rev 148144)
+++ trunk/Source/WebCore/page/animation/AnimationBase.cpp	2013-04-10 22:47:07 UTC (rev 148145)
@@ -36,6 +36,7 @@
 #include "Document.h"
 #include "EventNames.h"
 #include "FloatConversion.h"
+#include "Logging.h"
 #include "RenderBox.h"
 #include "RenderStyle.h"
 #include "UnitBezier.h"
@@ -111,6 +112,27 @@
     return m_animation->animationsMatch(anim);
 }
 
+#if !LOG_DISABLED
+static const char* nameForState(AnimationBase::AnimState state)
+{
+    switch (state) {
+    case AnimationBase::AnimationStateNew: return "New";
+    case AnimationBase::AnimationStateStartWaitTimer: return "StartWaitTimer";
+    case AnimationBase::AnimationStateStartWaitStyleAvailable: return "StartWaitStyleAvailable";
+    case AnimationBase::AnimationStateStartWaitResponse: return "StartWaitResponse";
+    case AnimationBase::AnimationStateLooping: return "Looping";
+    case AnimationBase::AnimationStateEnding: return "Ending";
+    case AnimationBase::AnimationStatePausedWaitTimer: return "PausedWaitTimer";
+    case AnimationBase::AnimationStatePausedWaitStyleAvailable: return "PausedWaitStyleAvailable";
+    case AnimationBase::AnimationStatePausedWaitResponse: return "PausedWaitResponse";
+    case AnimationBase::AnimationStatePausedRun: return "PausedRun";
+    case AnimationBase::AnimationStateDone: return "Done";
+    case AnimationBase::AnimationStateFillingForwards: return "FillingForwards";
+    }
+    return "";
+}
+#endif
+
 void AnimationBase::updateStateMachine(AnimStateInput input, double param)
 {
     if (!m_compAnim)
@@ -120,6 +142,7 @@
     if (input == AnimationStateInputMakeNew) {
         if (m_animState == AnimationStateStartWaitStyleAvailable)
             m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
+        LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
         m_animState = AnimationStateNew;
         m_startTime = 0;
         m_pauseTime = -1;
@@ -132,6 +155,7 @@
     if (input == AnimationStateInputRestartAnimation) {
         if (m_animState == AnimationStateStartWaitStyleAvailable)
             m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
+        LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
         m_animState = AnimationStateNew;
         m_startTime = 0;
         m_pauseTime = -1;
@@ -147,6 +171,7 @@
     if (input == AnimationStateInputEndAnimation) {
         if (m_animState == AnimationStateStartWaitStyleAvailable)
             m_compAnim->animationController()->removeFromAnimationsWaitingForStyle(this);
+        LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animState));
         m_animState = AnimationStateDone;
         endAnimation();
         return;
@@ -176,6 +201,7 @@
             ASSERT(input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning || input == AnimationStateInputPlayStatePaused);
             if (input == AnimationStateInputStartAnimation || input == AnimationStateInputPlayStateRunning) {
                 m_requestedStartTime = beginAnimationUpdateTime();
+                LOG(Animations, "%p AnimationState %s -> StartWaitTimer", this, nameForState(m_animState));
                 m_animState = AnimationStateStartWaitTimer;
             }
             break;
@@ -185,6 +211,7 @@
             if (input == AnimationStateInputStartTimerFired) {
                 ASSERT(param >= 0);
                 // Start timer has fired, tell the animation to start and wait for it to respond with start time
+                LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animState));
                 m_animState = AnimationStateStartWaitStyleAvailable;
                 m_compAnim->animationController()->addToAnimationsWaitingForStyle(this);
 
@@ -195,6 +222,7 @@
                 ASSERT(!paused());
                 // We're waiting for the start timer to fire and we got a pause. Cancel the timer, pause and wait
                 m_pauseTime = beginAnimationUpdateTime();
+                LOG(Animations, "%p AnimationState %s -> PausedWaitTimer", this, nameForState(m_animState));
                 m_animState = AnimationStatePausedWaitTimer;
             }
             break;
@@ -203,6 +231,7 @@
 
             if (input == AnimationStateInputStyleAvailable) {
                 // Start timer has fired, tell the animation to start and wait for it to respond with start time
+                LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
                 m_animState = AnimationStateStartWaitResponse;
 
                 overrideAnimations();
@@ -211,6 +240,7 @@
                 if (overridden()) {
                     // We won't try to start accelerated animations if we are overridden and
                     // just move on to the next state.
+                    LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
                     m_animState = AnimationStateStartWaitResponse;
                     m_isAccelerated = false;
                     updateStateMachine(AnimationStateInputStartTimeSet, beginAnimationUpdateTime());
@@ -227,6 +257,7 @@
             } else {
                 // We're waiting for the style to be available and we got a pause. Pause and wait
                 m_pauseTime = beginAnimationUpdateTime();
+                LOG(Animations, "%p AnimationState %s -> PausedWaitStyleAvailable", this, nameForState(m_animState));
                 m_animState = AnimationStatePausedWaitStyleAvailable;
             }
             break;
@@ -257,6 +288,7 @@
                 // we unpause, we will act as though the start timer just fired
                 m_pauseTime = beginAnimationUpdateTime();
                 pauseAnimation(beginAnimationUpdateTime() - m_startTime);
+                LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animState));
                 m_animState = AnimationStatePausedWaitResponse;
             }
             break;
@@ -274,6 +306,7 @@
                 // We are pausing while running. Cancel the animation and wait
                 m_pauseTime = beginAnimationUpdateTime();
                 pauseAnimation(beginAnimationUpdateTime() - m_startTime);
+                LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
                 m_animState = AnimationStatePausedRun;
             }
             break;
@@ -288,12 +321,14 @@
                 // End timer fired, finish up
                 onAnimationEnd(param);
 
+                LOG(Animations, "%p AnimationState %s -> Done", this, nameForState(m_animState));
                 m_animState = AnimationStateDone;
                 
                 if (m_object) {
-                    if (m_animation->fillsForwards())
+                    if (m_animation->fillsForwards()) {
+                        LOG(Animations, "%p AnimationState %s -> FillingForwards", this, nameForState(m_animState));
                         m_animState = AnimationStateFillingForwards;
-                    else
+                    } else
                         resumeOverriddenAnimations();
 
                     // Fire off another style change so we can set the final value
@@ -303,6 +338,7 @@
                 // We are pausing while running. Cancel the animation and wait
                 m_pauseTime = beginAnimationUpdateTime();
                 pauseAnimation(beginAnimationUpdateTime() - m_startTime);
+                LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
                 m_animState = AnimationStatePausedRun;
             }
             // |this| may be deleted here
@@ -315,6 +351,7 @@
             m_pauseTime = -1;
 
             // we were waiting for the start timer to fire, go back and wait again
+            LOG(Animations, "%p AnimationState %s -> New", this, nameForState(m_animState));
             m_animState = AnimationStateNew;
             updateStateMachine(AnimationStateInputStartAnimation, 0);
             break;
@@ -336,12 +373,14 @@
                     m_startTime = 0;
                 m_pauseTime = -1;
 
-                if (m_animState == AnimationStatePausedWaitStyleAvailable)
+                if (m_animState == AnimationStatePausedWaitStyleAvailable) {
+                    LOG(Animations, "%p AnimationState %s -> StartWaitStyleAvailable", this, nameForState(m_animState));
                     m_animState = AnimationStateStartWaitStyleAvailable;
-                else {
+                } else {
                     // We were either running or waiting for a begin time response from the animation.
                     // Either way we need to restart the animation (possibly with an offset if we
                     // had already been running) and wait for it to start.
+                    LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
                     m_animState = AnimationStateStartWaitResponse;
 
                     // Start the animation
@@ -364,6 +403,7 @@
                 
                 // We are paused but we got the callback that notifies us that an accelerated animation started.
                 // We ignore the start time and just move into the paused-run state.
+                LOG(Animations, "%p AnimationState %s -> PausedRun", this, nameForState(m_animState));
                 m_animState = AnimationStatePausedRun;
                 ASSERT(m_startTime == 0);
                 m_startTime = param;
@@ -374,6 +414,7 @@
             ASSERT(m_animState == AnimationStatePausedWaitStyleAvailable);
             // We are paused but we got the callback that notifies us that style has been updated.
             // We move to the AnimationStatePausedWaitResponse state
+            LOG(Animations, "%p AnimationState %s -> PausedWaitResponse", this, nameForState(m_animState));
             m_animState = AnimationStatePausedWaitResponse;
             overrideAnimations();
             break;
@@ -417,6 +458,7 @@
     if (m_totalDuration >= 0 && elapsedDuration >= m_totalDuration) {
         // We may still be in AnimationStateLooping if we've managed to skip a
         // whole iteration, in which case we should jump to the end state.
+        LOG(Animations, "%p AnimationState %s -> Ending", this, nameForState(m_animState));
         m_animState = AnimationStateEnding;
 
         // Fire an end event
@@ -580,6 +622,7 @@
     double t;
     bool isLooping;
     getTimeToNextEvent(t, isLooping);
+    LOG(Animations, "%p AnimationState %s -> %s", this, nameForState(m_animState), isLooping ? "Looping" : "Ending");
     m_animState = isLooping ? AnimationStateLooping : AnimationStateEnding;
 }
   
@@ -590,6 +633,7 @@
 
     if (!m_startTime) {
         // If we haven't started yet, make it as if we started.
+        LOG(Animations, "%p AnimationState %s -> StartWaitResponse", this, nameForState(m_animState));
         m_animState = AnimationStateStartWaitResponse;
         onAnimationStartResponse(currentTime());
     }

Modified: trunk/Source/WebCore/page/animation/CompositeAnimation.cpp (148144 => 148145)


--- trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2013-04-10 22:45:35 UTC (rev 148144)
+++ trunk/Source/WebCore/page/animation/CompositeAnimation.cpp	2013-04-10 22:47:07 UTC (rev 148145)
@@ -34,6 +34,7 @@
 #include "CSSPropertyNames.h"
 #include "ImplicitAnimation.h"
 #include "KeyframeAnimation.h"
+#include "Logging.h"
 #include "RenderObject.h"
 #include "RenderStyle.h"
 
@@ -140,7 +141,7 @@
                     // list. In this case, the latter one overrides the earlier one, so we
                     // behave as though this is a running animation being replaced.
                     if (!implAnim->isTargetPropertyEqual(prop, targetStyle)) {
-    #if USE(ACCELERATED_COMPOSITING)
+#if USE(ACCELERATED_COMPOSITING)
                         // For accelerated animations we need to return a new RenderStyle with the _current_ value
                         // of the property, so that restarted transitions use the correct starting point.
                         if (CSSPropertyAnimation::animationOfPropertyIsAccelerated(prop) && implAnim->isAccelerated()) {
@@ -149,7 +150,8 @@
 
                             implAnim->blendPropertyValueInStyle(prop, modifiedCurrentStyle.get());
                         }
-    #endif
+#endif
+                        LOG(Animations, "Removing existing ImplicitAnimation %p for property %s", implAnim, getPropertyName(prop));
                         animationController()->animationWillBeRemoved(implAnim);
                         m_transitions.remove(prop);
                         equal = false;
@@ -165,7 +167,9 @@
                 // <https://bugs.webkit.org/show_bug.cgi?id=24787>
                 if (!equal && isActiveTransition) {
                     // Add the new transition
-                    m_transitions.set(prop, ImplicitAnimation::create(const_cast<Animation*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle));
+                    RefPtr<ImplicitAnimation> animation = ImplicitAnimation::create(const_cast<Animation*>(anim), prop, renderer, this, modifiedCurrentStyle ? modifiedCurrentStyle.get() : fromStyle);
+                    LOG(Animations, "Created ImplicitAnimation %p for property %s duration %.2f delay %.2f", animation.get(), getPropertyName(prop), anim->duration(), anim->delay());
+                    m_transitions.set(prop, animation.release());
                 }
                 
                 // We only need one pass for the single prop case
@@ -183,6 +187,7 @@
         if (!anim->active()) {
             animationController()->animationWillBeRemoved(anim);
             toBeRemoved.append(anim->animatingProperty());
+            LOG(Animations, "Removing ImplicitAnimation %p for property %s", anim, getPropertyName(anim->animatingProperty()));
         }
     }
 
@@ -246,6 +251,12 @@
                     keyframeAnim->setIndex(i);
                 } else if ((anim->duration() || anim->delay()) && anim->iterationCount() && animationName != none) {
                     keyframeAnim = KeyframeAnimation::create(const_cast<Animation*>(anim), renderer, i, this, targetStyle);
+                    LOG(Animations, "Creating KeyframeAnimation %p with keyframes %s duration %.2f delay %.2f, iterations %.2f", keyframeAnim.get(), anim->name().utf8().data(), anim->duration(), anim->delay(), anim->iterationCount());
+#if !LOG_DISABLED
+                    HashSet<CSSPropertyID>::const_iterator endProperties = keyframeAnim->keyframes().endProperties();
+                    for (HashSet<CSSPropertyID>::const_iterator it = keyframeAnim->keyframes().beginProperties(); it != endProperties; ++it)
+                        LOG(Animations, "  property %s", getPropertyName(*it));
+#endif
                     m_keyframeAnimations.set(keyframeAnim->name().impl(), keyframeAnim);
                 }
                 
@@ -265,6 +276,7 @@
             animsToBeRemoved.append(keyframeAnim->name().impl());
             animationController()->animationWillBeRemoved(keyframeAnim);
             keyframeAnim->clear();
+            LOG(Animations, "Removing KeyframeAnimation %p", keyframeAnim);
         }
     }
     

Modified: trunk/Source/WebCore/page/animation/KeyframeAnimation.h (148144 => 148145)


--- trunk/Source/WebCore/page/animation/KeyframeAnimation.h	2013-04-10 22:45:35 UTC (rev 148144)
+++ trunk/Source/WebCore/page/animation/KeyframeAnimation.h	2013-04-10 22:47:07 UTC (rev 148145)
@@ -49,6 +49,8 @@
     virtual void animate(CompositeAnimation*, RenderObject*, const RenderStyle* currentStyle, RenderStyle* targetStyle, RefPtr<RenderStyle>& animatedStyle);
     virtual void getAnimatedStyle(RefPtr<RenderStyle>& animatedStyle);
 
+    const KeyframeList& keyframes() const { return m_keyframes; }
+
     const AtomicString& name() const { return m_keyframes.animationName(); }
     int index() const { return m_index; }
     void setIndex(int i) { m_index = i; }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to