OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2006, 2007, 2008 Apple Inc. All rights reserved. |
3 * | 3 * |
4 * This library is free software; you can redistribute it and/or | 4 * This library is free software; you can redistribute it and/or |
5 * modify it under the terms of the GNU Library General Public | 5 * modify it under the terms of the GNU Library General Public |
6 * License as published by the Free Software Foundation; either | 6 * License as published by the Free Software Foundation; either |
7 * version 2 of the License, or (at your option) any later version. | 7 * version 2 of the License, or (at your option) any later version. |
8 * | 8 * |
9 * This library is distributed in the hope that it will be useful, | 9 * This library is distributed in the hope that it will be useful, |
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of | 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
(...skipping 18 matching lines...) Expand all Loading... |
29 using std::pair; | 29 using std::pair; |
30 | 30 |
31 namespace WTF { | 31 namespace WTF { |
32 | 32 |
33 class AtomicString; | 33 class AtomicString; |
34 | 34 |
35 template<typename T> | 35 template<typename T> |
36 struct VectorTraitsBase | 36 struct VectorTraitsBase |
37 { | 37 { |
38 static const bool needsDestruction = !IsPod<T>::value; | 38 static const bool needsDestruction = !IsPod<T>::value; |
39 static const bool needsInitialization = !IsPod<T>::value; | |
40 static const bool canInitializeWithMemset = IsPod<T>::value; | 39 static const bool canInitializeWithMemset = IsPod<T>::value; |
41 static const bool canMoveWithMemcpy = IsPod<T>::value; | 40 static const bool canMoveWithMemcpy = IsPod<T>::value; |
42 static const bool canCopyWithMemcpy = IsPod<T>::value; | 41 static const bool canCopyWithMemcpy = IsPod<T>::value; |
43 static const bool canFillWithMemset = IsPod<T>::value && (sizeof(T) == s
izeof(char)); | 42 static const bool canFillWithMemset = IsPod<T>::value && (sizeof(T) == s
izeof(char)); |
44 static const bool canCompareWithMemcmp = IsPod<T>::value; | 43 static const bool canCompareWithMemcmp = IsPod<T>::value; |
45 template<typename U = void> | 44 template<typename U = void> |
46 struct NeedsTracingLazily { | 45 struct NeedsTracingLazily { |
47 static const bool value = NeedsTracing<T>::value; | 46 static const bool value = NeedsTracing<T>::value; |
48 }; | 47 }; |
49 static const bool isWeak = IsWeak<T>::value; | 48 static const bool isWeak = IsWeak<T>::value; |
(...skipping 22 matching lines...) Expand all Loading... |
72 template<typename P> | 71 template<typename P> |
73 struct VectorTraits<OwnPtr<P> > : SimpleClassVectorTraits<OwnPtr<P> > { }; | 72 struct VectorTraits<OwnPtr<P> > : SimpleClassVectorTraits<OwnPtr<P> > { }; |
74 | 73 |
75 template<typename First, typename Second> | 74 template<typename First, typename Second> |
76 struct VectorTraits<pair<First, Second> > | 75 struct VectorTraits<pair<First, Second> > |
77 { | 76 { |
78 typedef VectorTraits<First> FirstTraits; | 77 typedef VectorTraits<First> FirstTraits; |
79 typedef VectorTraits<Second> SecondTraits; | 78 typedef VectorTraits<Second> SecondTraits; |
80 | 79 |
81 static const bool needsDestruction = FirstTraits::needsDestruction || Se
condTraits::needsDestruction; | 80 static const bool needsDestruction = FirstTraits::needsDestruction || Se
condTraits::needsDestruction; |
82 static const bool needsInitialization = FirstTraits::needsInitialization
|| SecondTraits::needsInitialization; | |
83 static const bool canInitializeWithMemset = FirstTraits::canInitializeWi
thMemset && SecondTraits::canInitializeWithMemset; | 81 static const bool canInitializeWithMemset = FirstTraits::canInitializeWi
thMemset && SecondTraits::canInitializeWithMemset; |
84 static const bool canMoveWithMemcpy = FirstTraits::canMoveWithMemcpy &&
SecondTraits::canMoveWithMemcpy; | 82 static const bool canMoveWithMemcpy = FirstTraits::canMoveWithMemcpy &&
SecondTraits::canMoveWithMemcpy; |
85 static const bool canCopyWithMemcpy = FirstTraits::canCopyWithMemcpy &&
SecondTraits::canCopyWithMemcpy; | 83 static const bool canCopyWithMemcpy = FirstTraits::canCopyWithMemcpy &&
SecondTraits::canCopyWithMemcpy; |
86 static const bool canFillWithMemset = false; | 84 static const bool canFillWithMemset = false; |
87 static const bool canCompareWithMemcmp = FirstTraits::canCompareWithMemc
mp && SecondTraits::canCompareWithMemcmp; | 85 static const bool canCompareWithMemcmp = FirstTraits::canCompareWithMemc
mp && SecondTraits::canCompareWithMemcmp; |
88 template <typename U = void> | 86 template <typename U = void> |
89 struct NeedsTracingLazily { | 87 struct NeedsTracingLazily { |
90 static const bool value = ShouldBeTraced<FirstTraits>::value || Shou
ldBeTraced<SecondTraits>::value; | 88 static const bool value = ShouldBeTraced<FirstTraits>::value || Shou
ldBeTraced<SecondTraits>::value; |
91 }; | 89 }; |
92 static const bool isWeak = FirstTraits::isWeak || SecondTraits::isWeak; | 90 static const bool isWeak = FirstTraits::isWeak || SecondTraits::isWeak; |
(...skipping 14 matching lines...) Expand all Loading... |
107 { \ | 105 { \ |
108 static const bool canInitializeWithMemset = true; \ | 106 static const bool canInitializeWithMemset = true; \ |
109 static const bool canMoveWithMemcpy = true; \ | 107 static const bool canMoveWithMemcpy = true; \ |
110 }; \ | 108 }; \ |
111 } | 109 } |
112 | 110 |
113 using WTF::VectorTraits; | 111 using WTF::VectorTraits; |
114 using WTF::SimpleClassVectorTraits; | 112 using WTF::SimpleClassVectorTraits; |
115 | 113 |
116 #endif // WTF_VectorTraits_h | 114 #endif // WTF_VectorTraits_h |
OLD | NEW |