Title: [229317] trunk/Source
Revision
229317
Author
zandober...@gmail.com
Date
2018-03-06 03:51:53 -0800 (Tue, 06 Mar 2018)

Log 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.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (229316 => 229317)


--- trunk/Source/WebCore/ChangeLog	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebCore/ChangeLog	2018-03-06 11:51:53 UTC (rev 229317)
@@ -1,5 +1,39 @@
 2018-03-06  Zan Dobersek  <zdober...@igalia.com>
 
+        [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
+        https://bugs.webkit.org/show_bug.cgi?id=183360
+
+        Reviewed by Sergio Villar Senin.
+
+        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:
+
+2018-03-06  Zan Dobersek  <zdober...@igalia.com>
+
         [CoordGraphics] Clean up CoordinatedImageBacking
         https://bugs.webkit.org/show_bug.cgi?id=183332
 

Modified: trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp (229316 => 229317)


--- trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebCore/platform/graphics/texmap/GraphicsLayerTextureMapper.cpp	2018-03-06 11:51:53 UTC (rev 229317)
@@ -366,7 +366,7 @@
 {
     prepareBackingStoreIfNeeded();
     commitLayerChanges();
-    m_layer.syncAnimations();
+    m_layer.syncAnimations(MonotonicTime::now());
 }
 
 void GraphicsLayerTextureMapper::prepareBackingStoreIfNeeded()

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp (229316 => 229317)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp	2018-03-06 11:51:53 UTC (rev 229317)
@@ -192,12 +192,12 @@
 {
 }
 
-void TextureMapperAnimation::apply(Client& client)
+void TextureMapperAnimation::apply(Client& client, MonotonicTime time)
 {
     if (!isActive())
         return;
 
-    Seconds totalRunningTime = computeTotalRunningTime();
+    Seconds totalRunningTime = computeTotalRunningTime(time);
     double normalizedValue = normalizedAnimationValue(totalRunningTime.seconds(), m_animation->duration(), m_animation->direction(), m_animation->iterationCount());
 
     if (m_animation->iterationCount() != Animation::IterationCountInfinite && totalRunningTime.seconds() >= m_animation->duration() * m_animation->iterationCount()) {
@@ -253,13 +253,13 @@
     m_lastRefreshedTime = MonotonicTime::now();
 }
 
-Seconds TextureMapperAnimation::computeTotalRunningTime()
+Seconds TextureMapperAnimation::computeTotalRunningTime(MonotonicTime time)
 {
     if (m_state == AnimationState::Paused)
         return m_pauseTime;
 
     MonotonicTime oldLastRefreshedTime = m_lastRefreshedTime;
-    m_lastRefreshedTime = MonotonicTime::now();
+    m_lastRefreshedTime = time;
     m_totalRunningTime += m_lastRefreshedTime - oldLastRefreshedTime;
     return m_totalRunningTime;
 }
@@ -330,10 +330,10 @@
         animation.resume();
 }
 
-void TextureMapperAnimations::apply(TextureMapperAnimation::Client& client)
+void TextureMapperAnimations::apply(TextureMapperAnimation::Client& client, MonotonicTime time)
 {
     for (auto& animation : m_animations)
-        animation.apply(client);
+        animation.apply(client, time);
 }
 
 bool TextureMapperAnimations::hasActiveAnimationsOfType(AnimatedPropertyID type) const

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h (229316 => 229317)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.h	2018-03-06 11:51:53 UTC (rev 229317)
@@ -43,7 +43,7 @@
     TextureMapperAnimation(const String&, const KeyframeValueList&, const FloatSize&, const Animation&, bool, MonotonicTime, Seconds, AnimationState);
     WEBCORE_EXPORT TextureMapperAnimation(const TextureMapperAnimation&);
 
-    void apply(Client&);
+    void apply(Client&, MonotonicTime);
     void pause(Seconds);
     void resume();
     bool isActive() const;
@@ -50,16 +50,12 @@
 
     const String& name() const { return m_name; }
     const KeyframeValueList& keyframes() const { return m_keyframes; }
-    const FloatSize& boxSize() const { return m_boxSize; }
     const RefPtr<Animation> animation() const { return m_animation; }
-    bool listsMatch() const { return m_listsMatch; }
-    MonotonicTime startTime() const { return m_startTime; }
-    Seconds pauseTime() const { return m_pauseTime; }
     AnimationState state() const { return m_state; }
 
 private:
     void applyInternal(Client&, const AnimationValue& from, const AnimationValue& to, float progress);
-    Seconds computeTotalRunningTime();
+    Seconds computeTotalRunningTime(MonotonicTime);
 
     String m_name;
     KeyframeValueList m_keyframes;
@@ -84,7 +80,7 @@
     void suspend(MonotonicTime);
     void resume();
 
-    void apply(TextureMapperAnimation::Client&);
+    void apply(TextureMapperAnimation::Client&, MonotonicTime);
 
     bool isEmpty() const { return m_animations.isEmpty(); }
     size_t size() const { return m_animations.size(); }

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp (229316 => 229317)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.cpp	2018-03-06 11:51:53 UTC (rev 229317)
@@ -661,16 +661,16 @@
         });
 }
 
-void TextureMapperLayer::applyAnimationsRecursively()
+void TextureMapperLayer::applyAnimationsRecursively(MonotonicTime time)
 {
-    syncAnimations();
+    syncAnimations(time);
     for (auto* child : m_children)
-        child->applyAnimationsRecursively();
+        child->applyAnimationsRecursively(time);
 }
 
-void TextureMapperLayer::syncAnimations()
+void TextureMapperLayer::syncAnimations(MonotonicTime time)
 {
-    m_animations.apply(*this);
+    m_animations.apply(*this, time);
     if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyTransform))
         m_currentTransform.setLocalTransform(m_state.transform);
     if (!m_animations.hasActiveAnimationsOfType(AnimatedPropertyOpacity))

Modified: trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h (229316 => 229317)


--- trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebCore/platform/graphics/texmap/TextureMapperLayer.h	2018-03-06 11:51:53 UTC (rev 229317)
@@ -119,7 +119,7 @@
     bool fixedToViewport() const { return m_fixedToViewport; }
     void setBackingStore(RefPtr<TextureMapperBackingStore>&&);
 
-    void syncAnimations();
+    void syncAnimations(MonotonicTime);
     bool descendantsOrSelfHaveRunningAnimations() const;
 
     void paint();
@@ -126,7 +126,7 @@
 
     void setScrollPositionDeltaIfNeeded(const FloatSize&);
 
-    void applyAnimationsRecursively();
+    void applyAnimationsRecursively(MonotonicTime);
     void addChild(TextureMapperLayer*);
 
 private:

Modified: trunk/Source/WebKit/ChangeLog (229316 => 229317)


--- trunk/Source/WebKit/ChangeLog	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebKit/ChangeLog	2018-03-06 11:51:53 UTC (rev 229317)
@@ -1,5 +1,17 @@
 2018-03-06  Zan Dobersek  <zdober...@igalia.com>
 
+        [CoordGraphics] Apply TextureMapperLayer animations with a single MonotonicTime value
+        https://bugs.webkit.org/show_bug.cgi?id=183360
+
+        Reviewed by Sergio Villar Senin.
+
+        * Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp:
+        (WebKit::CoordinatedGraphicsScene::paintToCurrentGLContext):
+        Pass the monotic time value, as returned by MonotonicTime::now(), to the
+        TextureMapperLayer::applyAnimationsRecursively() call.
+
+2018-03-06  Zan Dobersek  <zdober...@igalia.com>
+
         [CoordGraphics] Clean up CoordinatedImageBacking
         https://bugs.webkit.org/show_bug.cgi?id=183332
 

Modified: trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp (229316 => 229317)


--- trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-03-06 11:35:22 UTC (rev 229316)
+++ trunk/Source/WebKit/Shared/CoordinatedGraphics/CoordinatedGraphicsScene.cpp	2018-03-06 11:51:53 UTC (rev 229317)
@@ -103,7 +103,7 @@
 #endif
 
     currentRootLayer->setTextureMapper(m_textureMapper.get());
-    currentRootLayer->applyAnimationsRecursively();
+    currentRootLayer->applyAnimationsRecursively(MonotonicTime::now());
     m_textureMapper->beginPainting(PaintFlags);
     m_textureMapper->beginClip(TransformationMatrix(), clipRect);
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to