Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 3a3c7f32ff84b6e691f279a53f046ea79369e4aa
https://github.com/WebKit/WebKit/commit/3a3c7f32ff84b6e691f279a53f046ea79369e4aa
Author: Basuke Suzuki <[email protected]>
Date: 2026-03-12 (Thu, 12 Mar 2026)
Changed paths:
M Source/WebKit/Shared/WebBackForwardListItem.cpp
M Source/WebKit/Shared/WebBackForwardListItem.h
M Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm
M Source/WebKit/UIProcess/ProvisionalPageProxy.cpp
M Source/WebKit/UIProcess/WebBackForwardList.cpp
M Source/WebKit/UIProcess/WebPageProxy.cpp
M Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm
Log Message:
-----------
Refactor WebBackForwardListItem::mainFrameState() to clarify copy vs.
read-only access.
https://bugs.webkit.org/show_bug.cgi?id=309802
Reviewed by Sihui Liu and Per Arne Vollan.
The original `mainFrameState()` always returned `Ref<FrameState>` via
`copyFrameStateWithChildren()`,
even for callers that only needed to read a property without modifying or
owning the state.
This patch splits it into two methods:
- `mainFrameState()` — returns `const FrameState&` for lightweight, read-only
access (used in
`itemIsInSameDocument`, `WKBackForwardListItem._scrollPosition`,
`ViewGestureControllerIOS`)
- `copyMainFrameStateWithChildren()` — returns `Ref<FrameState>` for callers
that need an owned
deep copy (back/forward navigation, serialization, frame state replacement)
This avoids unnecessary ref-counted copies in hot paths like same-document
navigation checks and
scroll position queries, and makes the intent of each call site clearer.
No new tests because there's no behavior change.
* Source/WebKit/Shared/WebBackForwardListItem.cpp:
(WebKit::WebBackForwardListItem::itemIsInSameDocument const):
(WebKit::WebBackForwardListItem::itemIsClone):
(WebKit::WebBackForwardListItem::mainFrameState const):
(WebKit::WebBackForwardListItem::copyMainFrameStateWithChildren const):
* Source/WebKit/Shared/WebBackForwardListItem.h:
* Source/WebKit/UIProcess/API/Cocoa/WKBackForwardListItem.mm:
(-[WKBackForwardListItem _scrollPosition]):
* Source/WebKit/UIProcess/ProvisionalPageProxy.cpp:
(WebKit::ProvisionalPageProxy::goToBackForwardItem):
* Source/WebKit/UIProcess/WebBackForwardList.cpp:
(WebKit::WebBackForwardList::backForwardListState const):
(WebKit::WebBackForwardList::completeFrameStateForNavigation):
(WebKit::WebBackForwardList::backForwardItemAtIndex):
* Source/WebKit/UIProcess/WebPageProxy.cpp:
(WebKit::WebPageProxy::launchProcessForReload):
(WebKit::WebPageProxy::goToBackForwardItem):
(WebKit::WebPageProxy::continueNavigationInNewProcess):
* Source/WebKit/UIProcess/ios/ViewGestureControllerIOS.mm:
(WebKit::ViewGestureController::beginSwipeGesture):
Canonical link: https://commits.webkit.org/309175@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications