Curious about the motivation here, beyond switching from a hashtable to an
array. Is the tracing cost that large?

It seems like it forces a lot more boilerplate in very central classes and
may make some of them considerably larger because they need space for
members, some of which are nearly always absent. Especially across the
core/ and modules/ divide, we'll need to forward-declare code that this
class doesn't need to know about, which is itself a layering violation
albeit one that doesn't break the compile.

We have a similar concept outside Blink, in the form of
base::SupportsUserData, for similar reasons (and we presumably wouldn't
want WebContentsImpl to have members for every possible user data it might
have.

On Thu, Nov 13, 2025 at 4:18 AM Steinar H. Gunderson <[email protected]>
wrote:

> Hi all,
>
> We're making a change in Supplementable<T> (and Supplement<T>) to remove
> it;
> we already changed it from a hash table to a simple array underneath,
> with good size gains (and a small Speedometer3 gain from the single hottest
> member).
>
> For members where there is no layering violation, we'll simply
> forward-declare the class in the .h file and have a Member<>,
> along with a getter and setter.
>
> For members where we cannot do that (e.g. Document, in, core/document.h,
> wants to have a Member<RTCPeerConnectionController>, which is defined
> in modules/peerconnection/rtc_peer_connection_controller.h, and core/
> cannot #include anything from modules/) we'll instead use the new
> ForwardDeclaredMember<> which has almost the same ergonomics but
> under-the-hood Trace()s via a vtable pointer like Supplement<> does today.
>
> There's going to be a bunch of new getters and setters (and Members)
> showing up, but they already existed through template magic; they are
> just becoming visible now and given names and types (as opposed to being
> string-keyed, which risks type confusion). We expect a tiny further
> decrease in binary size and no significant change in compilation time.
>
> Example CL:
> https://chromium-review.googlesource.com/c/chromium/src/+/7137540
>
> /* Steinar */
> --
> Homepage: https://www.sesse.net/
>
> --
> You received this message because you are subscribed to the Google Groups
> "blink-dev" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion visit
> https://groups.google.com/a/chromium.org/d/msgid/blink-dev/ezwpu2bqbv7zau2uzqesynuaxpi7irjg2u2ojsshuktmjjkg4u%40oy2xauimoxhn
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"blink-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/a/chromium.org/d/msgid/blink-dev/CACuR13dxfU0CHo-akymg4OGn%2BAqYNCK--qspHsBQnS1U929NOw%40mail.gmail.com.

Reply via email to