OLD | NEW |
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 CompositorElementId_h | 5 #ifndef CompositorElementId_h |
6 #define CompositorElementId_h | 6 #define CompositorElementId_h |
7 | 7 |
8 #include "cc/trees/element_id.h" | 8 #include "cc/trees/element_id.h" |
9 #include "platform/PlatformExport.h" | 9 #include "platform/PlatformExport.h" |
10 #include "platform/wtf/HashFunctions.h" | 10 #include "platform/wtf/HashFunctions.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
44 static unsigned GetHash(const CompositorElementId& key) { | 44 static unsigned GetHash(const CompositorElementId& key) { |
45 return WTF::HashInt(static_cast<cc::ElementIdType>(key.id_)); | 45 return WTF::HashInt(static_cast<cc::ElementIdType>(key.id_)); |
46 } | 46 } |
47 static bool Equal(const CompositorElementId& a, | 47 static bool Equal(const CompositorElementId& a, |
48 const CompositorElementId& b) { | 48 const CompositorElementId& b) { |
49 return a.id_ == b.id_; | 49 return a.id_ == b.id_; |
50 } | 50 } |
51 static const bool safe_to_compare_to_empty_or_deleted = true; | 51 static const bool safe_to_compare_to_empty_or_deleted = true; |
52 }; | 52 }; |
53 | 53 |
54 uint64_t PLATFORM_EXPORT IdFromCompositorElementId(CompositorElementId); | |
55 CompositorElementIdNamespace PLATFORM_EXPORT | 54 CompositorElementIdNamespace PLATFORM_EXPORT |
56 NamespaceFromCompositorElementId(CompositorElementId); | 55 NamespaceFromCompositorElementId(CompositorElementId); |
57 | 56 |
58 struct CompositorElementIdHashTraits | 57 struct CompositorElementIdHashTraits |
59 : WTF::GenericHashTraits<CompositorElementId> { | 58 : WTF::GenericHashTraits<CompositorElementId> { |
60 static CompositorElementId EmptyValue() { return CompositorElementId(1); } | 59 static CompositorElementId EmptyValue() { return CompositorElementId(1); } |
61 static void ConstructDeletedValue(CompositorElementId& slot, bool) { | 60 static void ConstructDeletedValue(CompositorElementId& slot, bool) { |
62 slot = CompositorElementId(); | 61 slot = CompositorElementId(); |
63 } | 62 } |
64 static bool IsDeletedValue(CompositorElementId value) { | 63 static bool IsDeletedValue(CompositorElementId value) { |
65 return value == CompositorElementId(); | 64 return value == CompositorElementId(); |
66 } | 65 } |
67 }; | 66 }; |
68 | 67 |
69 using CompositorElementIdSet = HashSet<CompositorElementId, | 68 using CompositorElementIdSet = HashSet<CompositorElementId, |
70 CompositorElementIdHash, | 69 CompositorElementIdHash, |
71 CompositorElementIdHashTraits>; | 70 CompositorElementIdHashTraits>; |
72 | 71 |
73 } // namespace blink | 72 } // namespace blink |
74 | 73 |
75 #endif // CompositorElementId_h | 74 #endif // CompositorElementId_h |
OLD | NEW |