Switch HalfLife2 off KTrie (bug 5884 part 7, r=ds).

This commit is contained in:
David Anderson
2013-08-25 11:59:48 -07:00
parent 0b8e2fd5c9
commit 3850765759
7 changed files with 82 additions and 90 deletions
+16
View File
@@ -98,6 +98,7 @@ class HashMap : public AllocPolicy
typedef typename Internal::Result Result;
typedef typename Internal::Insert Insert;
typedef typename Internal::iterator iterator;
template <typename Lookup>
Result find(const Lookup &key) {
@@ -131,6 +132,10 @@ class HashMap : public AllocPolicy
return table_.add(i);
}
iterator iter() {
return iterator(&table_);
}
void clear() {
table_.clear();
}
@@ -143,6 +148,17 @@ class HashMap : public AllocPolicy
Internal table_;
};
template <typename T>
struct PointerPolicy
{
static inline uint32_t hash(T *p) {
return HashPointer(p);
}
static inline bool matches(T *p1, T *p2) {
return p1 == p2;
}
};
}
#endif // _include_amtl_hashmap_h_
+4 -1
View File
@@ -472,7 +472,10 @@ class HashTable : public AllocPolicy
table_->removeEntry(*i_);
}
const Payload &operator *() const {
Payload *operator ->() const {
return &i_->payload();
}
Payload &operator *() const {
return i_->payload();
}
+6
View File
@@ -105,6 +105,7 @@ public:
typedef typename Internal::Result Result;
typedef typename Internal::Insert Insert;
typedef typename Internal::iterator iterator;
bool retrieve(const char *aKey, T *value)
{
@@ -147,6 +148,11 @@ public:
table_.clear();
}
iterator iter()
{
return iterator(&table_);
}
private:
Internal table_;
};