Title: [164406] trunk/Source/WebKit2
Revision
164406
Author
[email protected]
Date
2014-02-19 18:03:40 -0800 (Wed, 19 Feb 2014)

Log Message

Avoid sending redundant layer properties to the UI process, and avoid allocation of RemoteLayerBackingStore unless we need it
https://bugs.webkit.org/show_bug.cgi?id=129076

Reviewed by Tim Horton.

Normally we rely on GraphicsLayerCA to avoid redundant property
setting on PlatformCALayers, but for contents layers GraphicsLayerCA
sets properties on every update.

Make PlatformCALayerRemote more efficient in this case by not
setting dirty flags for unchanged property sets.

Also avoid creation of RemoteLayerBackingStore unless we
actually need one.

* WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
(PlatformCALayerRemote::ensureBackingStore):
(PlatformCALayerRemote::updateBackingStore):
(PlatformCALayerRemote::setBounds):
(PlatformCALayerRemote::setPosition):
(PlatformCALayerRemote::setAnchorPoint):
(PlatformCALayerRemote::setMasksToBounds):
(PlatformCALayerRemote::setAcceleratesDrawing):
(PlatformCALayerRemote::setBorderWidth):
(PlatformCALayerRemote::setBorderColor):
(PlatformCALayerRemote::setContentsScale):
* WebProcess/WebPage/mac/PlatformCALayerRemote.h:

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (164405 => 164406)


--- trunk/Source/WebKit2/ChangeLog	2014-02-20 02:03:37 UTC (rev 164405)
+++ trunk/Source/WebKit2/ChangeLog	2014-02-20 02:03:40 UTC (rev 164406)
@@ -1,5 +1,35 @@
 2014-02-19  Simon Fraser  <[email protected]>
 
+        Avoid sending redundant layer properties to the UI process, and avoid allocation of RemoteLayerBackingStore unless we need it
+        https://bugs.webkit.org/show_bug.cgi?id=129076
+
+        Reviewed by Tim Horton.
+        
+        Normally we rely on GraphicsLayerCA to avoid redundant property
+        setting on PlatformCALayers, but for contents layers GraphicsLayerCA
+        sets properties on every update.
+        
+        Make PlatformCALayerRemote more efficient in this case by not
+        setting dirty flags for unchanged property sets.
+        
+        Also avoid creation of RemoteLayerBackingStore unless we
+        actually need one.
+
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.cpp:
+        (PlatformCALayerRemote::ensureBackingStore):
+        (PlatformCALayerRemote::updateBackingStore):
+        (PlatformCALayerRemote::setBounds):
+        (PlatformCALayerRemote::setPosition):
+        (PlatformCALayerRemote::setAnchorPoint):
+        (PlatformCALayerRemote::setMasksToBounds):
+        (PlatformCALayerRemote::setAcceleratesDrawing):
+        (PlatformCALayerRemote::setBorderWidth):
+        (PlatformCALayerRemote::setBorderColor):
+        (PlatformCALayerRemote::setContentsScale):
+        * WebProcess/WebPage/mac/PlatformCALayerRemote.h:
+
+2014-02-19  Simon Fraser  <[email protected]>
+
         [UI-Side Compositing] 6% of main thread time spent copying LayerProperties when adding to hash table
         https://bugs.webkit.org/show_bug.cgi?id=129074
 

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp (164405 => 164406)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-02-20 02:03:37 UTC (rev 164405)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.cpp	2014-02-20 02:03:40 UTC (rev 164406)
@@ -151,6 +151,15 @@
 {
     if (!m_properties.backingStore)
         m_properties.backingStore = std::make_unique<RemoteLayerBackingStore>();
+
+    updateBackingStore();
+}
+
+void PlatformCALayerRemote::updateBackingStore()
+{
+    if (!m_properties.backingStore)
+        return;
+
     m_properties.backingStore->ensureBackingStore(this, expandedIntSize(m_properties.size), m_properties.contentsScale, m_acceleratesDrawing);
 }
 
@@ -304,13 +313,16 @@
 
 void PlatformCALayerRemote::setBounds(const FloatRect& value)
 {
+    if (value.size() == m_properties.size)
+        return;
+
     m_properties.size = value.size();
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::SizeChanged);
     
     if (requiresCustomAppearanceUpdateOnBoundsChange())
         m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::CustomAppearanceChanged);
 
-    ensureBackingStore();
+    updateBackingStore();
 }
 
 FloatPoint3D PlatformCALayerRemote::position() const
@@ -320,6 +332,9 @@
 
 void PlatformCALayerRemote::setPosition(const FloatPoint3D& value)
 {
+    if (value == m_properties.position)
+        return;
+
     m_properties.position = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::PositionChanged);
 }
@@ -331,6 +346,9 @@
 
 void PlatformCALayerRemote::setAnchorPoint(const FloatPoint3D& value)
 {
+    if (value == m_properties.anchorPoint)
+        return;
+
     m_properties.anchorPoint = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::AnchorPointChanged);
 }
@@ -387,6 +405,9 @@
 
 void PlatformCALayerRemote::setMasksToBounds(bool value)
 {
+    if (value == m_properties.masksToBounds)
+        return;
+
     m_properties.masksToBounds = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::MasksToBoundsChanged);
 }
@@ -399,7 +420,7 @@
 void PlatformCALayerRemote::setAcceleratesDrawing(bool acceleratesDrawing)
 {
     m_acceleratesDrawing = acceleratesDrawing;
-    ensureBackingStore();
+    updateBackingStore();
 }
 
 CFTypeRef PlatformCALayerRemote::contents() const
@@ -442,12 +463,18 @@
 
 void PlatformCALayerRemote::setBorderWidth(float value)
 {
+    if (value == m_properties.borderWidth)
+        return;
+
     m_properties.borderWidth = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BorderWidthChanged);
 }
 
 void PlatformCALayerRemote::setBorderColor(const Color& value)
 {
+    if (value == m_properties.borderColor)
+        return;
+
     m_properties.borderColor = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::BorderColorChanged);
 }
@@ -509,7 +536,7 @@
     m_properties.contentsScale = value;
     m_properties.notePropertiesChanged(RemoteLayerTreeTransaction::ContentsScaleChanged);
 
-    ensureBackingStore();
+    updateBackingStore();
 }
 
 void PlatformCALayerRemote::setEdgeAntialiasingMask(unsigned value)

Modified: trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h (164405 => 164406)


--- trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2014-02-20 02:03:37 UTC (rev 164405)
+++ trunk/Source/WebKit2/WebProcess/WebPage/mac/PlatformCALayerRemote.h	2014-02-20 02:03:40 UTC (rev 164406)
@@ -155,6 +155,7 @@
 private:
     virtual bool isPlatformCALayerRemote() const override { return true; }
     void ensureBackingStore();
+    void updateBackingStore();
     void removeSublayer(PlatformCALayerRemote*);
 
     bool requiresCustomAppearanceUpdateOnBoundsChange() const;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to