DescriptionUse weak members to cache StyleSheetContents.
We used the client count to detect if we could remove a
StyleSheetContents from the StyleEngine cache or not. The problem is
that the client references are removed when the element is removed from
the DOM, but the StyleSheetContents is still referenced from the
CSSStyleSheet which is accessible from CSSOM. That caused bugs with
StyleSheetContents being marked as mutable without removing it from the
cache causing assertions, and mutating the sheet without copy-on-write
because we thought we only had a single client for the contents.
Instead use weak members in the cache and let garbage collection delete
the StyleSheetContents when no longer referenced. Also, add a flag to
StyleSheetContents to say that it is referenced by multiple sheets when
we use and already cached object instead of incorrectly relying on
client count.
R=timloh@chromium.org,haraken@chromium.org
BUG=633210, 628488
Committed: https://crrev.com/473ac0866d46d55bf57293ce3bb27870f672dc40
Cr-Commit-Position: refs/heads/master@{#409495}
Patch Set 1 #Patch Set 2 : Another CORE_EXPORT #Patch Set 3 : Might be in cache without being used before garbage collection #
Total comments: 2
Messages
Total messages: 31 (20 generated)
|