diff options
Diffstat (limited to 'Source/WebCore/page/scrolling/ScrollingStateTree.h')
| -rw-r--r-- | Source/WebCore/page/scrolling/ScrollingStateTree.h | 52 |
1 files changed, 20 insertions, 32 deletions
diff --git a/Source/WebCore/page/scrolling/ScrollingStateTree.h b/Source/WebCore/page/scrolling/ScrollingStateTree.h index 79a65a5f4..59659e534 100644 --- a/Source/WebCore/page/scrolling/ScrollingStateTree.h +++ b/Source/WebCore/page/scrolling/ScrollingStateTree.h @@ -28,7 +28,9 @@ #if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) -#include "ScrollingStateFrameScrollingNode.h" +#include "ScrollingStateScrollingNode.h" +#include <wtf/OwnPtr.h> +#include <wtf/PassOwnPtr.h> #include <wtf/RefPtr.h> namespace WebCore { @@ -41,30 +43,29 @@ class AsyncScrollingCoordinator; // the scrolling thread, avoiding locking. class ScrollingStateTree { - WTF_MAKE_FAST_ALLOCATED; friend class ScrollingStateNode; public: - WEBCORE_EXPORT ScrollingStateTree(AsyncScrollingCoordinator* = nullptr); - WEBCORE_EXPORT ~ScrollingStateTree(); + + static PassOwnPtr<ScrollingStateTree> create(AsyncScrollingCoordinator* = 0); + ~ScrollingStateTree(); - ScrollingStateFrameScrollingNode* rootStateNode() const { return m_rootStateNode.get(); } - WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID); + ScrollingStateScrollingNode* rootStateNode() const { return m_rootStateNode.get(); } + ScrollingStateNode* stateNodeForID(ScrollingNodeID); - WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID); + ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID); void detachNode(ScrollingNodeID); void clear(); - const HashSet<ScrollingNodeID>& removedNodes() const { return m_nodesRemovedSinceLastCommit; } - WEBCORE_EXPORT void setRemovedNodes(HashSet<ScrollingNodeID>); + const Vector<ScrollingNodeID>& removedNodes() const { return m_nodesRemovedSinceLastCommit; } + void setRemovedNodes(Vector<ScrollingNodeID>); // Copies the current tree state and clears the changed properties mask in the original. - WEBCORE_EXPORT std::unique_ptr<ScrollingStateTree> commit(LayerRepresentation::Type preferredLayerRepresentation); + PassOwnPtr<ScrollingStateTree> commit(LayerRepresentation::Type preferredLayerRepresentation); - WEBCORE_EXPORT void setHasChangedProperties(bool = true); + void setHasChangedProperties(bool = true); bool hasChangedProperties() const { return m_hasChangedProperties; } bool hasNewRootStateNode() const { return m_hasNewRootStateNode; } - void setHasNewRootStateNode(bool hasNewRoot) { m_hasNewRootStateNode = hasNewRoot; } int nodeCount() const { return m_stateNodeMap.size(); } @@ -75,25 +76,17 @@ public: void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; } private: - void setRootStateNode(PassRefPtr<ScrollingStateFrameScrollingNode> rootStateNode) { m_rootStateNode = rootStateNode; } - void addNode(ScrollingStateNode*); - - PassRefPtr<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID); - - enum class SubframeNodeRemoval { - Delete, - Orphan - }; - void removeNodeAndAllDescendants(ScrollingStateNode*, SubframeNodeRemoval = SubframeNodeRemoval::Delete); + ScrollingStateTree(AsyncScrollingCoordinator*); - void recursiveNodeWillBeRemoved(ScrollingStateNode* currNode, SubframeNodeRemoval); - void willRemoveNode(ScrollingStateNode*); + void setRootStateNode(PassOwnPtr<ScrollingStateScrollingNode> rootStateNode) { m_rootStateNode = rootStateNode; } + void addNode(ScrollingStateNode*); + void removeNode(ScrollingStateNode*); + void didRemoveNode(ScrollingNodeID); AsyncScrollingCoordinator* m_scrollingCoordinator; StateNodeMap m_stateNodeMap; - RefPtr<ScrollingStateFrameScrollingNode> m_rootStateNode; - HashSet<ScrollingNodeID> m_nodesRemovedSinceLastCommit; - HashMap<ScrollingNodeID, RefPtr<ScrollingStateNode>> m_orphanedSubframeNodes; + OwnPtr<ScrollingStateScrollingNode> m_rootStateNode; + Vector<ScrollingNodeID> m_nodesRemovedSinceLastCommit; bool m_hasChangedProperties; bool m_hasNewRootStateNode; LayerRepresentation::Type m_preferredLayerRepresentation; @@ -101,11 +94,6 @@ private: } // namespace WebCore -#ifndef NDEBUG -void showScrollingStateTree(const WebCore::ScrollingStateTree*); -void showScrollingStateTree(const WebCore::ScrollingStateNode*); -#endif - #endif // ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS) #endif // ScrollingStateTree_h |
