[webkit-changes] [WebKit/WebKit] a94d55: Use WeakRef / WeakPtr to store non-stack RenderObj...

Chris Dumez noreply at github.com
Fri Dec 8 11:47:48 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: a94d55eae68febe63e553172ddda72561a422461
      https://github.com/WebKit/WebKit/commit/a94d55eae68febe63e553172ddda72561a422461
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2023-12-08 (Fri, 08 Dec 2023)

  Changed paths:
    M Source/WTF/wtf/WeakRef.h
    M Source/WebCore/editing/SelectionGeometryGatherer.h
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/LocalFrameView.h
    M Source/WebCore/rendering/RenderBlock.cpp
    M Source/WebCore/rendering/RenderElement.h
    M Source/WebCore/rendering/RenderObject.cpp
    M Source/WebCore/rendering/RenderObject.h
    M Source/WebCore/rendering/RenderSelection.cpp

  Log Message:
  -----------
  Use WeakRef / WeakPtr to store non-stack RenderObjects
https://bugs.webkit.org/show_bug.cgi?id=266040
rdar://118737861

Reviewed by Darin Adler.

Use WeakRef / WeakPtr to store non-stack RenderObjects instead of CheckedRef / CheckedPtr.
Crashes generated by CheckedRef / CheckedPtr are not actionable if the smart pointer is
not on the stack.

This tested as performance neutral on the benchmarks we track on macOS and iOS, thanks
to the recent WeakPtr optimizations.

There are still a few PackedCheckedPtr<RenderObject> data members that should be
converted. I'll look into it in a follow-up given we don't have a drop-in replacement
at the moment.

* Source/WTF/wtf/WeakRef.h:
* Source/WebCore/editing/SelectionGeometryGatherer.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::didDestroyRenderTree):
(WebCore::LocalFrameView::addEmbeddedObjectToUpdate):
(WebCore::LocalFrameView::removeEmbeddedObjectToUpdate):
(WebCore::LocalFrameView::updateEmbeddedObjects):
* Source/WebCore/page/LocalFrameView.h:
* Source/WebCore/rendering/RenderBlock.cpp:
(WebCore::RenderBlock::addContinuationWithOutline):
(WebCore::RenderBlock::paintContinuationOutlines):
* Source/WebCore/rendering/RenderElement.h:
(WebCore::RenderObject::checkedParent const):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::isDescendantOf const):
* Source/WebCore/rendering/RenderObject.h:
* Source/WebCore/rendering/RenderSelection.cpp:
(WebCore::collectSelectionData):
(WebCore::RenderSelection::collectBounds const):
(WebCore::RenderSelection::apply):

Canonical link: https://commits.webkit.org/271749@main




More information about the webkit-changes mailing list