Title: [131221] trunk/Source/WebCore
Revision
131221
Author
bda...@apple.com
Date
2012-10-12 13:50:36 -0700 (Fri, 12 Oct 2012)

Log Message

https://bugs.webkit.org/show_bug.cgi?id=99204
ScrollingStateNodes should keep track of their IDs

Reviewed by Simon Fraser.

There is a HashMap in ScrollingCoordinatorMac that maps 
ScrollingNodeIDs to ScrollingStateNodes. The nodes themselves should 
keep track of this id. Then the id can be used to make sure 
ScrollingStateNodes remove themselves from the HashMap when they are 
destroyed, and it will also be useful for associating 
ScrollingStateNodes with ScrollingTreeNodes over on the scrolling 
thread.
  
This patch only has the ScrollingStateNodes cache the id. I will 
actually make use of the id in follow-up patches.

* page/scrolling/ScrollingStateNode.cpp:
(WebCore::ScrollingStateNode::ScrollingStateNode):
* page/scrolling/ScrollingStateNode.h:
(ScrollingStateNode):
(WebCore::ScrollingStateNode::scrollingNodeID):
* page/scrolling/ScrollingStateScrollingNode.cpp:
(WebCore::ScrollingStateScrollingNode::create):
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
* page/scrolling/ScrollingStateScrollingNode.h:
(ScrollingStateScrollingNode):
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::attachToStateTree):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (131220 => 131221)


--- trunk/Source/WebCore/ChangeLog	2012-10-12 20:47:07 UTC (rev 131220)
+++ trunk/Source/WebCore/ChangeLog	2012-10-12 20:50:36 UTC (rev 131221)
@@ -1,3 +1,34 @@
+2012-10-12  Beth Dakin  <bda...@apple.com>
+
+        https://bugs.webkit.org/show_bug.cgi?id=99204
+        ScrollingStateNodes should keep track of their IDs
+
+        Reviewed by Simon Fraser.
+
+        There is a HashMap in ScrollingCoordinatorMac that maps 
+        ScrollingNodeIDs to ScrollingStateNodes. The nodes themselves should 
+        keep track of this id. Then the id can be used to make sure 
+        ScrollingStateNodes remove themselves from the HashMap when they are 
+        destroyed, and it will also be useful for associating 
+        ScrollingStateNodes with ScrollingTreeNodes over on the scrolling 
+        thread.
+  
+        This patch only has the ScrollingStateNodes cache the id. I will 
+        actually make use of the id in follow-up patches.
+
+        * page/scrolling/ScrollingStateNode.cpp:
+        (WebCore::ScrollingStateNode::ScrollingStateNode):
+        * page/scrolling/ScrollingStateNode.h:
+        (ScrollingStateNode):
+        (WebCore::ScrollingStateNode::scrollingNodeID):
+        * page/scrolling/ScrollingStateScrollingNode.cpp:
+        (WebCore::ScrollingStateScrollingNode::create):
+        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+        * page/scrolling/ScrollingStateScrollingNode.h:
+        (ScrollingStateScrollingNode):
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        (WebCore::ScrollingCoordinatorMac::attachToStateTree):
+
 2012-10-01  Jer Noble  <jer.no...@apple.com>
 
         Add LSKD support to MediaPlayerPrivateAVFoundation.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (131220 => 131221)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp	2012-10-12 20:47:07 UTC (rev 131220)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp	2012-10-12 20:50:36 UTC (rev 131221)
@@ -32,8 +32,9 @@
 
 namespace WebCore {
 
-ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree)
+ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree, ScrollingNodeID nodeID)
     : m_scrollingStateTree(scrollingStateTree)
+    , m_nodeID(nodeID)
     , m_parent(0)
     , m_scrollLayerDidChange(false)
 {
@@ -44,6 +45,7 @@
 // node.
 ScrollingStateNode::ScrollingStateNode(ScrollingStateNode* stateNode)
     : m_scrollingStateTree(0)
+    , m_nodeID(stateNode->scrollingNodeID())
     , m_parent(0)
     , m_scrollLayerDidChange(stateNode->scrollLayerDidChange())
 {

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (131220 => 131221)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h	2012-10-12 20:47:07 UTC (rev 131220)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h	2012-10-12 20:50:36 UTC (rev 131221)
@@ -29,6 +29,7 @@
 #if ENABLE(THREADED_SCROLLING)
 
 #include "GraphicsLayer.h"
+#include "ScrollingCoordinator.h"
 #include <wtf/OwnPtr.h>
 #include <wtf/PassOwnPtr.h>
 #include <wtf/Vector.h>
@@ -45,7 +46,7 @@
     WTF_MAKE_NONCOPYABLE(ScrollingStateNode);
 
 public:
-    ScrollingStateNode(ScrollingStateTree*);
+    ScrollingStateNode(ScrollingStateTree*, ScrollingNodeID);
     virtual ~ScrollingStateNode();
 
     virtual bool isScrollingStateScrollingNode() { return false; }
@@ -68,6 +69,8 @@
     ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; }
     void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
 
+    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
+
     ScrollingStateNode* parent() const { return m_parent; }
     void setParent(ScrollingStateNode* parent) { m_parent = parent; }
 
@@ -81,8 +84,9 @@
     ScrollingStateTree* m_scrollingStateTree;
 
 private:
+    ScrollingNodeID m_nodeID;
+
     ScrollingStateNode* m_parent;
-
     OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children;
 
     bool m_scrollLayerDidChange;

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (131220 => 131221)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp	2012-10-12 20:47:07 UTC (rev 131220)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp	2012-10-12 20:50:36 UTC (rev 131221)
@@ -33,13 +33,13 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree)
+PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
 {
-    return adoptPtr(new ScrollingStateScrollingNode(stateTree));
+    return adoptPtr(new ScrollingStateScrollingNode(stateTree, nodeID));
 }
 
-ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree)
-    : ScrollingStateNode(stateTree)
+ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
+    : ScrollingStateNode(stateTree, nodeID)
     , m_changedProperties(0)
     , m_wheelEventHandlerCount(0)
     , m_shouldUpdateScrollLayerPositionOnMainThread(0)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (131220 => 131221)


--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h	2012-10-12 20:47:07 UTC (rev 131220)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h	2012-10-12 20:50:36 UTC (rev 131221)
@@ -39,7 +39,7 @@
 
 class ScrollingStateScrollingNode : public ScrollingStateNode {
 public:
-    static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*);
+    static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*, ScrollingNodeID);
     virtual ~ScrollingStateScrollingNode();
 
     enum ChangedProperty {
@@ -110,7 +110,7 @@
     bool requestedScrollPositionRepresentsProgrammaticScroll() const { return m_requestedScrollPositionRepresentsProgrammaticScroll; }
 
 private:
-    ScrollingStateScrollingNode(ScrollingStateTree*);
+    ScrollingStateScrollingNode(ScrollingStateTree*, ScrollingNodeID);
     ScrollingStateScrollingNode(ScrollingStateScrollingNode*);
 
     unsigned m_changedProperties;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (131220 => 131221)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2012-10-12 20:47:07 UTC (rev 131220)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2012-10-12 20:50:36 UTC (rev 131221)
@@ -247,7 +247,7 @@
     // FIXME: In the future, this function will have to take a parent ID so that it can
     // append the node in the appropriate spot in the state tree. For now we always assume
     // this is the root node.
-    m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get()));
+    m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get(), scrollLayerID));
     m_stateNodeMap.set(scrollLayerID, m_scrollingStateTree->rootStateNode());
     return scrollLayerID;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to