Closed Bug 1486623 Opened 2 years ago Closed 2 years ago
DOM tree memory reporting likely misses some nodes
46 bytes, text/x-phabricator-request
|Details | Review|
There are two places we do memory reporting on DOM trees: nsDocument::DocAddSizeOfExcludingThis and xpc::OrphanReporter The former uses AllChildrenIterator so it will miss nodes not in the flat tree, as well as ShadowRoots. The latter does just a firstChild/nextSibling walk, so misses all the Shadow DOM stuff. We should think about a way to make these walks actually hit all nodes.
Assignee: nobody → emilio
This moves all the node-specific reporting to nsIDocument. OrphanReporter delegates all the reporting to that and then returns the sum of all sizes, which is not ideal but was pre-existing. Also, I moved the main mStyleSheets size reporting to DocumentOrShadowRoot for it to be shared between document and ShadowRoot. I'll add memory reporting for the computed stylesheet maps and such in the ShadowRoot in a followup. I went through all the XBL bindings, though it seems I could just use GetBindingWithContent(), since according to: https://searchfox.org/mozilla-central/rev/55da592d85c2baf8d8818010c41d9738c97013d2/dom/xbl/nsXBLBinding.cpp#615 We don't allow multiple bindings to contribute anon content. Anyway it was the same amount of code...
Comment on attachment 9004512 [details] Skip less nodes when reporting memory, and report ShadowRoot's StyleSheets. Boris Zbarsky [:bzbarsky, bz on IRC] has approved the revision.
Attachment #9004512 - Flags: review+
Pushed by email@example.com: https://hg.mozilla.org/integration/autoland/rev/2f49db02e5f6 Skip less nodes when reporting memory, and report ShadowRoot's StyleSheets. r=bzbarsky
You need to log in before you can comment on or make changes to this bug.