Changeset 117960 in webkit


Ignore:
Timestamp:
May 22, 2012 6:03:33 AM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[chromium] Speed up CCLayerTreeHostTestTickAnimationWhileBackgrounded
https://bugs.webkit.org/show_bug.cgi?id=86871

Patch by Ian Vollick <vollick@chromium.org> on 2012-05-22
Reviewed by James Robinson.

Source/WebCore:

With this patch, the background animation timer is lazily created,
allowing for different time intervals to be used. In particular, a
very short interval for unit tests.

Unit tests: CCLayerTreeHostTestTickAnimationWhileBackgrounded.runSingleThread

CCLayerTreeHostTestTickAnimationWhileBackgrounded.runMultiThread

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp:

(WebCore::CCLayerTreeHostImpl::CCLayerTreeHostImpl):
(WebCore::CCLayerTreeHostImpl::setBackgroundTickingEnabled):
(WebCore):
(WebCore::CCLayerTreeHostImpl::setVisible):
(WebCore::CCLayerTreeHostImpl::animateLayers):
(WebCore::CCLayerTreeHostImpl::lowFrequencyAnimationInterval):

  • platform/graphics/chromium/cc/CCLayerTreeHostImpl.h:

(CCLayerTreeHostImpl):

  • platform/graphics/chromium/cc/CCSingleThreadProxy.cpp:

(WebCore::CCSingleThreadProxy::setVisible):

Source/WebKit/chromium:

Use a shorter time interval for background animation ticking so that
unit tests can run faster.

  • tests/CCLayerTreeHostTest.cpp:

(WTF::MockLayerTreeHostImpl::lowFrequencyAnimationInterval):
(MockLayerTreeHostImpl):

Location:
trunk/Source
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r117958 r117960  
     12012-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
    1272012-05-22  Alexander Pavlov  <apavlov@chromium.org>
    228
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.cpp

    r117535 r117960  
    4444#include "cc/CCPageScaleAnimation.h"
    4545#include "cc/CCRenderSurfaceDrawQuad.h"
     46#include "cc/CCSingleThreadProxy.h"
    4647#include "cc/CCThreadTask.h"
    4748#include <wtf/CurrentTime.h>
    4849
    4950namespace {
    50 const double lowFrequencyAnimationInterval = 1;
    5151
    5252void didVisibilityChange(WebCore::CCLayerTreeHostImpl* id, bool visible)
     
    7979    virtual void onTimerTick() OVERRIDE
    8080    {
     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
    8186        m_layerTreeHostImpl->animate(monotonicallyIncreasingTime(), currentTime());
    8287    }
     
    120125    , m_needsAnimateLayers(false)
    121126    , m_pinchGestureActive(false)
    122     , m_timeSourceClientAdapter(CCLayerTreeHostImplTimeSourceAdapter::create(this, CCDelayBasedTimeSource::create(lowFrequencyAnimationInterval, CCProxy::currentThread())))
    123127    , m_fpsCounter(CCFrameRateCounter::create())
    124128    , m_debugRectHistory(CCDebugRectHistory::create())
     
    371375}
    372376
     377void 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
    373386IntSize CCLayerTreeHostImpl::contentSize() const
    374387{
     
    515528void CCLayerTreeHostImpl::setVisible(bool visible)
    516529{
     530    ASSERT(CCProxy::isImplThread());
     531
    517532    if (m_visible == visible)
    518533        return;
     
    525540    m_layerRenderer->setVisible(visible);
    526541
    527     const bool shouldTickInBackground = !visible && m_needsAnimateLayers;
    528     m_timeSourceClientAdapter->setActive(shouldTickInBackground);
     542    setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers);
    529543}
    530544
     
    864878        m_client->setNeedsRedrawOnImplThread();
    865879
    866     const bool shouldTickInBackground = m_needsAnimateLayers && !m_visible;
    867     m_timeSourceClientAdapter->setActive(shouldTickInBackground);
     880    setBackgroundTickingEnabled(!m_visible && m_needsAnimateLayers);
     881}
     882
     883double CCLayerTreeHostImpl::lowFrequencyAnimationInterval() const
     884{
     885    return 1;
    868886}
    869887
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCLayerTreeHostImpl.h

    r117535 r117960  
    178178    virtual void animateLayers(double monotonicTime, double wallClockTime);
    179179
     180    // Virtual for testing. Measured in seconds.
     181    virtual double lowFrequencyAnimationInterval() const;
     182
    180183    CCLayerTreeHostImplClient* m_client;
    181184    int m_sourceFrameNumber;
     
    198201    bool calculateRenderPasses(CCRenderPassList&, CCLayerList& renderSurfaceLayerList);
    199202    void animateLayersRecursive(CCLayerImpl*, double monotonicTime, double wallClockTime, CCAnimationEventsVector*, bool& didAnimate, bool& needsAnimateLayers);
     203    void setBackgroundTickingEnabled(bool);
    200204    IntSize contentSize() const;
    201205    void sendDidLoseContextRecursive(CCLayerImpl*);
  • trunk/Source/WebCore/platform/graphics/chromium/cc/CCSingleThreadProxy.cpp

    r117171 r117960  
    274274void CCSingleThreadProxy::setVisible(bool visible)
    275275{
     276    DebugScopedSetImplThread impl;
    276277    m_layerTreeHostImpl->setVisible(visible);
    277278
    278279    if (!visible) {
    279         DebugScopedSetImplThread impl;
     280
    280281        m_layerTreeHost->didBecomeInvisibleOnImplThread(m_layerTreeHostImpl.get());
    281282        return;
    282283    }
    283284
    284     setNeedsCommit();
     285    {
     286        DebugScopedSetMainThread main;
     287        setNeedsCommit();
     288    }
    285289}
    286290
  • trunk/Source/WebKit/chromium/ChangeLog

    r117915 r117960  
     12012-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
    1152012-05-21  Alexandre Elias  <aelias@google.com>
    216
  • trunk/Source/WebKit/chromium/tests/CCLayerTreeHostTest.cpp

    r117864 r117960  
    136136    }
    137137
     138    virtual double lowFrequencyAnimationInterval() const
     139    {
     140        return 1.0 / 60;
     141    }
     142
    138143private:
    139144    MockLayerTreeHostImpl(TestHooks* testHooks, const CCSettings& settings, CCLayerTreeHostImplClient* client)
Note: See TracChangeset for help on using the changeset viewer.