Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 635ad039f2d9ff604dbce90e1ef72e293ab4f182
https://github.com/WebKit/WebKit/commit/635ad039f2d9ff604dbce90e1ef72e293ab4f182
Author: Ahmad Saleem <[email protected]>
Date: 2026-09-03 (Thu, 03 Sep 2026)
Changed paths:
M Source/WebCore/Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp
Log Message:
-----------
Avoid per-item String and Ref<DOMPromise> copies in
ClipboardItemBindingsDataSource::collectDataForWriting()
https://bugs.webkit.org/show_bug.cgi?id=323306
rdar://186553836
Reviewed by Chris Dumez.
While mapping m_itemPromises (a Vector<KeyValuePair<String, Ref<DOMPromise>>>)
to item type loaders, collectDataForWriting() made a redundant copy of each
entry's key and value. The String key was copied into a local even though it
is only passed to ClipboardItemTypeLoader::create(), which takes a const
String&, before being captured by copy into the whenSettledWithResult()
callback; the inner capture is the only copy actually required. The
Ref<DOMPromise> value was copied into a local (an atomic refcount bump) even
though it is only used once to invoke promise->whenSettledWithResult() and is
never captured.
Bind both by reference instead, dropping one String copy and one
Ref<DOMPromise> refcount round-trip per clipboard item written.
* Source/WebCore/Modules/async-clipboard/ClipboardItemBindingsDataSource.cpp:
(WebCore::ClipboardItemBindingsDataSource::collectDataForWriting):
Canonical link: https://commits.webkit.org/320477@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications