Combine all XPCOM hash table classes behind one template

NEW
Unassigned

Status

()

Core
XPCOM
6 years ago
6 years ago

People

(Reporter: seth, Unassigned)

Tracking

Trunk
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

6 years ago
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.

Comment 1

6 years ago
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
(Reporter)

Comment 2

6 years ago
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.
You need to log in before you can comment on or make changes to this bug.