Index: Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp |
=================================================================== |
--- Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (revision 116996) |
+++ Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp (working copy) |
@@ -116,7 +116,8 @@ |
} // namepace |
CCLayerAnimationController::CCLayerAnimationController(CCLayerAnimationControllerClient* client) |
- : m_client(client) |
+ : m_forceSync(false) |
+ , m_client(client) |
{ |
} |
@@ -195,9 +196,14 @@ |
// are kept in sync. |
void CCLayerAnimationController::pushAnimationUpdatesTo(CCLayerAnimationController* controllerImpl) |
{ |
- pushNewAnimationsToImplThread(controllerImpl); |
- removeAnimationsCompletedOnMainThread(controllerImpl); |
- pushPropertiesToImplThread(controllerImpl); |
+ if (m_forceSync) { |
+ replaceImplThreadAnimations(controllerImpl); |
+ m_forceSync = false; |
+ } else { |
+ pushNewAnimationsToImplThread(controllerImpl); |
+ removeAnimationsCompletedOnMainThread(controllerImpl); |
+ pushPropertiesToImplThread(controllerImpl); |
+ } |
} |
void CCLayerAnimationController::animate(double monotonicTime, CCAnimationEventsVector* events) |
@@ -245,8 +251,7 @@ |
void CCLayerAnimationController::notifyAnimationStarted(const CCAnimationEvent& event) |
{ |
for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |
- if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty) { |
- ASSERT(m_activeAnimations[i]->needsSynchronizedStartTime()); |
+ if (m_activeAnimations[i]->group() == event.groupId && m_activeAnimations[i]->targetProperty() == event.targetProperty && m_activeAnimations[i]->needsSynchronizedStartTime()) { |
m_activeAnimations[i]->setNeedsSynchronizedStartTime(false); |
m_activeAnimations[i]->setStartTime(event.monotonicTime); |
return; |
@@ -254,6 +259,11 @@ |
} |
} |
+void CCLayerAnimationController::setClient(CCLayerAnimationControllerClient* client) |
+{ |
+ m_client = client; |
+} |
+ |
void CCLayerAnimationController::pushNewAnimationsToImplThread(CCLayerAnimationController* controllerImpl) const |
{ |
// Any new animations owned by the main thread's controller are cloned and adde to the impl thread's controller. |
@@ -273,6 +283,7 @@ |
ASSERT(!toAdd->needsSynchronizedStartTime()); |
// The new animation should be set to run as soon as possible. |
toAdd->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); |
+ toAdd->setStartTime(0); |
controllerImpl->add(toAdd.release()); |
} |
} |
@@ -429,6 +440,13 @@ |
} |
} |
+void CCLayerAnimationController::replaceImplThreadAnimations(CCLayerAnimationController* controllerImpl) const |
+{ |
+ controllerImpl->m_activeAnimations.clear(); |
+ for (size_t i = 0; i < m_activeAnimations.size(); ++i) |
+ controllerImpl->add(m_activeAnimations[i]->cloneForImplThread()); |
+} |
+ |
void CCLayerAnimationController::tickAnimations(double monotonicTime) |
{ |
for (size_t i = 0; i < m_activeAnimations.size(); ++i) { |