Title: [243126] trunk/Source/WebCore
- Revision
- 243126
- Author
- [email protected]
- Date
- 2019-03-18 19:05:23 -0700 (Mon, 18 Mar 2019)
Log Message
Scrolling state nodes should hold references to GraphicsLayers
https://bugs.webkit.org/show_bug.cgi?id=195844
<rdar://problem/48949634>
Reviewed by Tim Horton.
GraphicsLayers are refcounted, and the scrolling tree keeps GraphicsLayer pointers,
so for safely the scrolling tree should store RefPtr<GraphicsLayer> instead.
I removed the union (since it would be weird with a RefPtr and raw pointer). This code
should probably use WTF::Variant<> in future.
* page/scrolling/ScrollingStateNode.h:
(WebCore::LayerRepresentation::LayerRepresentation):
(WebCore::LayerRepresentation::operator GraphicsLayer* const):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (243125 => 243126)
--- trunk/Source/WebCore/ChangeLog 2019-03-19 01:58:05 UTC (rev 243125)
+++ trunk/Source/WebCore/ChangeLog 2019-03-19 02:05:23 UTC (rev 243126)
@@ -1,3 +1,21 @@
+2019-03-18 Simon Fraser <[email protected]>
+
+ Scrolling state nodes should hold references to GraphicsLayers
+ https://bugs.webkit.org/show_bug.cgi?id=195844
+ <rdar://problem/48949634>
+
+ Reviewed by Tim Horton.
+
+ GraphicsLayers are refcounted, and the scrolling tree keeps GraphicsLayer pointers,
+ so for safely the scrolling tree should store RefPtr<GraphicsLayer> instead.
+
+ I removed the union (since it would be weird with a RefPtr and raw pointer). This code
+ should probably use WTF::Variant<> in future.
+
+ * page/scrolling/ScrollingStateNode.h:
+ (WebCore::LayerRepresentation::LayerRepresentation):
+ (WebCore::LayerRepresentation::operator GraphicsLayer* const):
+
2019-03-18 Commit Queue <[email protected]>
Unreviewed, rolling out r243092 and r243096.
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (243125 => 243126)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2019-03-19 01:58:05 UTC (rev 243125)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2019-03-19 02:05:23 UTC (rev 243126)
@@ -58,11 +58,7 @@
PlatformLayerIDRepresentation
};
- LayerRepresentation()
- : m_graphicsLayer(nullptr)
- , m_layerID(0)
- , m_representation(EmptyRepresentation)
- { }
+ LayerRepresentation() = default;
LayerRepresentation(GraphicsLayer* graphicsLayer)
: m_graphicsLayer(graphicsLayer)
@@ -72,7 +68,6 @@
LayerRepresentation(PlatformLayer* platformLayer)
: m_typelessPlatformLayer(makePlatformLayerTypeless(platformLayer))
- , m_layerID(0)
, m_representation(PlatformLayerRepresentation)
{
retainPlatformLayer(m_typelessPlatformLayer);
@@ -79,8 +74,7 @@
}
LayerRepresentation(GraphicsLayer::PlatformLayerID layerID)
- : m_graphicsLayer(nullptr)
- , m_layerID(layerID)
+ : m_layerID(layerID)
, m_representation(PlatformLayerIDRepresentation)
{
}
@@ -103,7 +97,7 @@
operator GraphicsLayer*() const
{
ASSERT(m_representation == GraphicsLayerRepresentation);
- return m_graphicsLayer;
+ return m_graphicsLayer.get();
}
operator PlatformLayer*() const
@@ -179,13 +173,10 @@
WEBCORE_EXPORT static PlatformLayer* makePlatformLayerTyped(void* typelessPlatformLayer);
WEBCORE_EXPORT static void* makePlatformLayerTypeless(PlatformLayer*);
- union {
- GraphicsLayer* m_graphicsLayer;
- void* m_typelessPlatformLayer;
- };
-
- GraphicsLayer::PlatformLayerID m_layerID;
- Type m_representation;
+ RefPtr<GraphicsLayer> m_graphicsLayer;
+ void* m_typelessPlatformLayer { nullptr };
+ GraphicsLayer::PlatformLayerID m_layerID { 0 };
+ Type m_representation { EmptyRepresentation };
};
class ScrollingStateNode : public RefCounted<ScrollingStateNode> {
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes