Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 57303f8073605d181ef2070be13c8e359a0bdd51
      
https://github.com/WebKit/WebKit/commit/57303f8073605d181ef2070be13c8e359a0bdd51
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-04 (Fri, 04 Sep 2026)

  Changed paths:
    M Source/WebCore/Modules/async-clipboard/Clipboard.cpp

  Log Message:
  -----------
  Avoid redundant PasteboardCustomData copies when writing clipboard items
https://bugs.webkit.org/show_bug.cgi?id=323305
rdar://186553823

Reviewed by Wenson Hsieh and Chris Dumez.

Clipboard::ItemWriter::write() copied every clipboard payload twice while
building the Vector<PasteboardCustomData> handed to the pasteboard: once by
iterating dataToWrite by value, and once more via customData.append(*data).
PasteboardCustomData owns the actual clipboard buffers, so each copy is a
full deep copy of the payload.

dataToWrite is already a std::exchange'd local that is discarded when the
loop ends, so nothing needs the originals afterward. Iterate over it as an
rvalue (WTF::move) to make the destructive intent explicit and move each
item into customData instead, taking the per-item cost from two full copies
down to a single move.

* Source/WebCore/Modules/async-clipboard/Clipboard.cpp:
(WebCore::Clipboard::ItemWriter::didSetAllData):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to