Open Bug 822778 Opened 12 years ago Updated 2 years ago

Combine all XPCOM hash table classes behind one template

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

People

(Reporter: seth, Unassigned)

Details

It seems a bit silly that we have 5 different XPCOM hash table classes that you have to choose from based purely on static, type-level information. This is the sort of thing that templates can and should do for you. We should only have one hash table class, and select the correct implementation based upon the key and value type specified by the user.
I'm not sure I agree. nsDataHashtable<nsSomeKey, nsISupports*> and nsInterfaceHashtable<nsSomeKey, nsISupports> are fundamentally different (owning versus non-owning). You could try to paramaterize on nsTheMagicHashtable<nsSomeKey, nsCOMPtr<nsISupports> > but that gets really tricky because the getter APIs are different. I don't think a unified type is worth the amount of template magic you'd need.
Component: MFBT → XPCOM
You might be right about weak vs strong hash tables; I haven't had a chance to investigate this in depth. Even if we are left with two versions, though, two is better than five.
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.