[webkit-changes] [WebKit/WebKit] 59b78d: Change UserActionElementSet to use a WeakHashMap ...
Nathan Solomon
noreply at github.com
Wed Sep 25 21:25:54 PDT 2024
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 59b78d354f38cab97c5897169ce99a9edbf471ec
https://github.com/WebKit/WebKit/commit/59b78d354f38cab97c5897169ce99a9edbf471ec
Author: Nathan Solomon <nathan_solomon at apple.com>
Date: 2024-09-25 (Wed, 25 Sep 2024)
Changed paths:
M Source/WebCore/dom/UserActionElementSet.cpp
M Source/WebCore/dom/UserActionElementSet.h
Log Message:
-----------
Change UserActionElementSet to use a WeakHashMap instead of a HashMap
https://bugs.webkit.org/show_bug.cgi?id=280351
rdar://136382242
Reviewed by Chris Dumez.
Make the reference to the Element a WeakPtr by using a WeakHashmap instead of a strong reference.
I observed a website where the RefPtr<Element> keys stored in m_elements map in the UserActionElementSet were never decremented once inserted, even after deallocation of all Elements should have occured. The Document owns an instance of UserActionElementSet, which I believe causes a reference cycle between the Nodes that reference the document and the Document itself. Break this reference cycle.
* Source/WebCore/dom/UserActionElementSet.cpp:
(WebCore::UserActionElementSet::clear):
(WebCore::UserActionElementSet::hasFlag const):
(WebCore::UserActionElementSet::clearFlags):
(WebCore::UserActionElementSet::setFlags):
* Source/WebCore/dom/UserActionElementSet.h:
Canonical link: https://commits.webkit.org/284260@main
To unsubscribe from these emails, change your notification settings at https://github.com/WebKit/WebKit/settings/notifications
More information about the webkit-changes
mailing list