Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 5b7329cf1b86e72332e68c5069db0b953cfab522
      
https://github.com/WebKit/WebKit/commit/5b7329cf1b86e72332e68c5069db0b953cfab522
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-09-02 (Wed, 02 Sep 2026)

  Changed paths:
    M Source/WebCore/loader/AttributionTriggerData.cpp
    M Source/WebCore/loader/AttributionTriggerData.h
    M Source/WebCore/loader/PrivateClickMeasurement.cpp
    M Source/WebCore/loader/PrivateClickMeasurement.h

  Log Message:
  -----------
  PrivateClickMeasurement token URL getters should return std::optional<URL> 
instead of const std::optional<const URL>
https://bugs.webkit.org/show_bug.cgi?id=323252
rdar://186503027

Reviewed by Chris Dumez.

tokenPublicKeyURL() and tokenSignatureURL() on PrivateClickMeasurement and
AttributionTriggerData returned `const std::optional<const URL>`, which
pessimizes copies in two compounding ways:

- The top-level `const` on the by-value return makes the returned prvalue
  const, so callers cannot move-construct from it and are forced to copy the
  URL (and its underlying String).
- The `const`-qualified element type (`optional<const URL>`) forces the
  `return makeValidURL(...)` inside these functions to copy rather than move
  the URL out of the `std::optional<URL>` that makeValidURL() returns, and
  makes the optional itself non-move-assignable.

Return plain `std::optional<URL>` instead. This is a move/RVO win with no
behavioral change; all existing call sites consume the result by value or
via `if (auto optURL = ...)` and are unaffected.

* Source/WebCore/loader/AttributionTriggerData.cpp:
(WebCore::PCM::AttributionTriggerData::tokenPublicKeyURL const):
(WebCore::PCM::AttributionTriggerData::tokenSignatureURL const):
* Source/WebCore/loader/AttributionTriggerData.h:
* Source/WebCore/loader/PrivateClickMeasurement.cpp:
(WebCore::PrivateClickMeasurement::tokenPublicKeyURL):
(WebCore::PrivateClickMeasurement::tokenPublicKeyURL const):
(WebCore::PrivateClickMeasurement::tokenSignatureURL):
(WebCore::PrivateClickMeasurement::tokenSignatureURL const):
* Source/WebCore/loader/PrivateClickMeasurement.h:

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



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

Reply via email to