Closed Bug 815397 Opened 12 years ago Closed 12 years ago

Update Accessibility cycle collector traverse/unlink definitions

Categories

(Core :: Disability Access APIs, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla20

People

(Reporter: mccr8, Assigned: mccr8)

References

(Blocks 1 open bug)

Details

Attachments

(1 file)

      No description provided.
Attached patch update themSplinter Review
There are a few categories of changes here:
- A number of cases with ambiguous bases can be handled automatically now.
- Similarly with nsTArrays
- Removed a null check that isn't really needed
- I added automated CC support for AccessibleHashtable, and made these fields use the generic definitions.

- After the other changes, a number of the Traverse/Unlink definitions are very generic and can be replaced with a single macro call. Plus, some existing ones can now be replaced, because INHERITED is supported.


It seems a little odd to me that mDependentIDsHash and mNodeToAccessibleMap are cleared in the Unlink of DocAccessible, but aren't Traversed. Not knowing anything about this code, I'd have expected that either these tables be added to the Traverse, or be moved to the destructor. I left that alone.

I haven't actually tested this patch yet.
Assignee: nobody → continuation
> - I added automated CC support for AccessibleHashtable, and made these
> fields use the generic definitions.

do we have automated support for generic hash tables? if so we might well want to just get rid of the accessible cache thing all together, if not hopefully someday I'll get around to templating that stuff harder so we can cache things as types other than Accessible*

> It seems a little odd to me that mDependentIDsHash and mNodeToAccessibleMap
> are cleared in the Unlink of DocAccessible, but aren't Traversed. Not
> knowing anything about this code, I'd have expected that either these tables
> be added to the Traverse, or be moved to the destructor. I left that alone.

as I remember it they don't hold any refs, so moving the calls to Shutdown() seems like the right thing to do.
(In reply to Trevor Saunders (:tbsaunde) from comment #2)
> do we have automated support for generic hash tables? if so we might well
> want to just get rid of the accessible cache thing all together, if not
> hopefully someday I'll get around to templating that stuff harder so we can
> cache things as types other than Accessible*

No, we don't. Hash tables are pretty common, so it would be nice to have, though that won't help with PLDHashTables that don't have templated types.

> as I remember it they don't hold any refs, so moving the calls to Shutdown()
> seems like the right thing to do.

Okay, great, I'll look into that.
mDependentIDsHash has type nsClassHashtable<nsStringHashKey, AttrRelProviderArray>.

The latter is defined like this:
  typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviderArray;

AttrRelProvider is not a cycle collected class, though it does contain a field:
  nsCOMPtr<nsIContent> mContent;
So maybe it should be cycle collected?

mNodeToAccessibleMap has type nsDataHashtable<nsPtrHashKey<const nsINode>, Accessible*>, so it doesn't own anything and should be okay.
(In reply to Andrew McCreight [:mccr8] from comment #4)
> mDependentIDsHash has type nsClassHashtable<nsStringHashKey,
> AttrRelProviderArray>.
> 
> The latter is defined like this:
>   typedef nsTArray<nsAutoPtr<AttrRelProvider> > AttrRelProviderArray;
> 
> AttrRelProvider is not a cycle collected class, though it does contain a
> field:
>   nsCOMPtr<nsIContent> mContent;
> So maybe it should be cycle collected?

I guess so though I don't see how that member could ever point to something that isn't certainly alive, those nsIContent*s should only be things where IsInDoc() is true.
Okay, great, I'll just leave it alone then.
Could we assert that the mContent is always in a document which is certainly alive?
Attachment #685366 - Flags: review?(bugs)
I can file a followup for that.
Filed bug 815837.
Comment on attachment 685366 [details] [diff] [review]
update them


>+inline void
>+ImplCycleCollectionUnlink(AccessibleHashtable &aCache)
AccessibleHashtable& aCache


> 
>+#define NS_IMPL_CYCLE_COLLECTION_NATIVE_0(_class)                              \
>+ NS_IMPL_CYCLE_COLLECTION_NATIVE_CLASS(_class)                                 \
>+ NS_IMPL_CYCLE_COLLECTION_UNLINK_0(_class)                                     \
>+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(_class)                               \
>+ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
I don't see any need for _0
And _0 case should be also very odd case which means probably a bug elsewhere.
Perhaps better to not add it.
Attachment #685366 - Flags: review?(bugs) → review+
True. I'll not add it, and then put a little comment about why.
https://hg.mozilla.org/mozilla-central/rev/95afbeaf4fe9
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla20
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: