Changeset 229317 in webkit


Ignore:
Timestamp:
Mar 6, 2018 3:51:53 AM (6 years ago)
Author:
zandobersek@gmail.com
Message:

[CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
https://bugs.webkit.org/show_bug.cgi?id=183360

Reviewed by Sergio Villar Senin.

Source/WebCore:

When animations are being applied on the TextureMapperLayer tree, the
monotonic time value is retrieved repeatedly in TextureMapperAnimation
class. Instead of spawning repeated syscalls that are required to obtain
the time value, TextureMapperLayer::applyAnimationsRecursively() now
accepts a MonotonicTime value that should be used for all animation
updates.

No new tests -- no change in behavior.

  • platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:

(WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):

  • platform/graphics/texmap/TextureMapperAnimation.cpp:

(WebCore::TextureMapperAnimation::apply):
(WebCore::TextureMapperAnimation::computeTotalRunningTime):
(WebCore::TextureMapperAnimations::apply):

  • platform/graphics/texmap/TextureMapperAnimation.h:

(WebCore::TextureMapperAnimation::keyframes const):
(WebCore::TextureMapperAnimation::animation const):
(WebCore::TextureMapperAnimation::boxSize const): Deleted.
(WebCore::TextureMapperAnimation::listsMatch const): Deleted.
(WebCore::TextureMapperAnimation::startTime const): Deleted.
(WebCore::TextureMapperAnimation::pauseTime const): Deleted.

  • platform/graphics/texmap/TextureMapperLayer.cpp:

(WebCore::TextureMapperLayer::applyAnimationsRecursively):
(WebCore::TextureMapperLayer::syncAnimations):

  • platform/graphics/texmap/TextureMapperLayer.h:

Source/WebKit:

  • Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:

(WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
Pass the monotic time value, as returned by MonotonicTime::now(), to the
TextureMapperLayer::applyAnimationsRecursively() call.

Location:
trunk/Source
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r229316 r229317  
     12018-03-06  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
     4        https://bugs.webkit.org/show_bug.cgi?id=183360
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        When animations are being applied on the TextureMapperLayer tree, the
     9        monotonic time value is retrieved repeatedly in TextureMapperAnimation
     10        class. Instead of spawning repeated syscalls that are required to obtain
     11        the time value, TextureMapperLayer::applyAnimationsRecursively() now
     12        accepts a MonotonicTime value that should be used for all animation
     13        updates.
     14
     15        No new tests -- no change in behavior.
     16
     17        * platform/graphics/texmap/GraphicsLayerTextureMapper.cpp:
     18        (WebCore::GraphicsLayerTextureMapper::flushCompositingStateForThisLayerOnly):
     19        * platform/graphics/texmap/TextureMapperAnimation.cpp:
     20        (WebCore::TextureMapperAnimation::apply):
     21        (WebCore::TextureMapperAnimation::computeTotalRunningTime):
     22        (WebCore::TextureMapperAnimations::apply):
     23        * platform/graphics/texmap/TextureMapperAnimation.h:
     24        (WebCore::TextureMapperAnimation::keyframes const):
     25        (WebCore::TextureMapperAnimation::animation const):
     26        (WebCore::TextureMapperAnimation::boxSize const): Deleted.
     27        (WebCore::TextureMapperAnimation::listsMatch const): Deleted.
     28        (WebCore::TextureMapperAnimation::startTime const): Deleted.
     29        (WebCore::TextureMapperAnimation::pauseTime const): Deleted.
     30        * platform/graphics/texmap/TextureMapperLayer.cpp:
     31        (WebCore::TextureMapperLayer::applyAnimationsRecursively):
     32        (WebCore::TextureMapperLayer::syncAnimations):
     33        * platform/graphics/texmap/TextureMapperLayer.h:
     34
    1352018-03-06  Zan Dobersek  <zdobersek@igalia.com>
    236
  • trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp

    r229313 r229317  
    367367    prepareBackingStoreIfNeeded();
    368368    commitLayerChanges();
    369     m_layer.syncAnimations();
     369    m_layer.syncAnimations(MonotonicTime::now());
    370370}
    371371
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp

    r229209 r229317  
    193193}
    194194
    195 void TextureMapperAnimation::apply(Client& client)
     195void TextureMapperAnimation::apply(Client& client, MonotonicTime time)
    196196{
    197197    if (!isActive())
    198198        return;
    199199
    200     Seconds totalRunningTime = computeTotalRunningTime();
     200    Seconds totalRunningTime = computeTotalRunningTime(time);
    201201    double normalizedValue = normalizedAnimationValue(totalRunningTime.seconds(), m_animation->duration(), m_animation->direction(), m_animation->iterationCount());
    202202
     
    254254}
    255255
    256 Seconds TextureMapperAnimation::computeTotalRunningTime()
     256Seconds TextureMapperAnimation::computeTotalRunningTime(MonotonicTime time)
    257257{
    258258    if (m_state == AnimationState::Paused)
     
    260260
    261261    MonotonicTime oldLastRefreshedTime = m_lastRefreshedTime;
    262     m_lastRefreshedTime = MonotonicTime::now();
     262    m_lastRefreshedTime = time;
    263263    m_totalRunningTime += m_lastRefreshedTime - oldLastRefreshedTime;
    264264    return m_totalRunningTime;
     
    331331}
    332332
    333 void TextureMapperAnimations::apply(TextureMapperAnimation::Client& client)
     333void TextureMapperAnimations::apply(TextureMapperAnimation::Client& client, MonotonicTime time)
    334334{
    335335    for (auto& animation : m_animations)
    336         animation.apply(client);
     336        animation.apply(client, time);
    337337}
    338338
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h

    r229174 r229317  
    4444    WEBCORE_EXPORT TextureMapperAnimation(const TextureMapperAnimation&);
    4545
    46     void apply(Client&);
     46    void apply(Client&, MonotonicTime);
    4747    void pause(Seconds);
    4848    void resume();
     
    5151    const String& name() const { return m_name; }
    5252    const KeyframeValueList& keyframes() const { return m_keyframes; }
    53     const FloatSize& boxSize() const { return m_boxSize; }
    5453    const RefPtr<Animation> animation() const { return m_animation; }
    55     bool listsMatch() const { return m_listsMatch; }
    56     MonotonicTime startTime() const { return m_startTime; }
    57     Seconds pauseTime() const { return m_pauseTime; }
    5854    AnimationState state() const { return m_state; }
    5955
    6056private:
    6157    void applyInternal(Client&, const AnimationValue& from, const AnimationValue& to, float progress);
    62     Seconds computeTotalRunningTime();
     58    Seconds computeTotalRunningTime(MonotonicTime);
    6359
    6460    String m_name;
     
    8581    void resume();
    8682
    87     void apply(TextureMapperAnimation::Client&);
     83    void apply(TextureMapperAnimation::Client&, MonotonicTime);
    8884
    8985    bool isEmpty() const { return m_animations.isEmpty(); }
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp

    r227729 r229317  
    662662}
    663663
    664 void TextureMapperLayer::applyAnimationsRecursively()
    665 {
    666     syncAnimations();
     664void TextureMapperLayer::applyAnimationsRecursively(MonotonicTime time)
     665{
     666    syncAnimations(time);
    667667    for (auto* child : m_children)
    668         child->applyAnimationsRecursively();
    669 }
    670 
    671 void TextureMapperLayer::syncAnimations()
    672 {
    673     m_animations.apply(*this);
     668        child->applyAnimationsRecursively(time);
     669}
     670
     671void TextureMapperLayer::syncAnimations(MonotonicTime time)
     672{
     673    m_animations.apply(*this, time);
    674674    if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyTransform))
    675675        m_currentTransform.setLocalTransform(m_state.transform);
  • trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h

    r226657 r229317  
    120120    void setBackingStore(RefPtr<TextureMapperBackingStore>&&);
    121121
    122     void syncAnimations();
     122    void syncAnimations(MonotonicTime);
    123123    bool descendantsOrSelfHaveRunningAnimations() const;
    124124
     
    127127    void setScrollPositionDeltaIfNeeded(const FloatSize&);
    128128
    129     void applyAnimationsRecursively();
     129    void applyAnimationsRecursively(MonotonicTime);
    130130    void addChild(TextureMapperLayer*);
    131131
  • trunk/Source/WebKit/ChangeLog

    r229316 r229317  
     12018-03-06  Zan Dobersek  <zdobersek@igalia.com>
     2
     3        [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
     4        https://bugs.webkit.org/show_bug.cgi?id=183360
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
     9        (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
     10        Pass the monotic time value, as returned by MonotonicTime::now(), to the
     11        TextureMapperLayer::applyAnimationsRecursively() call.
     12
    1132018-03-06  Zan Dobersek  <zdobersek@igalia.com>
    214
  • trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp

    r229315 r229317  
    104104
    105105    currentRootLayer->setTextureMapper(m_textureMapper.get());
    106     currentRootLayer->applyAnimationsRecursively();
     106    currentRootLayer->applyAnimationsRecursively(MonotonicTime::now());
    107107    m_textureMapper->beginPainting(PaintFlags);
    108108    m_textureMapper->beginClip(TransformationMatrix(), clipRect);
Note: See TracChangeset for help on using the changeset viewer.