Currently nsHashKeys.h only includes one generic hash key implementation, nsHashableHashKey. This is designed for use with classes that implement nsIHashable and requires that such classes have a vtable and all of the nsISupports machinery. I have found several times that I need to use lightweight structs as keys, and I'd prefer not to burden them with all of that additional heavyweight functionality. I implemented nsGenericHashKey for this purpose in image/src/SurfaceCache.cpp. It's a template-based hash key class that requires that the underlying type define operator== and a Hash() function returning PLDHashNumber. I'd like to move this into xpcom/glue/nsHashKeys.h since I think it is generally useful. (And indeed I have more uses for it right now!)
Created attachment 8334278 [details] [diff] [review] Add a lightweight generic hash key class to nsHashKeys.h. This patches moves nsGenericHashKey into nsHashKeys.h.
Attachment #8334278 - Flags: review?(benjamin)
Thanks for the review! Pushed: https://hg.mozilla.org/integration/mozilla-inbound/rev/4856e14d1d94
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
You need to log in before you can comment on or make changes to this bug.