Changeset 117171 in webkit
- Timestamp:
- May 15, 2012 3:51:01 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117170 r117171 1 2012-05-15 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/CCLayerTreeHost.cpp: 17 (WebCore::CCLayerTreeHost::finishCommitOnImplThread): 18 (WebCore::CCLayerTreeHost::didAddAnimation): 19 (WebCore): 20 (WebCore::CCLayerTreeHost::didBecomeInvisibleOnImplThread): 21 * platform/graphics/chromium/cc/CCLayerTreeHost.h: 22 (CCLayerTreeHost): 23 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 24 (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): 25 * platform/graphics/chromium/cc/CCProxy.h: 26 (CCProxy): 27 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 28 (CCSingleThreadProxyAnimationTimer): 29 (WebCore::CCSingleThreadProxyAnimationTimer::create): 30 (WebCore::CCSingleThreadProxyAnimationTimer::CCSingleThreadProxyAnimationTimer): 31 (WebCore): 32 (WebCore::CCSingleThreadProxy::CCSingleThreadProxy): 33 (WebCore::CCSingleThreadProxy::didAddAnimation): 34 (WebCore::CCSingleThreadProxy::doComposite): 35 * platform/graphics/chromium/cc/CCSingleThreadProxy.h: 36 (WebCore): 37 * platform/graphics/chromium/cc/CCThreadProxy.h: 38 1 39 2012-05-15 Alexandre Elias <aelias@google.com> 2 40 -
trunk/Source/WebCore/platform/graphics/chromium/LayerChromium.cpp
r116786 r117171 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/CCLayerTreeHost.cpp
r116714 r117171 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
r116722 r117171 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
r116779 r117171 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
r116979 r117171 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
r116979 r117171 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 … … 38 39 39 40 namespace WebCore { 41 42 class CCSingleThreadProxyAnimationTimer : public CCTimer, CCTimerClient { 43 public: 44 static PassOwnPtr<CCSingleThreadProxyAnimationTimer> create(CCSingleThreadProxy* proxy) { return adoptPtr(new CCSingleThreadProxyAnimationTimer(proxy)); } 45 46 virtual void onTimerFired() OVERRIDE 47 { 48 m_proxy->compositeImmediately(); 49 } 50 51 private: 52 explicit CCSingleThreadProxyAnimationTimer(CCSingleThreadProxy* proxy) 53 : CCTimer(CCProxy::mainThread(), this) 54 , m_proxy(proxy) 55 { 56 } 57 58 CCSingleThreadProxy* m_proxy; 59 }; 60 61 // Measured in seconds. 62 static const double animationTimerDelay = 1 / 60.0; 40 63 41 64 PassOwnPtr<CCProxy> CCSingleThreadProxy::create(CCLayerTreeHost* layerTreeHost) … … 48 71 , m_contextLost(false) 49 72 , m_compositorIdentifier(-1) 73 , m_animationTimer(CCSingleThreadProxyAnimationTimer::create(this)) 50 74 , m_layerRendererInitialized(false) 51 75 , m_nextFrameIsNewlyCommittedFrame(false) … … 261 285 } 262 286 287 void CCSingleThreadProxy::didAddAnimation() 288 { 289 m_animationTimer->startOneShot(animationTimerDelay); 290 } 291 263 292 void CCSingleThreadProxy::stop() 264 293 { … … 332 361 ASSERT(!m_contextLost); 333 362 { 334 DebugScopedSetImplThread impl; 335 double monotonicTime = monotonicallyIncreasingTime(); 336 double wallClockTime = currentTime(); 337 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 338 339 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only 340 // be used when such a frame is possible. Since drawLayers() depends on the result of 341 // prepareToDraw(), it is guarded on canDraw() as well. 342 if (!m_layerTreeHostImpl->canDraw()) 343 return false; 344 345 CCLayerTreeHostImpl::FrameData frame; 346 m_layerTreeHostImpl->prepareToDraw(frame); 347 m_layerTreeHostImpl->drawLayers(frame); 348 m_layerTreeHostImpl->didDrawAllLayers(frame); 363 DebugScopedSetImplThread impl; 364 double monotonicTime = monotonicallyIncreasingTime(); 365 double wallClockTime = currentTime(); 366 367 m_layerTreeHostImpl->animate(monotonicTime, wallClockTime); 368 369 // We guard prepareToDraw() with canDraw() because it always returns a valid frame, so can only 370 // be used when such a frame is possible. Since drawLayers() depends on the result of 371 // prepareToDraw(), it is guarded on canDraw() as well. 372 if (!m_layerTreeHostImpl->canDraw()) 373 return false; 374 375 CCLayerTreeHostImpl::FrameData frame; 376 m_layerTreeHostImpl->prepareToDraw(frame); 377 m_layerTreeHostImpl->drawLayers(frame); 378 m_layerTreeHostImpl->didDrawAllLayers(frame); 349 379 } 350 380 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.h
r116714 r117171 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
r116714 r117171 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
r117170 r117171 1 2012-05-15 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-15 Alexandre Elias <aelias@google.com> 2 13 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r116714 r117171 1141 1141 virtual void animateLayers(CCLayerTreeHostImpl* layerTreeHostImpl, double monotonicTime) 1142 1142 { 1143 if (!m_numAnimates) { 1144 // We have a long animation running. It should continue to tick even if we are not visible. 1145 postSetVisibleToMainThread(false); 1143 if (m_numAnimates < 2) { 1144 if (!m_numAnimates) { 1145 // We have a long animation running. It should continue to tick even if we are not visible. 1146 postSetVisibleToMainThread(false); 1147 } 1146 1148 m_numAnimates++; 1147 1149 return; … … 1158 1160 }; 1159 1161 1160 #if OS(WINDOWS) 1161 // http://webkit.org/b/74623 1162 TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, FLAKY_runMultiThread) 1163 #else 1164 TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded, runMultiThread) 1165 #endif 1166 { 1167 runTestThreaded(); 1168 } 1162 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestTickAnimationWhileBackgrounded) 1169 1163 1170 1164 // Ensures that animations continue to be ticked when we are backgrounded. … … 1201 1195 }; 1202 1196 1203 #if OS(WINDOWS) 1204 // http://webkit.org/b/74623 1205 TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, FLAKY_runMultiThread) 1206 #else 1207 TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction, runMultiThread) 1208 #endif 1209 { 1210 runTestThreaded(); 1211 } 1197 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAddAnimationWithTimingFunction) 1212 1198 1213 1199 // Ensures that when opacity is being animated, this value does not cause the subtree to be skipped. … … 1291 1277 }; 1292 1278 1293 TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes, runMultiThread) 1294 { 1295 runTestThreaded(); 1296 } 1279 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestSynchronizeAnimationStartTimes) 1297 1280 1298 1281 // Ensures that main thread animations have their start times synchronized with impl thread animations. … … 1320 1303 }; 1321 1304 1322 TEST_F(CCLayerTreeHostTestAnimationFinishedEvents, runMultiThread) 1323 { 1324 runTestThreaded(); 1325 } 1305 SINGLE_AND_MULTI_THREAD_TEST_F(CCLayerTreeHostTestAnimationFinishedEvents) 1326 1306 1327 1307 class CCLayerTreeHostTestScrollSimple : public CCLayerTreeHostTestThreadOnly {
Note: See TracChangeset
for help on using the changeset viewer.