Closed Bug 1470099 Opened 2 years ago Closed 2 years ago

Make CSSStyleDeclaration's wrapper use nursery heap and make last Release call ClearComputedStyle();

Categories

(Core :: DOM: CSS Object Model, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla62
Tracking Status
firefox62 --- fixed

People

(Reporter: smaug, Assigned: smaug)

References

(Blocks 1 open bug)

Details

Attachments

(2 files)

No description provided.
Assignee: nobody → bugs
Make the wrapper nursery allocated, use faster mainthread-only refcounting (this way cycle collector uses main-thread only purple buffer nursery), call ClearComputedStyle() sooner.

remote: View the pushlog for these changes here:
remote:   https://hg.mozilla.org/try/pushloghtml?changeset=34c3f38fb67e6fdcd817203f7bf87deb7083e67c
remote: 
remote: Follow the progress of your build on Treeherder:
remote:   https://treeherder.mozilla.org/#/jobs?repo=try&revision=34c3f38fb67e6fdcd817203f7bf87deb7083e67c
remote: recorded changegroup in replication log in 0.115s
Attachment #8986731 - Flags: review?(emilio)
Comment on attachment 8986731 [details] [diff] [review]
shortliving_cssstyledeclaration.diff

Review of attachment 8986731 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/webidl/CSSStyleDeclaration.webidl
@@ +8,5 @@
>   */
>  
> + // Because of getComputedStyle, many CSSStyleDeclaration objects can be
> + // short-living.
> +[ProbablyShortLivingWrapper]

Disclaimer: I'm not totally familiar with all of the implications of this. I guess it makes sense for getComputedStyle, but not sure how much would this slow down or impact element.style / cssrule.style / etc.

I guess that if node lists have this it may make sense for this to have it as well.

::: layout/style/nsComputedDOMStyle.cpp
@@ +375,5 @@
>  NS_INTERFACE_MAP_END_INHERITING(nsDOMCSSDeclaration)
>  
>  
> +NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_ADDREF(nsComputedDOMStyle)
> +NS_IMPL_MAIN_THREAD_ONLY_CYCLE_COLLECTING_RELEASE_WITH_LAST_RELEASE(

Maybe change the destructor to assert !mResolvedComputedStyle instead of calling ClearComputedStyle(), with a comment pointing here?
Attachment #8986731 - Flags: review?(emilio) → review+
Attached patch + assertionSplinter Review
Still compiling (a debug build) to see if it could fire. I can't see any reason why it would.
Pushed by opettay@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/412d61652806
Make CSSStyleDeclaration's wrapper use nursery heap and make last Release call ClearComputedStyle(), r=emilio
https://hg.mozilla.org/mozilla-central/rev/412d61652806
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla62
You need to log in before you can comment on or make changes to this bug.