[CTW] Include info about the parent process a11y cache in about:memory
Categories
(Core :: Disability Access APIs, task)
Tracking
()
Tracking | Status | |
---|---|---|
firefox108 | --- | fixed |
People
(Reporter: Jamie, Assigned: pbone)
References
Details
Attachments
(1 file)
It seems like it would be useful to be able to easily discover how much memory the parent process a11y cache is using. about:memory should serve that purpose.
This will involve implementing a memory reporter (nsIMemoryReporter). I spoke to :pbone about this. He pointed me to the WebAudioBuffer memory reporter as a simple starting example: setup code, usage.
We probably want to do this per-document. :pbone noted that anonymised memory reports can be requested, so we'll need to handle that in the same way that content process domain info is anonymised.
Reporter | ||
Comment 1•2 years ago
|
||
Copying Morgan since she worked on the memory a11ylog code for LocalAccessibles (content process) in bug 1694569. It'd probably be useful to get that into about:memory too, but that should probably be a separate bug.
Assignee | ||
Updated•2 years ago
|
Assignee | ||
Comment 2•2 years ago
|
||
From Jamie on Slack:
jteh 11:55 AM
data:text/html,<details><summary>foo</summary>bar</details>
jteh 12:31 PM
Two classes that are most relevant for caching are DocAccessibleParent and RemoteAccessibleBase
The bulk of the cache for each Accessible is stored in AccAttributes
Assignee | ||
Comment 3•2 years ago
|
||
More knowledge from jteh.
I asked:
With any luck I'm going to repeat something you told me yesterday, to make sure I understand. A
RemoteAccessible
orRemoteAccessibleBase
is a DOM-ish (but not really) node, it's in a tree?
Jamie says Yes.
A
DocAccessibleParent
is a special case of this where the node IS the whole document. Each document has sub nodes and those have fields. we want to count all that for the cache? So for eachRemoteAccessible
we want to recurse intomChildren
?
That's correct. You can think of DocAccessibleParent kinda like dom::Document and RemoteAccessible kinda like dom::Element, but it's a very rough analogy.
Will I ever visit the same node twice doing this (can a child have more than one parent?)
No, and children should not otherwise appear more than once.
Bonus round: Do I need to do anything to start using this on Linux without a screen reader or does it already initialise? (I know I asked this before but I forgot)
If accessibility is activicated in about:support
and accessibility.cache.enabled
is true. it should be good to go.
Jamie also said:
One other thing to note is that AccAttributes can be nested up to one level deep. That is, it's possible to store an AccAttributes within an AccAttributes. We only ever nest once though.
I'm not sure if that will have an impact on the memory reporter stuff; not sure how it traverses hash maps
Again, no loops in AccAttributes though; an AccAttributes cannot refer to an AccAttributes that is its parent/ancestor.
Assignee | ||
Comment 4•2 years ago
|
||
Hi Jamie,
When I'm walking the AccAttributes
structure and I come to an AccGroupInfo
I see that it has two fields that are pointers to Accessible
.
https://searchfox.org/mozilla-central/source/accessible/base/AccGroupInfo.h#104-105
Are they shared by other structures, if I count them as part of the cache to I have to be careful not to count duplicates? Should they be part of the cache at all?
And can the nsString
in the AccAttributes
variant type have shared sub-strings?
Thanks.
Reporter | ||
Comment 5•2 years ago
|
||
(In reply to Paul Bone [:pbone] from comment #4)
When I'm walking the
AccAttributes
structure and I come to anAccGroupInfo
I see that it has two fields that are pointers toAccessible
.
Are they shared by other structures, if I count them as part of the cache to I have to be careful not to count duplicates?
An Accessible referenced in AccGroupInfo will always be an Accessible included in the document; i.e. included in DocAccessibleParent::mAccessibles. So you shouldn't count the memory used by those Accessibles.
Should they be part of the cache at all?
The only way we should count these is the memory the pointers consume within AccGroupInfo; i.e. their contribution to sizeof(AccGroupInfo).
And can the
nsString
in theAccAttributes
variant type have shared sub-strings?
No.
Thanks.
Thank you! :)
Assignee | ||
Comment 6•2 years ago
|
||
Pushed by pbone@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/00c1b7932261 Add a memory reporter for the a11y cache r=Jamie
Comment 8•2 years ago
|
||
bugherder |
Description
•