[base] Spanify Pickle's exposure of underlying data [chromium/src : main]

0 views
Skip to first unread message

Mikel Astiz (Gerrit)

unread,
Jan 21, 2026, 3:09:45 PM (12 days ago) Jan 21
to Daniel Cheng, AyeAye, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng

Mikel Astiz voted and added 1 comment

Votes added by Mikel Astiz

Commit-Queue+1

1 comment

Patchset-level comments
File-level comment, Patchset 2 (Latest):
Mikel Astiz . unresolved

dcheng@: can you take a look at this change, starting with base/pickle.h?

I noticed the current APIs are not spanified and decided to take a stab. It's possible that I need to update a few additional occurrences, but it builds locally at least.

If the direction is looking good, I would also like to hear your opinion on whether or not this patch is worth splitting into smaller ones. That would involve temporarily exposing both APIs, hence coming up with a new name (e.g. `data_as_bytes()`).

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 2
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Wed, 21 Jan 2026 20:09:27 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikel Astiz (Gerrit)

unread,
Jan 21, 2026, 3:11:05 PM (12 days ago) Jan 21
to Chromium LUCI CQ, Daniel Cheng, AyeAye, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng

Mikel Astiz added 1 comment

File base/pickle.h
Line 224, Patchset 2 (Latest): // which in turn allow it to be implicitly converted to a `span`.
Mikel Astiz . unresolved

dch...@chromium.org: one option would be to remove begin() and end() functions altogether, and let callers migrate to using Pickle::data().

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 2
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Wed, 21 Jan 2026 20:10:48 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikel Astiz (Gerrit)

unread,
Jan 22, 2026, 9:28:07 AM (11 days ago) Jan 22
to Chromium LUCI CQ, Daniel Cheng, AyeAye, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng and Mikel Astiz

Mikel Astiz voted and added 2 comments

Votes added by Mikel Astiz

Commit-Queue+1

2 comments

Patchset-level comments
Mikel Astiz . unresolved

dcheng@: can you take a look at this change, starting with base/pickle.h?

I noticed the current APIs are not spanified and decided to take a stab. It's possible that I need to update a few additional occurrences, but it builds locally at least.

If the direction is looking good, I would also like to hear your opinion on whether or not this patch is worth splitting into smaller ones. That would involve temporarily exposing both APIs, hence coming up with a new name (e.g. `data_as_bytes()`).

Mikel Astiz

Upon second look at this, I am leaning towards renaming the functions anyway, as proposed in the latest patchset (precise names TBD).

Some of changes on the caller's side are non-trivial so I am also thinking they should be split to dedicated patches. I also don't know where to stop in the rabbit hole, so it seems better to discuss those cases specifically (e.g. I ended up refactoring `base/feature_list.cc` more than originally planned).

Nevertheless, I would appreciate early feedback on the proposed API and naming, before we discuss the details of calling sites and how the changes should be split.

File content/common/android/gin_java_bridge_value.cc
Line 76, Patchset 9 (Latest): if (pickle.AsBytes().empty() || pickle.payload_size() < sizeof(Header)) {
Mikel Astiz . unresolved

The second OR operand should be reverted to the original expression.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Mikel Astiz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 9
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-Attention: Mikel Astiz <mas...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Thu, 22 Jan 2026 14:27:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
Comment-In-Reply-To: Mikel Astiz <mas...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Alexei Svitkine (Gerrit)

unread,
Jan 22, 2026, 10:21:01 AM (11 days ago) Jan 22
to Mikel Astiz, Chromium LUCI CQ, Daniel Cheng, AyeAye, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng and Mikel Astiz

Alexei Svitkine added 1 comment

File base/feature_list.cc
Line 145, Patchset 9 (Latest):class FeatureEntry {
Alexei Svitkine . unresolved

This probably overlaps with https://chromium-review.googlesource.com/c/chromium/src/+/6813554.

Please coordinate with the other change to figure out what's the right approach/path forward. I didn't review in details.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
  • Mikel Astiz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 9
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-CC: Alexei Svitkine <asvi...@chromium.org>
Gerrit-Attention: Mikel Astiz <mas...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Thu, 22 Jan 2026 15:20:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikel Astiz (Gerrit)

unread,
Jan 22, 2026, 10:32:40 AM (11 days ago) Jan 22
to Alexei Svitkine, Chromium LUCI CQ, Daniel Cheng, AyeAye, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng

Mikel Astiz added 1 comment

File base/feature_list.cc
Line 145, Patchset 9 (Latest):class FeatureEntry {
Alexei Svitkine . unresolved

This probably overlaps with https://chromium-review.googlesource.com/c/chromium/src/+/6813554.

Please coordinate with the other change to figure out what's the right approach/path forward. I didn't review in details.

Mikel Astiz

Thanks for flagging. This patch is currently seeking preliminary review only, so I would sort out conflicts later (and in split form).

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 9
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-CC: Alexei Svitkine <asvi...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Thu, 22 Jan 2026 15:32:29 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Alexei Svitkine <asvi...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikel Astiz (Gerrit)

unread,
Jan 23, 2026, 4:57:02 AM (10 days ago) Jan 23
to Alexei Svitkine, Chromium LUCI CQ, Daniel Cheng, AyeAye, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng

Mikel Astiz added 2 comments

File base/pickle.h
Line 224, Patchset 2: // which in turn allow it to be implicitly converted to a `span`.
Mikel Astiz . unresolved

dch...@chromium.org: one option would be to remove begin() and end() functions altogether, and let callers migrate to using Pickle::data().

Mikel Astiz

data() was renamed to AsBytes() in the latest versions.

There's a broader topic here though: currently Pickle can be converted implicitly to a span, and I question if this is desirable. To me, this class is a somewhat complex datatype and an implicit conversion is worse than explicitly having to call AsBytes(). So I suggest either of two options:
1) [My preference] Remove implicit conversion to span (which implies removing begin()/end() APIs).
2) Remove AsBytes() and migrate callers to implicit conversion to span.

File content/common/android/gin_java_bridge_value.cc
Line 76, Patchset 9: if (pickle.AsBytes().empty() || pickle.payload_size() < sizeof(Header)) {
Mikel Astiz . resolved

The second OR operand should be reverted to the original expression.

Mikel Astiz

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 11
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-CC: Alexei Svitkine <asvi...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Fri, 23 Jan 2026 09:56:47 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mikel Astiz <mas...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Daniel Cheng (Gerrit)

unread,
Jan 25, 2026, 3:30:44 PM (8 days ago) Jan 25
to Mikel Astiz, Alexei Svitkine, Chromium LUCI CQ, Daniel Cheng, AyeAye, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Mikel Astiz

Daniel Cheng added 1 comment

File base/pickle.h
Line 224, Patchset 2: // which in turn allow it to be implicitly converted to a `span`.
Mikel Astiz . unresolved

dch...@chromium.org: one option would be to remove begin() and end() functions altogether, and let callers migrate to using Pickle::data().

Mikel Astiz

data() was renamed to AsBytes() in the latest versions.

There's a broader topic here though: currently Pickle can be converted implicitly to a span, and I question if this is desirable. To me, this class is a somewhat complex datatype and an implicit conversion is worse than explicitly having to call AsBytes(). So I suggest either of two options:
1) [My preference] Remove implicit conversion to span (which implies removing begin()/end() APIs).
2) Remove AsBytes() and migrate callers to implicit conversion to span.

Daniel Cheng

I think I agree; having `base::Pickle` be implicitly spannable feels a bit weird to me. I agree with removing `begin()` and `end()` and having explicit helpers to get the contents as a span.

The proposed names above seem fine to me; personally, I would probably just have `AsBytes()` and `AsWritableBytes()`; if people want as_string_view(), they can always manually call it themselves right? (I don't feel strongly about this last point, but I would try to avoid exposing APIs that expose arbitrary binary data as string views when possible. Obviously... people can still do it, but I'd still feel better about it :)

Open in Gerrit

Related details

Attention is currently required from:
  • Mikel Astiz
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 11
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-CC: Alexei Svitkine <asvi...@chromium.org>
Gerrit-Attention: Mikel Astiz <mas...@chromium.org>
Gerrit-Comment-Date: Sun, 25 Jan 2026 20:30:35 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikel Astiz (Gerrit)

unread,
Jan 26, 2026, 6:28:12 AM (7 days ago) Jan 26
to Alexei Svitkine, Chromium LUCI CQ, Daniel Cheng, AyeAye, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng

Mikel Astiz added 1 comment

File base/pickle.h
Line 224, Patchset 2: // which in turn allow it to be implicitly converted to a `span`.
Mikel Astiz . unresolved

dch...@chromium.org: one option would be to remove begin() and end() functions altogether, and let callers migrate to using Pickle::data().

Mikel Astiz

data() was renamed to AsBytes() in the latest versions.

There's a broader topic here though: currently Pickle can be converted implicitly to a span, and I question if this is desirable. To me, this class is a somewhat complex datatype and an implicit conversion is worse than explicitly having to call AsBytes(). So I suggest either of two options:
1) [My preference] Remove implicit conversion to span (which implies removing begin()/end() APIs).
2) Remove AsBytes() and migrate callers to implicit conversion to span.

Daniel Cheng

I think I agree; having `base::Pickle` be implicitly spannable feels a bit weird to me. I agree with removing `begin()` and `end()` and having explicit helpers to get the contents as a span.

The proposed names above seem fine to me; personally, I would probably just have `AsBytes()` and `AsWritableBytes()`; if people want as_string_view(), they can always manually call it themselves right? (I don't feel strongly about this last point, but I would try to avoid exposing APIs that expose arbitrary binary data as string views when possible. Obviously... people can still do it, but I'd still feel better about it :)

Mikel Astiz

I've split API changes to https://chromium-review.googlesource.com/c/chromium/src/+/7516607, we can continue to detailed discussion there.

Regarding string_view (but feel free to continue this thread in the other CL): I think strings are a bit special because historically they have been used to represent blobs. Even Pickle API does this internally, and several callers (including proto-generated code) still use std::string to represent blob data. That said, I don't feel particularly strongly about adding this API.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 12
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-CC: Alexei Svitkine <asvi...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Mon, 26 Jan 2026 11:27:55 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Mikel Astiz <mas...@chromium.org>
Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Mikel Astiz (Gerrit)

unread,
Jan 26, 2026, 7:15:51 AM (7 days ago) Jan 26
to Alexei Svitkine, Chromium LUCI CQ, Daniel Cheng, AyeAye, edgesto...@microsoft.com, dmurph+watching...@chromium.org, yhanada+...@chromium.org, agriev...@chromium.org, crostin...@chromium.org, loyso...@chromium.org, japhet+...@chromium.org, pmonett...@chromium.org, dibyapal+wa...@chromium.org, net-r...@chromium.org, kinuko...@chromium.org, aixba+wat...@chromium.org, ozone-...@chromium.org, gavin...@chromium.org, dcheng+c...@chromium.org, rsesek...@chromium.org, mpdento...@chromium.org, chromiumme...@microsoft.com, harringt...@chromium.org, multipaste-...@google.com, zelin+watch-we...@chromium.org, bnc+...@chromium.org, petewi...@chromium.org, blink-...@chromium.org, storage...@chromium.org, kinuko+...@chromium.org, mek+w...@chromium.org, kuragin+web-ap...@chromium.org, dmblack+watc...@google.com, mgiuca...@chromium.org, nickdiego+wa...@igalia.com, mac-r...@chromium.org, webap...@microsoft.com, iwells...@chromium.org, dmurph+watc...@chromium.org, andrewxu+wat...@google.com, asvitki...@chromium.org, browser-comp...@chromium.org, max+watc...@igalia.com, philli...@chromium.org
Attention needed from Daniel Cheng

Mikel Astiz added 1 comment

File base/pickle.h
Line 224, Patchset 2: // which in turn allow it to be implicitly converted to a `span`.
Mikel Astiz . unresolved

dch...@chromium.org: one option would be to remove begin() and end() functions altogether, and let callers migrate to using Pickle::data().

Mikel Astiz

data() was renamed to AsBytes() in the latest versions.

There's a broader topic here though: currently Pickle can be converted implicitly to a span, and I question if this is desirable. To me, this class is a somewhat complex datatype and an implicit conversion is worse than explicitly having to call AsBytes(). So I suggest either of two options:
1) [My preference] Remove implicit conversion to span (which implies removing begin()/end() APIs).
2) Remove AsBytes() and migrate callers to implicit conversion to span.

Daniel Cheng

I think I agree; having `base::Pickle` be implicitly spannable feels a bit weird to me. I agree with removing `begin()` and `end()` and having explicit helpers to get the contents as a span.

The proposed names above seem fine to me; personally, I would probably just have `AsBytes()` and `AsWritableBytes()`; if people want as_string_view(), they can always manually call it themselves right? (I don't feel strongly about this last point, but I would try to avoid exposing APIs that expose arbitrary binary data as string views when possible. Obviously... people can still do it, but I'd still feel better about it :)

Mikel Astiz

I've split API changes to https://chromium-review.googlesource.com/c/chromium/src/+/7516607, we can continue to detailed discussion there.

Regarding string_view (but feel free to continue this thread in the other CL): I think strings are a bit special because historically they have been used to represent blobs. Even Pickle API does this internally, and several callers (including proto-generated code) still use std::string to represent blob data. That said, I don't feel particularly strongly about adding this API.

Mikel Astiz

I ended up looking more closely into base::Pickle and decided to engage a bit more, specially after noticing how odd the instances with unowned buffers are.

I captured a proposal in https://docs.google.com/document/d/1cJXxEk0DwzRqxmXd65KZhpeBHmMP5ZShO7LJUFdZhZw/edit?usp=sharing.

dch...@chromium.org would you mind taking a look and sharing if this is worth pursuing and whose approval it would require? I'm prototyped most of the work and things seem to be feasible. Among other things, the IPC code would need some mechanical changes that would need review from IPC/Mojo owners, but I notice you happen to be listed as one.

Open in Gerrit

Related details

Attention is currently required from:
  • Daniel Cheng
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I72602a47e3c66f9f510fe9b8a5ffa7fd7806ef9b
Gerrit-Change-Number: 7504678
Gerrit-PatchSet: 13
Gerrit-Owner: Mikel Astiz <mas...@chromium.org>
Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
Gerrit-Reviewer: Mikel Astiz <mas...@chromium.org>
Gerrit-CC: Alexei Svitkine <asvi...@chromium.org>
Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
Gerrit-Comment-Date: Mon, 26 Jan 2026 12:15:39 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy
Reply all
Reply to author
Forward
0 new messages