Skip to content

Commit 3dfccb2

Browse files
Deploy smart pointer in ScrollingTreeScrollingNodeDelegate
https://bugs.webkit.org/show_bug.cgi?id=283868 Reviewed by Chris Dumez. Deploy smart pointer in ScrollingTreeScrollingNodeDelegate * Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp: (WebCore::ScrollingTreeScrollingNodeDelegate::lastCommittedScrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::totalContentsSize): (WebCore::ScrollingTreeScrollingNodeDelegate::reachableContentsSize): (WebCore::ScrollingTreeScrollingNodeDelegate::scrollOrigin const): * Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h: (WebCore::ScrollingTreeScrollingNodeDelegate::currentScrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::minimumScrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::maximumScrollPosition const): (WebCore::ScrollingTreeScrollingNodeDelegate::scrollableAreaSize const): (WebCore::ScrollingTreeScrollingNodeDelegate::totalContentsSize const): (WebCore::ScrollingTreeScrollingNodeDelegate::allowsHorizontalScrolling const): (WebCore::ScrollingTreeScrollingNodeDelegate::allowsVerticalScrolling const): (WebCore::ScrollingTreeScrollingNodeDelegate::horizontalScrollElasticity const): (WebCore::ScrollingTreeScrollingNodeDelegate::verticalScrollElasticity const): * Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations: * Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations: Canonical link: https://commits.webkit.org/292555@main
1 parent 8461269 commit 3dfccb2

4 files changed

Lines changed: 17 additions & 19 deletions

File tree

Source/WebCore/SaferCPPExpectations/NoUncountedMemberCheckerExpectations

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ page/WheelEventTestMonitor.h
6060
page/scrolling/ScrollLatchingController.h
6161
page/scrolling/ScrollingCoordinator.h
6262
page/scrolling/ScrollingTreeGestureState.h
63-
page/scrolling/ScrollingTreeScrollingNodeDelegate.h
6463
page/scrolling/mac/ScrollerMac.h
6564
platform/PODInterval.h
6665
platform/encryptedmedia/CDMProxy.h

Source/WebCore/SaferCPPExpectations/UncountedCallArgsCheckerExpectations

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -966,7 +966,6 @@ page/scrolling/ScrollingThread.cpp
966966
page/scrolling/ScrollingTree.cpp
967967
page/scrolling/ScrollingTree.h
968968
page/scrolling/ScrollingTreeGestureState.cpp
969-
page/scrolling/ScrollingTreeScrollingNodeDelegate.h
970969
page/scrolling/ThreadedScrollingCoordinator.cpp
971970
page/scrolling/mac/ScrollerMac.mm
972971
page/scrolling/mac/ScrollingCoordinatorMac.mm

Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,22 +50,22 @@ RefPtr<ScrollingTree> ScrollingTreeScrollingNodeDelegate::scrollingTree() const
5050

5151
FloatPoint ScrollingTreeScrollingNodeDelegate::lastCommittedScrollPosition() const
5252
{
53-
return m_scrollingNode.lastCommittedScrollPosition();
53+
return protectedScrollingNode()->lastCommittedScrollPosition();
5454
}
5555

5656
FloatSize ScrollingTreeScrollingNodeDelegate::totalContentsSize()
5757
{
58-
return m_scrollingNode.totalContentsSize();
58+
return protectedScrollingNode()->totalContentsSize();
5959
}
6060

6161
FloatSize ScrollingTreeScrollingNodeDelegate::reachableContentsSize()
6262
{
63-
return m_scrollingNode.reachableContentsSize();
63+
return protectedScrollingNode()->reachableContentsSize();
6464
}
6565

6666
IntPoint ScrollingTreeScrollingNodeDelegate::scrollOrigin() const
6767
{
68-
return m_scrollingNode.scrollOrigin();
68+
return protectedScrollingNode()->scrollOrigin();
6969
}
7070

7171
} // namespace WebCore

Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@ class ScrollingTreeScrollingNodeDelegate {
3939
WEBCORE_EXPORT explicit ScrollingTreeScrollingNodeDelegate(ScrollingTreeScrollingNode&);
4040
WEBCORE_EXPORT virtual ~ScrollingTreeScrollingNodeDelegate();
4141

42-
ScrollingTreeScrollingNode& scrollingNode() { return m_scrollingNode; }
43-
const ScrollingTreeScrollingNode& scrollingNode() const { return m_scrollingNode; }
44-
Ref<ScrollingTreeScrollingNode> protectedScrollingNode() const { return m_scrollingNode; }
42+
RefPtr<ScrollingTreeScrollingNode> protectedScrollingNode() const { return m_scrollingNode.get(); }
43+
ScrollingTreeScrollingNode& scrollingNode() { return *protectedScrollingNode().get(); }
44+
const ScrollingTreeScrollingNode& scrollingNode() const { return *protectedScrollingNode().get(); }
4545

4646
virtual bool startAnimatedScrollToPosition(FloatPoint) = 0;
4747
virtual void stopAnimatedScroll() = 0;
@@ -72,21 +72,21 @@ class ScrollingTreeScrollingNodeDelegate {
7272
WEBCORE_EXPORT FloatSize reachableContentsSize();
7373
WEBCORE_EXPORT IntPoint scrollOrigin() const;
7474

75-
FloatPoint currentScrollPosition() const { return m_scrollingNode.currentScrollPosition(); }
76-
FloatPoint minimumScrollPosition() const { return m_scrollingNode.minimumScrollPosition(); }
77-
FloatPoint maximumScrollPosition() const { return m_scrollingNode.maximumScrollPosition(); }
75+
FloatPoint currentScrollPosition() const { return protectedScrollingNode()->currentScrollPosition(); }
76+
FloatPoint minimumScrollPosition() const { return protectedScrollingNode()->minimumScrollPosition(); }
77+
FloatPoint maximumScrollPosition() const { return protectedScrollingNode()->maximumScrollPosition(); }
7878

79-
FloatSize scrollableAreaSize() const { return m_scrollingNode.scrollableAreaSize(); }
80-
FloatSize totalContentsSize() const { return m_scrollingNode.totalContentsSize(); }
79+
FloatSize scrollableAreaSize() const { return protectedScrollingNode()->scrollableAreaSize(); }
80+
FloatSize totalContentsSize() const { return protectedScrollingNode()->totalContentsSize(); }
8181

82-
bool allowsHorizontalScrolling() const { return m_scrollingNode.allowsHorizontalScrolling(); }
83-
bool allowsVerticalScrolling() const { return m_scrollingNode.allowsVerticalScrolling(); }
82+
bool allowsHorizontalScrolling() const { return protectedScrollingNode()->allowsHorizontalScrolling(); }
83+
bool allowsVerticalScrolling() const { return protectedScrollingNode()->allowsVerticalScrolling(); }
8484

85-
ScrollElasticity horizontalScrollElasticity() const { return m_scrollingNode.horizontalScrollElasticity(); }
86-
ScrollElasticity verticalScrollElasticity() const { return m_scrollingNode.verticalScrollElasticity(); }
85+
ScrollElasticity horizontalScrollElasticity() const { return protectedScrollingNode()->horizontalScrollElasticity(); }
86+
ScrollElasticity verticalScrollElasticity() const { return protectedScrollingNode()->verticalScrollElasticity(); }
8787

8888
private:
89-
ScrollingTreeScrollingNode& m_scrollingNode; // FIXME : Should use a smart pointer.
89+
ThreadSafeWeakPtr<ScrollingTreeScrollingNode> m_scrollingNode; // m_scrollingNode is expected never be null
9090
};
9191

9292
} // namespace WebCore

0 commit comments

Comments
 (0)