Browse Source

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 <[email protected]>
trop[bot] 1 month ago
parent
commit
4015b8c48e
1 changed files with 1 additions and 2 deletions
  1. 1 2
      shell/browser/serial/serial_chooser_context.cc

+ 1 - 2
shell/browser/serial/serial_chooser_context.cc

@@ -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) {