OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2012 Apple Inc. All rights reserved. | 2 * Copyright (C) 2012 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
6 * are met: | 6 * are met: |
7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
223 | 223 |
224 struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { | 224 struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { |
225 static const bool emptyValueIsZero = false; | 225 static const bool emptyValueIsZero = false; |
226 static const bool hasIsEmptyValueFunction = true; | 226 static const bool hasIsEmptyValueFunction = true; |
227 static bool isEmptyValue(const CountCopy& value) { return !value.counter();
} | 227 static bool isEmptyValue(const CountCopy& value) { return !value.counter();
} |
228 static void constructDeletedValue(CountCopy& slot, bool) { slot = CountCopy(
CountCopy::kDeletedValue); } | 228 static void constructDeletedValue(CountCopy& slot, bool) { slot = CountCopy(
CountCopy::kDeletedValue); } |
229 static bool isDeletedValue(const CountCopy& value) { return value.counter()
== CountCopy::kDeletedValue; } | 229 static bool isDeletedValue(const CountCopy& value) { return value.counter()
== CountCopy::kDeletedValue; } |
230 }; | 230 }; |
231 | 231 |
232 struct CountCopyHash : public PtrHash<const int*> { | 232 struct CountCopyHash : public PtrHash<const int*> { |
233 static unsigned hash(const CountCopy& value) { return PtrHash<const int*>::h
ash(value.counter()); } | 233 static unsigned hash(const CountCopy& value) { return PtrHash<const int>::ha
sh(value.counter()); } |
234 static bool equal(const CountCopy& left, const CountCopy& right) | 234 static bool equal(const CountCopy& left, const CountCopy& right) |
235 { | 235 { |
236 return PtrHash<const int*>::equal(left.counter(), right.counter()); | 236 return PtrHash<const int>::equal(left.counter(), right.counter()); |
237 } | 237 } |
238 static const bool safeToCompareToEmptyOrDeleted = true; | 238 static const bool safeToCompareToEmptyOrDeleted = true; |
239 }; | 239 }; |
240 | 240 |
241 } // anonymous namespace | 241 } // anonymous namespace |
242 | 242 |
243 template <> | 243 template <> |
244 struct HashTraits<CountCopy> : public CountCopyHashTraits { }; | 244 struct HashTraits<CountCopy> : public CountCopyHashTraits { }; |
245 | 245 |
246 template <> | 246 template <> |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 EXPECT_EQ(13, thirteen.id()); | 385 EXPECT_EQ(13, thirteen.id()); |
386 iter = set.find(MoveOnly(13)); | 386 iter = set.find(MoveOnly(13)); |
387 EXPECT_TRUE(iter == set.end()); | 387 EXPECT_TRUE(iter == set.end()); |
388 | 388 |
389 set.clear(); | 389 set.clear(); |
390 } | 390 } |
391 | 391 |
392 } // anonymous namespace | 392 } // anonymous namespace |
393 | 393 |
394 } // namespace WTF | 394 } // namespace WTF |
OLD | NEW |