Loading libs/hwui/AnimationContext.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,14 @@ AnimationContext::AnimationContext(renderthread::TimeLord& clock) } AnimationContext::~AnimationContext() { startFrame(); while (mCurrentFrameAnimations.mNextHandle) { AnimationHandle* current = mCurrentFrameAnimations.mNextHandle; AnimatorManager& animators = current->mRenderNode->animators(); animators.endAllAnimators(); LOG_ALWAYS_FATAL_IF(mCurrentFrameAnimations.mNextHandle == current, "Animate failed to remove from current frame list!"); } } void AnimationContext::addAnimatingRenderNode(RenderNode& node) { Loading Loading @@ -96,10 +104,17 @@ void AnimationHandle::notifyAnimationsRan() { if (mRenderNode->animators().hasAnimators()) { mContext.addAnimationHandle(this); } else { release(); } } void AnimationHandle::release() { LOG_ALWAYS_FATAL_IF(mRenderNode->animators().hasAnimators(), "Releasing the handle for an RenderNode with outstanding animators!"); removeFromList(); mRenderNode->animators().setAnimationHandle(NULL); delete this; } } void AnimationHandle::insertAfter(AnimationHandle* prev) { removeFromList(); Loading libs/hwui/AnimationContext.h +7 −0 Original line number Diff line number Diff line Loading @@ -46,8 +46,15 @@ class AnimationHandle { public: AnimationContext& context() { return mContext; } // Called by the RenderNode when it has internally pulsed its own animations // this frame and does not need to be run again this frame. void notifyAnimationsRan(); // Stops tracking the RenderNode and destroys the handle. The node must be // re-attached to the AnimationContext to receive managed animation // pulses. void release(); private: friend class AnimationContext; AnimationHandle(AnimationContext& context); Loading libs/hwui/AnimatorManager.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -160,14 +160,16 @@ void AnimatorManager::endAllAnimators() { if (mAnimationHandle) { EndAnimatorsFunctor functor(mAnimationHandle->context()); for_each(mAnimators.begin(), mAnimators.end(), functor); mAnimators.clear(); mAnimationHandle->release(); } else { // We have no context, so bust out the sledgehammer // This works because this state can only happen on the UI thread, // which means we're already on the right thread to invoke listeners for_each(mAnimators.begin(), mAnimators.end(), endAnimatorsHard); } mAnimators.clear(); } } } /* namespace uirenderer */ } /* namespace android */ Loading
libs/hwui/AnimationContext.cpp +17 −2 Original line number Diff line number Diff line Loading @@ -31,6 +31,14 @@ AnimationContext::AnimationContext(renderthread::TimeLord& clock) } AnimationContext::~AnimationContext() { startFrame(); while (mCurrentFrameAnimations.mNextHandle) { AnimationHandle* current = mCurrentFrameAnimations.mNextHandle; AnimatorManager& animators = current->mRenderNode->animators(); animators.endAllAnimators(); LOG_ALWAYS_FATAL_IF(mCurrentFrameAnimations.mNextHandle == current, "Animate failed to remove from current frame list!"); } } void AnimationContext::addAnimatingRenderNode(RenderNode& node) { Loading Loading @@ -96,10 +104,17 @@ void AnimationHandle::notifyAnimationsRan() { if (mRenderNode->animators().hasAnimators()) { mContext.addAnimationHandle(this); } else { release(); } } void AnimationHandle::release() { LOG_ALWAYS_FATAL_IF(mRenderNode->animators().hasAnimators(), "Releasing the handle for an RenderNode with outstanding animators!"); removeFromList(); mRenderNode->animators().setAnimationHandle(NULL); delete this; } } void AnimationHandle::insertAfter(AnimationHandle* prev) { removeFromList(); Loading
libs/hwui/AnimationContext.h +7 −0 Original line number Diff line number Diff line Loading @@ -46,8 +46,15 @@ class AnimationHandle { public: AnimationContext& context() { return mContext; } // Called by the RenderNode when it has internally pulsed its own animations // this frame and does not need to be run again this frame. void notifyAnimationsRan(); // Stops tracking the RenderNode and destroys the handle. The node must be // re-attached to the AnimationContext to receive managed animation // pulses. void release(); private: friend class AnimationContext; AnimationHandle(AnimationContext& context); Loading
libs/hwui/AnimatorManager.cpp +3 −1 Original line number Diff line number Diff line Loading @@ -160,14 +160,16 @@ void AnimatorManager::endAllAnimators() { if (mAnimationHandle) { EndAnimatorsFunctor functor(mAnimationHandle->context()); for_each(mAnimators.begin(), mAnimators.end(), functor); mAnimators.clear(); mAnimationHandle->release(); } else { // We have no context, so bust out the sledgehammer // This works because this state can only happen on the UI thread, // which means we're already on the right thread to invoke listeners for_each(mAnimators.begin(), mAnimators.end(), endAnimatorsHard); } mAnimators.clear(); } } } /* namespace uirenderer */ } /* namespace android */