Changeset 117960 in webkit
- Timestamp:
- May 22, 2012 6:03:33 AM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r117958 r117960 1 2012-05-22 Ian Vollick <vollick@chromium.org> 2 3 [chromium] Speed up CCLayerTreeHostTestTickAnimationWhileBackgrounded 4 https://bugs.webkit.org/show_bug.cgi?id=86871 5 6 Reviewed by James Robinson. 7 8 With this patch, the background animation timer is lazily created, 9 allowing for different time intervals to be used. In particular, a 10 very short interval for unit tests. 11 12 Unit tests: CCLayerTreeHostTestTickAnimationWhileBackgrounded.runSingleThread 13 CCLayerTreeHostTestTickAnimationWhileBackgrounded.runMultiThread 14 15 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp: 16 (WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl): 17 (WebCore::CCLayerTreeHostImpl::setBackgroundTickingEnabled): 18 (WebCore): 19 (WebCore::CCLayerTreeHostImpl::setVisible): 20 (WebCore::CCLayerTreeHostImpl::animateLayers): 21 (WebCore::CCLayerTreeHostImpl::lowFrequencyAnimationInterval): 22 * platform/graphics/chromium/cc/CCLayerTreeHostImpl.h: 23 (CCLayerTreeHostImpl): 24 * platform/graphics/chromium/cc/CCSingleThreadProxy.cpp: 25 (WebCore::CCSingleThreadProxy::setVisible): 26 1 27 2012-05-22 Alexander Pavlov <apavlov@chromium.org> 2 28 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp
r117535 r117960 44 44 #include "cc/CCPageScaleAnimation.h" 45 45 #include "cc/CCRenderSurfaceDrawQuad.h" 46 #include "cc/CCSingleThreadProxy.h" 46 47 #include "cc/CCThreadTask.h" 47 48 #include <wtf/CurrentTime.h> 48 49 49 50 namespace { 50 const double lowFrequencyAnimationInterval = 1;51 51 52 52 void didVisibilityChange(WebCore::CCLayerTreeHostImpl* id, bool visible) … … 79 79 virtual void onTimerTick() OVERRIDE 80 80 { 81 // FIXME: We require that animate be called on the impl thread. This 82 // avoids asserts in single threaded mode. Ideally background ticking 83 // would be handled by the proxy/scheduler and this could be removed. 84 DebugScopedSetImplThread impl; 85 81 86 m_layerTreeHostImpl->animate(monotonicallyIncreasingTime(), currentTime()); 82 87 } … … 120 125 , m_needsAnimateLayers(false) 121 126 , m_pinchGestureActive(false) 122 , m_timeSourceClientAdapter(CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval, CCProxy::currentThread())))123 127 , m_fpsCounter(CCFrameRateCounter::create()) 124 128 , m_debugRectHistory(CCDebugRectHistory::create()) … … 371 375 } 372 376 377 void CCLayerTreeHostImpl::setBackgroundTickingEnabled(bool enabled) 378 { 379 // Lazily create the timeSource adapter so that we can vary the interval for testing. 380 if (!m_timeSourceClientAdapter) 381 m_timeSourceClientAdapter = CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval(), CCProxy::currentThread())); 382 383 m_timeSourceClientAdapter->setActive(enabled); 384 } 385 373 386 IntSize CCLayerTreeHostImpl::contentSize() const 374 387 { … … 515 528 void CCLayerTreeHostImpl::setVisible(bool visible) 516 529 { 530 ASSERT(CCProxy::isImplThread()); 531 517 532 if (m_visible == visible) 518 533 return; … … 525 540 m_layerRenderer->setVisible(visible); 526 541 527 const bool shouldTickInBackground = !visible && m_needsAnimateLayers; 528 m_timeSourceClientAdapter->setActive(shouldTickInBackground); 542 setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); 529 543 } 530 544 … … 864 878 m_client->setNeedsRedrawOnImplThread(); 865 879 866 const bool shouldTickInBackground = m_needsAnimateLayers && !m_visible; 867 m_timeSourceClientAdapter->setActive(shouldTickInBackground); 880 setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers); 881 } 882 883 double CCLayerTreeHostImpl::lowFrequencyAnimationInterval() const 884 { 885 return 1; 868 886 } 869 887 -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h
r117535 r117960 178 178 virtual void animateLayers(double monotonicTime, double wallClockTime); 179 179 180 // Virtual for testing. Measured in seconds. 181 virtual double lowFrequencyAnimationInterval() const; 182 180 183 CCLayerTreeHostImplClient* m_client; 181 184 int m_sourceFrameNumber; … … 198 201 bool calculateRenderPasses(CCRenderPassList&, CCLayerList& renderSurfaceLayerList); 199 202 void animateLayersRecursive(CCLayerImpl*, double monotonicTime, double wallClockTime, CCAnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers); 203 void setBackgroundTickingEnabled(bool); 200 204 IntSize contentSize() const; 201 205 void sendDidLoseContextRecursive(CCLayerImpl*); -
trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp
r117171 r117960 274 274 void CCSingleThreadProxy::setVisible(bool visible) 275 275 { 276 DebugScopedSetImplThread impl; 276 277 m_layerTreeHostImpl->setVisible(visible); 277 278 278 279 if (!visible) { 279 DebugScopedSetImplThread impl; 280 280 281 m_layerTreeHost->didBecomeInvisibleOnImplThread(m_layerTreeHostImpl.get()); 281 282 return; 282 283 } 283 284 284 setNeedsCommit(); 285 { 286 DebugScopedSetMainThread main; 287 setNeedsCommit(); 288 } 285 289 } 286 290 -
trunk/Source/WebKit/chromium/ChangeLog
r117915 r117960 1 2012-05-22 Ian Vollick <vollick@chromium.org> 2 3 [chromium] Speed up CCLayerTreeHostTestTickAnimationWhileBackgrounded 4 https://bugs.webkit.org/show_bug.cgi?id=86871 5 6 Reviewed by James Robinson. 7 8 Use a shorter time interval for background animation ticking so that 9 unit tests can run faster. 10 11 * tests/CCLayerTreeHostTest.cpp: 12 (WTF::MockLayerTreeHostImpl::lowFrequencyAnimationInterval): 13 (MockLayerTreeHostImpl): 14 1 15 2012-05-21 Alexandre Elias <aelias@google.com> 2 16 -
trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp
r117864 r117960 136 136 } 137 137 138 virtual double lowFrequencyAnimationInterval() const 139 { 140 return 1.0 / 60; 141 } 142 138 143 private: 139 144 MockLayerTreeHostImpl(TestHooks* testHooks, const CCSettings& settings, CCLayerTreeHostImplClient* client)
Note: See TracChangeset
for help on using the changeset viewer.