A recent change in Chromium is avoiding passing `PermissionRequestData`
as a unique_ptr around, and actually just as a ref where no mutate is
required.
Chromium changes:
https://chromium.googlesource.com/chromium/src/+/173060c862de19ba0660a29697a1614782cd8c43
commit 173060c862de19ba0660a29697a1614782cd8c43
Author: Chris Fredrickson <cfredric@chromium.org>
Date: Wed May 14 07:23:01 2025 -0700
Avoid references to unique_ptrs in permissions API
A function that takes a reference does not typically care whether or not
the referent is allocated on the heap. So, the use of `const
std::unique_ptr<T>&` in the public API is unnecessary and overly
restrictive. (E.g., GeolocationPermissionContextDelegateAndroid can now
avoid an unnecessary heap allocation.)
Additionally, the const keyword only promises that the unique_ptr itself
is const; the referent might still be mutated. This is usually not the
desired behavior when using references, so this type is somewhat
misleading. (`const std::unique_ptr<const T>` would have to be used
instead, in order to get familiar "immutable argument" semantics.)
For both of those reasons, it is better to use a normal `const
PermissionRequestData&` instead of `const
std::unique_ptr<PermissionRequestData>&` in the public API.
Change-Id: Iae1228a7bf17f9de77a86e2e9c44592e6a418645
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6532217
Commit-Queue: Colin Blundell <blundell@chromium.org>
Reviewed-by: Florian Jacky <fjacky@chromium.org>
Commit-Queue: Chris Fredrickson <cfredric@chromium.org>
Auto-Submit: Chris Fredrickson <cfredric@chromium.org>
Reviewed-by: Colin Blundell <blundell@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1460064}