refactor: use base::as_byte_span() in EncodeToken(). (#45752)

This matches the change in upstream's serial_chooser_context.cc.

https://chromium-review.googlesource.com/c/chromium/src/+/5247305

Co-authored-by: trop[bot] <37223003+trop[bot]@users.noreply.github.com>
Co-authored-by: Charles Kerr <charles@charleskerr.com>
This commit is contained in:
trop[bot] 2025-02-21 10:25:34 -06:00 committed by GitHub
parent 671178cfdb
commit 4015b8c48e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -28,8 +28,7 @@ namespace {
std::string EncodeToken(const base::UnguessableToken& token) {
const uint64_t data[2] = {token.GetHighForSerialization(),
token.GetLowForSerialization()};
return base::Base64Encode(
std::string_view(reinterpret_cast<const char*>(&data[0]), sizeof(data)));
return base::Base64Encode(base::as_byte_span(data));
}
base::Value PortInfoToValue(const device::mojom::SerialPortInfo& port) {