DescriptionReplace RawPtr with RefPtr on StylePendingImage
This change ensures StylePendingImages set on ComputedStyles will keep
their corresponding CSSValue alive.
The PendingImagePropertyMap on ElementStyleResources was supposed to do
this however it only keeps alive one per property while properties can
have any number of images set on them (background-image).
Prior to this change StylePendingImages held a RawPtr to their CSSValue
to avoid a ref loop because the CSSValue would hold a RefPtr to the
StylePendingImage as a cache.
After this change StylePendingImages hold RefPtrs to their CSSValue
while CSSValues no longer cache StylePendingImages. Having multiple
StylePendingImages per CSSValue is equivalent to using cached
StylePendingImages as no state changes on the StylePendingImage
during the StyleResourceLoader pass.
The old scenario is not currently a problem as all applied CSSValues
have their refs held elsewhere (style rules or AnimatableImages).
Future animation work intends to apply temporary CSSValue images and
must ensure StylePendingImages keep a ref to avoid a use after free.
This patch is a refactor towards memory management correctness and has
no behavioural changes.
BUG=437696
Committed: https://crrev.com/1dd18b7ea8db7d3344024277e04c8a5365c03cf1
Cr-Commit-Position: refs/heads/master@{#350808}
Patch Set 1 #Patch Set 2 : Fix image set caching logic #Messages
Total messages: 13 (5 generated)
|