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

Side by Side Diff: third_party/WebKit/Source/platform/heap/Persistent.h

Issue 2067223005: Remove unnecessary MemberHash<> templates. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Member.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef Persistent_h 5 #ifndef Persistent_h
6 #define Persistent_h 6 #define Persistent_h
7 7
8 #include "platform/heap/Member.h" 8 #include "platform/heap/Member.h"
9 #include "platform/heap/PersistentNode.h" 9 #include "platform/heap/PersistentNode.h"
10 #include "wtf/Allocator.h" 10 #include "wtf/Allocator.h"
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons t Persistent<U>& b) { return a.get() == b.get(); } 686 template<typename T, typename U> inline bool operator==(const Member<T>& a, cons t Persistent<U>& b) { return a.get() == b.get(); }
687 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons t Persistent<U>& b) { return a.get() != b.get(); } 687 template<typename T, typename U> inline bool operator!=(const Member<T>& a, cons t Persistent<U>& b) { return a.get() != b.get(); }
688 template<typename T, typename U> inline bool operator==(const Persistent<T>& a, const Member<U>& b) { return a.get() == b.get(); } 688 template<typename T, typename U> inline bool operator==(const Persistent<T>& a, const Member<U>& b) { return a.get() == b.get(); }
689 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a, const Member<U>& b) { return a.get() != b.get(); } 689 template<typename T, typename U> inline bool operator!=(const Persistent<T>& a, const Member<U>& b) { return a.get() != b.get(); }
690 690
691 } // namespace blink 691 } // namespace blink
692 692
693 namespace WTF { 693 namespace WTF {
694 694
695 template <typename T> 695 template <typename T>
696 struct PersistentHash : MemberHash<T> {
697 STATIC_ONLY(PersistentHash);
698 };
699
700 template <typename T>
701 struct CrossThreadPersistentHash : MemberHash<T> {
702 STATIC_ONLY(CrossThreadPersistentHash);
703 };
704
705 template <typename T>
706 struct DefaultHash<blink::Persistent<T>> { 696 struct DefaultHash<blink::Persistent<T>> {
707 STATIC_ONLY(DefaultHash); 697 STATIC_ONLY(DefaultHash);
708 using Hash = PersistentHash<T>; 698 using Hash = MemberHash<T>;
699 };
700
701 template <typename T>
702 struct DefaultHash<blink::WeakPersistent<T>> {
703 STATIC_ONLY(DefaultHash);
704 using Hash = MemberHash<T>;
709 }; 705 };
710 706
711 template <typename T> 707 template <typename T>
712 struct DefaultHash<blink::CrossThreadPersistent<T>> { 708 struct DefaultHash<blink::CrossThreadPersistent<T>> {
713 STATIC_ONLY(DefaultHash); 709 STATIC_ONLY(DefaultHash);
714 using Hash = CrossThreadPersistentHash<T>; 710 using Hash = MemberHash<T>;
711 };
712
713 template <typename T>
714 struct DefaultHash<blink::CrossThreadWeakPersistent<T>> {
715 STATIC_ONLY(DefaultHash);
716 using Hash = MemberHash<T>;
715 }; 717 };
716 718
717 template<typename T> 719 template<typename T>
718 struct ParamStorageTraits<blink::WeakPersistentThisPointer<T>> { 720 struct ParamStorageTraits<blink::WeakPersistentThisPointer<T>> {
719 STATIC_ONLY(ParamStorageTraits); 721 STATIC_ONLY(ParamStorageTraits);
720 static_assert(sizeof(T), "T must be fully defined"); 722 static_assert(sizeof(T), "T must be fully defined");
721 using StorageType = blink::WeakPersistent<T>; 723 using StorageType = blink::WeakPersistent<T>;
722 724
723 static StorageType wrap(const blink::WeakPersistentThisPointer<T>& value) { return value.value(); } 725 static StorageType wrap(const blink::WeakPersistentThisPointer<T>& value) { return value.value(); }
724 726
(...skipping 17 matching lines...) Expand all
742 // into it. 744 // into it.
743 // 745 //
744 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like 746 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like
745 // CrossThreadWeakPersistent<>. 747 // CrossThreadWeakPersistent<>.
746 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); } 748 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); }
747 }; 749 };
748 750
749 } // namespace WTF 751 } // namespace WTF
750 752
751 #endif // Persistent_h 753 #endif // Persistent_h
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/platform/heap/Member.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698