Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: f84460ba474e833aeeb26a335dc2bbd1e20d3549
https://github.com/WebKit/WebKit/commit/f84460ba474e833aeeb26a335dc2bbd1e20d3549
Author: Brent Fulgham <[email protected]>
Date: 2026-04-27 (Mon, 27 Apr 2026)
Changed paths:
M Source/WebKit/UIProcess/API/APIPageConfiguration.cpp
M Source/WebKit/UIProcess/API/APIPageConfiguration.h
M Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm
M Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm
M Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewConfiguration.mm
Log Message:
-----------
API::PageConfiguration::Data::LazyInitializedRef wastefully initializes
unneeded objects
https://bugs.webkit.org/show_bug.cgi?id=312803
rdar://175189199
Reviewed by Ryosuke Niwa.
The copy assignment operator for Data::LazyInitializedRef always forces the lazy
initialization to happen (even on unset members) by calling `get()` on the
source
.object. The current implementation of `get()` triggers lazy initialization on
the
source `m_value` for ANY uninitialized member.
During `copyDataFrom`, the Data struct's generated copy assignment calls this
for
all of its LazyInitializedRef members. For members not explicitly set on the
source
(e.g., visitedLinkStore, defaultWebsitePolicies), this causes us to create
throw-away
objects as a side-effect of copying.
This wasetful work should be avoided to reduce performance cost.
Ensure the invariant that the WKWebViewConfiguration's process pool member must
always match the process pool of it's related WKWebView by keeping them in sync
in _setRelatedWebView. This prevents a class of errors triggered by improper
use of the _setRelatedWebView SPI where calls would sometimes neglect to also
set
the configuration's process pool when they updated the WKWebView. This error
became
visible when the default initialization in LazyInitializedRef was removed.
Test: Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewConfiguration.mm
* Source/WebKit/UIProcess/API/APIPageConfiguration.cpp:
(API::PageConfiguration::ensureLazyInitializedRefsAreInitialized):
* Source/WebKit/UIProcess/API/APIPageConfiguration.h:
(API::PageConfiguration::Data::initializer):
* Source/WebKit/UIProcess/API/Cocoa/WKWebView.mm:
(-[WKWebView _initializeWithConfiguration:]):
* Source/WebKit/UIProcess/API/Cocoa/WKWebViewConfiguration.mm:
(-[WKWebViewConfiguration _setRelatedWebView:]):
* Tools/TestWebKitAPI/Tests/WebKit/WKWebView/WKWebViewConfiguration.mm:
(TEST(WebKit, ConfigurationCopyDoesNotLazilyInitializeProcessPool)):
(TEST(WebKit, ConfigurationCopyPreservesExplicitlySetProcessPool)):
(TEST(WebKit, RelatedWebViewSyncsProcessPool)):
Canonical link: https://commits.webkit.org/312140@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications