Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(532)

Side by Side Diff: third_party/WebKit/Source/wtf/ListHashSetTest.cpp

Issue 1839003002: WTF: De-specialize PtrHash<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Remove extra equal() definitions. Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 }; 638 };
639 639
640 int* const CountCopy::kDeletedValue = reinterpret_cast<int*>(static_cast<uintptr _t>(-1)); 640 int* const CountCopy::kDeletedValue = reinterpret_cast<int*>(static_cast<uintptr _t>(-1));
641 641
642 struct CountCopyHashTraits : public GenericHashTraits<CountCopy> { 642 struct CountCopyHashTraits : public GenericHashTraits<CountCopy> {
643 static bool isEmptyValue(const CountCopy& value) { return !value.counter(); } 643 static bool isEmptyValue(const CountCopy& value) { return !value.counter(); }
644 static void constructDeletedValue(CountCopy& slot, bool) { slot = CountCopy( CountCopy::kDeletedValue); } 644 static void constructDeletedValue(CountCopy& slot, bool) { slot = CountCopy( CountCopy::kDeletedValue); }
645 static bool isDeletedValue(const CountCopy& value) { return value.counter() == CountCopy::kDeletedValue; } 645 static bool isDeletedValue(const CountCopy& value) { return value.counter() == CountCopy::kDeletedValue; }
646 }; 646 };
647 647
648 struct CountCopyHash : public PtrHash<const int*> { 648 struct CountCopyHash : public PtrHash<const int> {
649 static unsigned hash(const CountCopy& value) { return PtrHash<const int*>::h ash(value.counter()); } 649 static unsigned hash(const CountCopy& value) { return PtrHash<const int>::ha sh(value.counter()); }
650 static bool equal(const CountCopy& left, const CountCopy& right) 650 static bool equal(const CountCopy& left, const CountCopy& right)
651 { 651 {
652 return PtrHash<const int*>::equal(left.counter(), right.counter()); 652 return PtrHash<const int>::equal(left.counter(), right.counter());
653 } 653 }
654 }; 654 };
655 655
656 } // anonymous namespace 656 } // anonymous namespace
657 657
658 template <> 658 template <>
659 struct HashTraits<CountCopy> : public CountCopyHashTraits { }; 659 struct HashTraits<CountCopy> : public CountCopyHashTraits { };
660 660
661 template <> 661 template <>
662 struct DefaultHash<CountCopy> { 662 struct DefaultHash<CountCopy> {
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
821 // ... but they don't have any pass-out (like take()) methods. 821 // ... but they don't have any pass-out (like take()) methods.
822 822
823 set.remove(MoveOnly(3)); 823 set.remove(MoveOnly(3));
824 set.clear(); 824 set.clear();
825 } 825 }
826 826
827 827
828 } // anonymous namespace 828 } // anonymous namespace
829 829
830 } // namespace WTF 830 } // namespace WTF
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/wtf/HashSetTest.cpp ('k') | third_party/WebKit/Source/wtf/RetainPtr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698