Changeset 116594 in webkit
- Timestamp:
- May 9, 2012 6:52:56 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r116592 r116594 1 2012-05-09 Ian Vollick <vollick@chromium.org> 2 3 [chromium] Ensure animations get ticked at least once when added. 4 https://bugs.webkit.org/show_bug.cgi?id=86013 5 6 Reviewed by James Robinson. 7 8 Tested in 9 CCLayerTreeHostTestTickAnimationWhileBackgrounded.runSingleThreaded 10 CCLayerTreeHostTestAddAnimationWithTimingFunction.runSingleThreaded 11 CCLayerTreeHostTestSynchronizeAnimationStartTimes.runSingleThreaded 12 CCLayerTreeHostTestAnimationFinishedEvents.runSingleThreaded 13 14 * platform/graphics/chromium/LayerChromium.cpp: 15 (WebCore::LayerChromium::addAnimation): 16 * platform/graphics/chromium/cc/CCLayerAnimationController.cpp: 17 (WebCore::CCLayerAnimationController::pushNewAnimationsToImplThread): 18 * platform/graphics/chromium/cc/CCLayerTreeHost.cpp: 19 (WebCore::CCLayerTreeHost::finishCommitOnImplThread): 20 (WebCore::CCLayerTreeHost::didAddAnimation): 21 (WebCore): 22 (WebCore::CCLayerTreeHost::didBecomeInvisibleOnImplThread): 23 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 24 (CCLayerTreeHost): 25 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 26 (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): 27 * platform/graphics/chromium/cc/CCProxy.h: 28 (CCProxy): 29 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 30 (CCSingleThreadProxyAnimationTimer): 31 (WebCore::CCSingleThreadProxyAnimationTimer::create): 32 (WebCore::CCSingleThreadProxyAnimationTimer::CCSingleThreadProxyAnimationTimer): 33 (WebCore): 34 (WebCore::CCSingleThreadProxy::CCSingleThreadProxy): 35 (WebCore::CCSingleThreadProxy::didAddAnimation): 36 (WebCore::CCSingleThreadProxy::doComposite): 37 * platform/graphics/chromium/cc/CCSingleThreadProxy.h: 38 (WebCore): 39 * platform/graphics/chromium/cc/CCThreadProxy.h: 40 1 41 2012-05-09 Adam Barth <abarth@webkit.org> 2 42 -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
r116195 r116594 601 601 602 602 bool addedAnimation = m_layerAnimationController->addAnimation(values, boxSize, animation, animationId, groupId, timeOffset); 603 if (addedAnimation) 603 if (addedAnimation) { 604 m_layerTreeHost->didAddAnimation(); 604 605 setNeedsCommit(); 606 } 605 607 return addedAnimation; 606 608 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerAnimationController.cpp
r116554 r116594 282 282 // The new animation should be set to run as soon as possible. 283 283 toAdd->setRunState(CCActiveAnimation::WaitingForTargetAvailability, 0); 284 toAdd->setStartTime(0); 284 285 controllerImpl->add(toAdd.release()); 285 286 } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.cpp
r116316 r116594 234 234 // We may have added an animation during the tree sync. This will cause both layer tree hosts 235 235 // to visit their controllers. 236 if (rootLayer() ) {236 if (rootLayer() && m_needsAnimateLayers) 237 237 hostImpl->setNeedsAnimateLayers(); 238 m_needsAnimateLayers = true;239 }240 238 241 239 hostImpl->setSourceFrameNumber(frameNumber()); … … 338 336 ASSERT(CCThreadProxy::isMainThread()); 339 337 setAnimationEventsRecursive(*events, m_rootLayer.get(), wallClockTime); 338 } 339 340 void CCLayerTreeHost::didAddAnimation() 341 { 342 m_needsAnimateLayers = true; 343 m_proxy->didAddAnimation(); 340 344 } 341 345 … … 408 412 // We may have added an animation during the tree sync. This will cause both layer tree hosts 409 413 // to visit their controllers. 410 if (rootLayer() ) {414 if (rootLayer() && m_needsAnimateLayers) 411 415 hostImpl->setNeedsAnimateLayers(); 412 m_needsAnimateLayers = true;413 }414 416 } 415 417 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHost.h
r115881 r116594 199 199 200 200 void setAnimationEvents(PassOwnPtr<CCAnimationEventsVector>, double wallClockTime); 201 void didAddAnimation(); 201 202 202 203 LayerChromium* rootLayer() { return m_rootLayer.get(); } -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r116587 r116594 120 120 , m_needsAnimateLayers(false) 121 121 , m_pinchGestureActive(false) 122 , m_timeSourceClientAdapter(CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval * 1000.0, CCProxy::currentThread())))122 , m_timeSourceClientAdapter(CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval, CCProxy::currentThread()))) 123 123 , m_fpsCounter(CCFrameRateCounter::create()) 124 124 , m_debugRectHistory(CCDebugRectHistory::create()) -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCProxy.h
r115355 r116594 87 87 virtual void setVisible(bool) = 0; 88 88 89 virtual void didAddAnimation() = 0; 90 89 91 virtual bool commitRequested() const = 0; 90 92 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r116587 r116594 33 33 #include "cc/CCLayerTreeHost.h" 34 34 #include "cc/CCTextureUpdater.h" 35 #include "cc/CCTimer.h" 35 36 #include <wtf/CurrentTime.h> 36 37 … … 57 58 }; 58 59 60 class CCSingleThreadProxyAnimationTimer : public CCTimer, CCTimerClient { 61 public: 62 static PassOwnPtr<CCSingleThreadProxyAnimationTimer> create(CCSingleThreadProxy* proxy) { return adoptPtr(new CCSingleThreadProxyAnimationTimer(proxy)); } 63 64 virtual void onTimerFired() OVERRIDE 65 { 66 m_proxy->compositeImmediately(); 67 } 68 69 private: 70 explicit CCSingleThreadProxyAnimationTimer(CCSingleThreadProxy* proxy) 71 : CCTimer(CCProxy::mainThread(), this) 72 , m_proxy(proxy) 73 { 74 } 75 76 CCSingleThreadProxy* m_proxy; 77 }; 78 79 // Measured in seconds. 80 static const double animationTimerDelay = 1 / 60.0; 81 59 82 PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) 60 83 { … … 66 89 , m_contextLost(false) 67 90 , m_compositorIdentifier(-1) 91 , m_animationTimer(CCSingleThreadProxyAnimationTimer::create(this)) 68 92 , m_layerRendererInitialized(false) 69 93 , m_nextFrameIsNewlyCommittedFrame(false) … … 277 301 } 278 302 303 void CCSingleThreadProxy::didAddAnimation() 304 { 305 m_animationTimer->startOneShot(animationTimerDelay); 306 } 307 279 308 void CCSingleThreadProxy::stop() 280 309 { … … 346 375 ASSERT(!m_contextLost); 347 376 { 348 DebugScopedSetImplThread impl; 349 double monotonicTime = monotonicallyIncreasingTime(); 350 double wallClockTime = currentTime(); 351 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 352 353 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only 354 // be used when such a frame is possible. Since drawLayers() depends on the result of 355 // prepareToDraw(), it is guarded on canDraw() as well. 356 if (!m_layerTreeHostImpl->canDraw()) 357 return false; 358 359 CCLayerTreeHostImpl::FrameData frame; 360 m_layerTreeHostImpl->prepareToDraw(frame); 361 m_layerTreeHostImpl->drawLayers(frame); 362 m_layerTreeHostImpl->didDrawAllLayers(frame); 377 DebugScopedSetImplThread impl; 378 double monotonicTime = monotonicallyIncreasingTime(); 379 double wallClockTime = currentTime(); 380 381 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 382 383 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only 384 // be used when such a frame is possible. Since drawLayers() depends on the result of 385 // prepareToDraw(), it is guarded on canDraw() as well. 386 if (!m_layerTreeHostImpl->canDraw() || !m_layerTreeHostImpl->visible()) 387 return false; 388 389 CCLayerTreeHostImpl::FrameData frame; 390 m_layerTreeHostImpl->prepareToDraw(frame); 391 m_layerTreeHostImpl->drawLayers(frame); 392 m_layerTreeHostImpl->didDrawAllLayers(frame); 363 393 } 364 394 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r115881 r116594 36 36 37 37 class CCLayerTreeHost; 38 class CCSingleThreadProxyAnimationTimer; 38 39 39 40 class CCSingleThreadProxy : public CCProxy, CCLayerTreeHostImplClient { … … 60 61 virtual bool commitRequested() const OVERRIDE; 61 62 virtual void setVisible(bool) OVERRIDE; 63 virtual void didAddAnimation() OVERRIDE; 62 64 virtual void start() OVERRIDE; 63 65 virtual void stop() OVERRIDE; … … 94 96 // be used for anything else. 95 97 RefPtr<GraphicsContext3D> m_contextBeforeInitialization; 98 99 OwnPtr<CCSingleThreadProxyAnimationTimer> m_animationTimer; 96 100 97 101 // Used on the CCThread, but checked on main thread during initialization/shutdown. -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCThreadProxy.h
r115881 r116594 69 69 virtual bool commitRequested() const OVERRIDE; 70 70 virtual void setVisible(bool) OVERRIDE; 71 virtual void didAddAnimation() OVERRIDE { } 71 72 virtual void start() OVERRIDE; 72 73 virtual void stop() OVERRIDE; -
trunk/Source/WebKit/chromium/ChangeLog
r116592 r116594 1 2012-05-09 Ian Vollick <vollick@chromium.org> 2 3 [chromium] Ensure animations get ticked at least once when added. 4 https://bugs.webkit.org/show_bug.cgi?id=86013 5 6 Reviewed by James Robinson. 7 8 * tests/CCLayerTreeHostTest.cpp: 9 (WTF::CCLayerTreeHostTestTickAnimationWhileBackgrounded::animateLayers): 10 (WTF): 11 1 12 2012-05-09 Adam Barth <abarth@webkit.org> 2 13 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r116587 r116594 1136 1136 virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) 1137 1137 { 1138 if (!m_numAnimates) { 1139 // We have a long animation running. It should continue to tick even if we are not visible. 1140 postSetVisibleToMainThread(false); 1138 if (m_numAnimates < 2) { 1139 if (!m_numAnimates) { 1140 // We have a long animation running. It should continue to tick even if we are not visible. 1141 postSetVisibleToMainThread(false); 1142 } 1141 1143 m_numAnimates++; 1142 1144 return; … … 1153 1155 }; 1154 1156 1155 #if OS(WINDOWS) 1156 // http://webkit.org/b/74623 1157 TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, FLAKY_runMultiThread) 1158 #else 1159 TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread) 1160 #endif 1161 { 1162 runTestThreaded(); 1163 } 1157 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded) 1164 1158 1165 1159 // Ensures that animations continue to be ticked when we are backgrounded. … … 1196 1190 }; 1197 1191 1198 #if OS(WINDOWS) 1199 // http://webkit.org/b/74623 1200 TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, FLAKY_runMultiThread) 1201 #else 1202 TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread) 1203 #endif 1204 { 1205 runTestThreaded(); 1206 } 1192 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction) 1207 1193 1208 1194 // Ensures that when opacity is being animated, this value does not cause the subtree to be skipped. … … 1281 1267 }; 1282 1268 1283 TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes, runMultiThread) 1284 { 1285 runTestThreaded(); 1286 } 1269 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes) 1287 1270 1288 1271 // Ensures that main thread animations have their start times synchronized with impl thread animations. … … 1310 1293 }; 1311 1294 1312 TEST_F(CCLayerTreeHostTestAnimationFinishedEvents, runMultiThread) 1313 { 1314 runTestThreaded(); 1315 } 1295 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAnimationFinishedEvents) 1316 1296 1317 1297 class CCLayerTreeHostTestScrollSimple : public CCLayerTreeHostTestThreadOnly {
Note: See TracChangeset
for help on using the changeset viewer.