Add a generic hash key class for objects without vtables to nsHashKeys.h

RESOLVED FIXED in mozilla28

Status

()

Core
XPCOM
RESOLVED FIXED
4 years ago
4 years ago

People

(Reporter: seth, Assigned: seth)

Tracking

(Blocks: 1 bug)

Trunk
mozilla28
Points:
---

Firefox Tracking Flags

(Not tracked)

Details

(Whiteboard: [qa-])

Attachments

(1 attachment)

(Assignee)

Description

4 years ago
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!)
(Assignee)

Comment 1

4 years ago
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)
(Assignee)

Updated

4 years ago
Blocks: 790640

Updated

4 years ago
Attachment #8334278 - Flags: review?(benjamin) → review+
https://hg.mozilla.org/mozilla-central/rev/4856e14d1d94
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28

Updated

4 years ago
Whiteboard: [qa-]
You need to log in before you can comment on or make changes to this bug.