Clean CSS random cache when associated element is not alive [chromium/src : main]

0 views
Skip to first unread message

Munira Tursunova (Gerrit)

unread,
Feb 27, 2026, 5:15:29 PM (3 days ago) Feb 27
to oilpan-...@chromium.org

Munira Tursunova has uploaded the change for review

Commit message

Clean CSS random cache when associated element is not alive

If Element was removed, clean random base value cache entries, which
keys are associated with that element.
Bug: 413385732
Change-Id: I80107e104ed5fcf039614303e1bfa3a404b75495

Change diff


Change information

Files:
  • M third_party/blink/renderer/core/css/css_math_expression_node.h
  • M third_party/blink/renderer/core/css/random_caching_key.cc
  • M third_party/blink/renderer/core/css/random_caching_key.h
  • M third_party/blink/renderer/core/css/style_engine.cc
  • M third_party/blink/renderer/core/css/style_engine.h
  • M third_party/blink/renderer/core/css/style_engine_test.cc
Change size: M
Delta: 6 files changed, 51 insertions(+), 5 deletions(-)
Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: newchange
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I80107e104ed5fcf039614303e1bfa3a404b75495
Gerrit-Change-Number: 7260440
Gerrit-PatchSet: 2
Gerrit-Owner: Munira Tursunova <moo...@google.com>
Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
satisfied_requirement
unsatisfied_requirement
open
diffy

Munira Tursunova (Gerrit)

unread,
Feb 27, 2026, 5:15:44 PM (3 days ago) Feb 27
to Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org

New activity on the change

Open in Gerrit

Related details

Attention set is empty
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I80107e104ed5fcf039614303e1bfa3a404b75495
Gerrit-Change-Number: 7260440
Gerrit-PatchSet: 2
Gerrit-Owner: Munira Tursunova <moo...@google.com>
Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Comment-Date: Fri, 27 Feb 2026 22:15:24 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Munira Tursunova (Gerrit)

unread,
Feb 27, 2026, 5:36:26 PM (3 days ago) Feb 27
to Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
Attention needed from Rune Lillesveen

Munira Tursunova voted Commit-Queue+1

Commit-Queue+1
Open in Gerrit

Related details

Attention is currently required from:
  • Rune Lillesveen
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I80107e104ed5fcf039614303e1bfa3a404b75495
Gerrit-Change-Number: 7260440
Gerrit-PatchSet: 2
Gerrit-Owner: Munira Tursunova <moo...@google.com>
Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
Gerrit-CC: Menard, Alexis <alexis...@intel.com>
Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
Gerrit-Comment-Date: Fri, 27 Feb 2026 22:36:10 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Rune Lillesveen (Gerrit)

unread,
4:01 AM (20 hours ago) 4:01 AM
to Munira Tursunova, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
Attention needed from Munira Tursunova

Rune Lillesveen added 1 comment

File third_party/blink/renderer/core/css/random_caching_key.h
Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
Rune Lillesveen . unresolved

Why can't this be WeakMember? Is it because name_ + nullptr element_ is a different key from name_ + element_ which has been nullified as a weak reference?

Open in Gerrit

Related details

Attention is currently required from:
  • Munira Tursunova
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Munira Tursunova <moo...@google.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 09:00:49 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Munira Tursunova (Gerrit)

    unread,
    5:01 AM (19 hours ago) 5:01 AM
    to Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Rune Lillesveen

    Munira Tursunova added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Rune Lillesveen . unresolved

    Why can't this be WeakMember? Is it because name_ + nullptr element_ is a different key from name_ + element_ which has been nullified as a weak reference?

    Munira Tursunova

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Rune Lillesveen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 10:01:40 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Rune Lillesveen <fut...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    5:32 AM (18 hours ago) 5:32 AM
    to Munira Tursunova, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Munira Tursunova

    Rune Lillesveen added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Rune Lillesveen . unresolved

    Why can't this be WeakMember? Is it because name_ + nullptr element_ is a different key from name_ + element_ which has been nullified as a weak reference?

    Munira Tursunova

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    Rune Lillesveen

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    My fundamental problem here is that I don't know what you are trying to fix.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Munira Tursunova
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-Attention: Munira Tursunova <moo...@google.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 10:32:35 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Rune Lillesveen <fut...@chromium.org>
    Comment-In-Reply-To: Munira Tursunova <moo...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Lippautz (Gerrit)

    unread,
    6:36 AM (17 hours ago) 6:36 AM
    to Munira Tursunova, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Munira Tursunova

    Michael Lippautz added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Rune Lillesveen . unresolved

    Why can't this be WeakMember? Is it because name_ + nullptr element_ is a different key from name_ + element_ which has been nullified as a weak reference?

    Munira Tursunova

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    Rune Lillesveen

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    My fundamental problem here is that I don't know what you are trying to fix.

    Michael Lippautz

    WeakMember are cleared on GC :) not sure what ele to say here.

    I guess what you want to keep the cache dependent on the liveness of `Element`. My suggestion would be to model that explicitly somehow: Keep the cache on something related to `Element`, so it goes automatically away. E.g. keep some `Member<>` references from some rare data.

    If that's not possible, this can be modelled externally (outside of `Element`) with the following:

    • HeapHashMap<WeakMember<Element>, Member<HeapVector<Member<RandomCachingKey>> element_keeps_cache_key_alive;
    • HeapHashMap<WeakMember<RandomCachingKey>, double> cache;

    with `RandomCachingKey::element_` being `WeakMember` as well.

    Memory wise the entry gets a bit more expensive (because of the `element_keeps_cache_key_alive` map) but liveness works automatically.

    Only if that is not an option, we should do manual callbacks...

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Munira Tursunova
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Munira Tursunova <moo...@google.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 11:35:54 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Munira Tursunova (Gerrit)

    unread,
    7:59 AM (16 hours ago) 7:59 AM
    to Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Michael Lippautz and Rune Lillesveen

    Munira Tursunova added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Rune Lillesveen . unresolved

    Why can't this be WeakMember? Is it because name_ + nullptr element_ is a different key from name_ + element_ which has been nullified as a weak reference?

    Munira Tursunova

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    Rune Lillesveen

    I don't know when it will be nullified if I use `WeakMember`. So what if sometimes it will be nullified before `WeakCallbackMethod` is called? Then we won't clean the entry in the cache assosiated with this key, since `IsHeapObjectAlive` will return true, it says so in the comment here: https://source.chromium.org/chromium/chromium/src/+/main:v8/include/cppgc/liveness-broker.h;l=48?q=IsHeapObjectAlive&ss=chromium%2Fchromium%2Fsrc:

    nullptr objects are considered alive ...

    I don't know oilpan well, so I thought it would be safer to use `UntracedMember` here, since I assume it shouldn't be nullified.

    My fundamental problem here is that I don't know what you are trying to fix.

    Michael Lippautz

    WeakMember are cleared on GC :) not sure what ele to say here.

    I guess what you want to keep the cache dependent on the liveness of `Element`. My suggestion would be to model that explicitly somehow: Keep the cache on something related to `Element`, so it goes automatically away. E.g. keep some `Member<>` references from some rare data.

    If that's not possible, this can be modelled externally (outside of `Element`) with the following:

    • HeapHashMap<WeakMember<Element>, Member<HeapVector<Member<RandomCachingKey>> element_keeps_cache_key_alive;
    • HeapHashMap<WeakMember<RandomCachingKey>, double> cache;

    with `RandomCachingKey::element_` being `WeakMember` as well.

    Memory wise the entry gets a bit more expensive (because of the `element_keeps_cache_key_alive` map) but liveness works automatically.

    Only if that is not an option, we should do manual callbacks...

    Munira Tursunova

    Thank you, Michael for the suggestions.

    >If that's not possible, this can be modelled externally (outside of Element) with the following:


    HeapHashMap<WeakMember<Element>, Member<HeapVector<Member<RandomCachingKey>> element_keeps_cache_key_alive;
    HeapHashMap<WeakMember<RandomCachingKey>, double> cache;

    Some of the cache entries are not element dependent, i.e. we can have `RandomCachingKey` with `RandomCachingKey::element_` always set to nullptr. I guess if we use WeakMember<RandomCachingKey> in cache for them (how you suggested above) there would be no one keeping them alive, no?

    About storing cache on Element's rare data, I'm not sure what we can/canot add there, so I was trying to avoid that, we can actually just use hash if we can store a seed there, so we won't need a cache at all, even the one on style_engine. But I went with this aporoach since it seemed easier :)

    Rune, about your question:

    >My fundamental problem here is that I don't know what you are trying to fix.

    Currently the random_values_cache is not properly cleaned, so when we remove Element, the RandomCachingKey entry that has a pointer to the removed Element is not getting cleaned. I'm trying to fix this problem in this CL. Please have a look at added `StyleEngineTest`, without changes in this Cl, the cache is never cleared, so second `EXPECT_EQ()` check will fail.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Lippautz
    • Rune Lillesveen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 12:59:41 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    8:31 AM (15 hours ago) 8:31 AM
    to Munira Tursunova, Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Michael Lippautz and Munira Tursunova

    Rune Lillesveen added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Rune Lillesveen

    Thank you, Michael for the suggestions.

    >If that's not possible, this can be modelled externally (outside of Element) with the following:
    HeapHashMap<WeakMember<Element>, Member<HeapVector<Member<RandomCachingKey>> element_keeps_cache_key_alive;
    HeapHashMap<WeakMember<RandomCachingKey>, double> cache;

    Some of the cache entries are not element dependent, i.e. we can have `RandomCachingKey` with `RandomCachingKey::element_` always set to nullptr. I guess if we use WeakMember<RandomCachingKey> in cache for them (how you suggested above) there would be no one keeping them alive, no?

    My immediate thought is that they should be two different HashMaps, then. I think we've discussed that before and you wanted to have a single map for some reason.

    About storing cache on Element's rare data, I'm not sure what we can/canot add there, so I was trying to avoid that, we can actually just use hash if we can store a seed there, so we won't need a cache at all, even the one on style_engine. But I went with this aporoach since it seemed easier :)

    Rune, about your question:

    >My fundamental problem here is that I don't know what you are trying to fix.

    Currently the random_values_cache is not properly cleaned, so when we remove Element, the RandomCachingKey entry that has a pointer to the removed Element is not getting cleaned. I'm trying to fix this problem in this CL. Please have a look at added `StyleEngineTest`, without changes in this Cl, the cache is never cleared, so second `EXPECT_EQ()` check will fail.

    I shouldn't have to decode the unit tests to figure out what the CL is trying to do. It should be described in the CL description.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Lippautz
    • Munira Tursunova
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Munira Tursunova <moo...@google.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 13:30:53 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Michael Lippautz (Gerrit)

    unread,
    9:06 AM (15 hours ago) 9:06 AM
    to Munira Tursunova, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Munira Tursunova

    Michael Lippautz added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Michael Lippautz . unresolved

    Opening this up as separate comment: If there's no element that's guarding the entry liveness. How are we preventing the cache blowing out of proportion when there's no elements assigned?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Munira Tursunova
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Munira Tursunova <moo...@google.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 14:06:31 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Munira Tursunova (Gerrit)

    unread,
    9:44 AM (14 hours ago) 9:44 AM
    to Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Michael Lippautz

    Munira Tursunova added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Michael Lippautz . unresolved

    Opening this up as separate comment: If there's no element that's guarding the entry liveness. How are we preventing the cache blowing out of proportion when there's no elements assigned?

    Munira Tursunova

    We don't, the way I understand the spec, these kind of entries should have livetime of the document, so yes, we will keep them while document is alive.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Lippautz
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 14:43:51 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Rune Lillesveen (Gerrit)

    unread,
    9:49 AM (14 hours ago) 9:49 AM
    to Munira Tursunova, Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Michael Lippautz and Munira Tursunova

    Rune Lillesveen added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Michael Lippautz . unresolved

    Opening this up as separate comment: If there's no element that's guarding the entry liveness. How are we preventing the cache blowing out of proportion when there's no elements assigned?

    Munira Tursunova

    We don't, the way I understand the spec, these kind of entries should have livetime of the document, so yes, we will keep them while document is alive.

    Rune Lillesveen

    We don't, the way I understand the spec, these kind of entries should have livetime of the document, so yes, we will keep them while document is alive.

    They do have some upper bound as a function of the number of known standard css properties, registered custom properties, and max number of random() instances per a single declaration, which is a lot less likely to blow up than for element references, right?

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Lippautz
    • Munira Tursunova
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Munira Tursunova <moo...@google.com>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 14:48:58 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
    Comment-In-Reply-To: Munira Tursunova <moo...@google.com>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Munira Tursunova (Gerrit)

    unread,
    9:54 AM (14 hours ago) 9:54 AM
    to Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Michael Lippautz and Rune Lillesveen

    Munira Tursunova added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2 (Latest): UntracedMember<const Element> element_;
    Michael Lippautz . unresolved

    Opening this up as separate comment: If there's no element that's guarding the entry liveness. How are we preventing the cache blowing out of proportion when there's no elements assigned?

    Munira Tursunova

    We don't, the way I understand the spec, these kind of entries should have livetime of the document, so yes, we will keep them while document is alive.

    Rune Lillesveen

    We don't, the way I understand the spec, these kind of entries should have livetime of the document, so yes, we will keep them while document is alive.

    They do have some upper bound as a function of the number of known standard css properties, registered custom properties, and max number of random() instances per a single declaration, which is a lot less likely to blow up than for element references, right?

    Munira Tursunova

    >They do have some upper bound as a function of the number of known standard css properties, registered custom properties, and max number of random() instances per a single declaration, which is a lot less likely to blow up than for element references, right?

    Yes, but I'm not sure I understand this part "...and max number of random() instances per a single declaration...". We can have different random() identifiers as well as standard css properties and registered custom properties for caching. So theoretically we might have a blowed up cache, if we have many random() values with different identifiers,i.e. `random(--ident, ...)` on the page. But seems unlikely to happen.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Lippautz
    • Rune Lillesveen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 2
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 14:53:55 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Michael Lippautz <mlip...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Munira Tursunova (Gerrit)

    unread,
    10:03 AM (14 hours ago) 10:03 AM
    to Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    Attention needed from Michael Lippautz and Rune Lillesveen

    Munira Tursunova added 1 comment

    File third_party/blink/renderer/core/css/random_caching_key.h
    Line 37, Patchset 2: UntracedMember<const Element> element_;
    Munira Tursunova

    >I shouldn't have to decode the unit tests to figure out what the CL is trying to do. It should be described in the CL description.

    Updated CL description hope it's clearer now.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Michael Lippautz
    • Rune Lillesveen
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I80107e104ed5fcf039614303e1bfa3a404b75495
    Gerrit-Change-Number: 7260440
    Gerrit-PatchSet: 3
    Gerrit-Owner: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Munira Tursunova <moo...@google.com>
    Gerrit-Reviewer: Rune Lillesveen <fut...@chromium.org>
    Gerrit-CC: Menard, Alexis <alexis...@intel.com>
    Gerrit-CC: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Michael Lippautz <mlip...@chromium.org>
    Gerrit-Attention: Rune Lillesveen <fut...@chromium.org>
    Gerrit-Comment-Date: Mon, 02 Mar 2026 15:03:16 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Munira Tursunova (Gerrit)

    unread,
    10:12 AM (14 hours ago) 10:12 AM
    to Michael Lippautz, Rune Lillesveen, Chromium LUCI CQ, Menard, Alexis, chromium...@chromium.org, oilpan-...@chromium.org, apavlo...@chromium.org, blink-re...@chromium.org, blink-...@chromium.org
    File third_party/blink/renderer/core/css/random_caching_key.h
    Munira Tursunova

    Also, I think I didn't explain properly why I don't want to store values on ElementRareData, since we get Element object from CSSLengthResolver, we need to make it mutable if we want to add/get random values to ElementRareData and I'm not sure if we want to allow that.

    Gerrit-Comment-Date: Mon, 02 Mar 2026 15:11:54 +0000
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy
    Reply all
    Reply to author
    Forward
    0 new messages