OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2014 Google Inc. All rights reserved. | 2 * Copyright (C) 2014 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
403 CrossThreadPersistent() : Parent() { } | 403 CrossThreadPersistent() : Parent() { } |
404 CrossThreadPersistent(std::nullptr_t) : Parent(nullptr) { } | 404 CrossThreadPersistent(std::nullptr_t) : Parent(nullptr) { } |
405 CrossThreadPersistent(T* raw) : Parent(raw) { } | 405 CrossThreadPersistent(T* raw) : Parent(raw) { } |
406 CrossThreadPersistent(T& raw) : Parent(raw) { } | 406 CrossThreadPersistent(T& raw) : Parent(raw) { } |
407 CrossThreadPersistent(const CrossThreadPersistent& other) : Parent(other) {
} | 407 CrossThreadPersistent(const CrossThreadPersistent& other) : Parent(other) {
} |
408 template<typename U> | 408 template<typename U> |
409 CrossThreadPersistent(const CrossThreadPersistent<U>& other) : Parent(other)
{ } | 409 CrossThreadPersistent(const CrossThreadPersistent<U>& other) : Parent(other)
{ } |
410 template<typename U> | 410 template<typename U> |
411 CrossThreadPersistent(const Member<U>& other) : Parent(other) { } | 411 CrossThreadPersistent(const Member<U>& other) : Parent(other) { } |
412 | 412 |
| 413 CrossThreadPersistent(WTF::HashTableDeletedValueType) : Parent(reinterpret_c
ast<T*>(-1)) |
| 414 { |
| 415 } |
| 416 |
| 417 bool isHashTableDeletedValue() const { return *this == reinterpret_cast<T*>(
-1); } |
| 418 |
413 T* atomicGet() { return Parent::atomicGet(); } | 419 T* atomicGet() { return Parent::atomicGet(); } |
414 | 420 |
415 template<typename U> | 421 template<typename U> |
416 CrossThreadPersistent& operator=(U* other) | 422 CrossThreadPersistent& operator=(U* other) |
417 { | 423 { |
418 Parent::operator=(other); | 424 Parent::operator=(other); |
419 return *this; | 425 return *this; |
420 } | 426 } |
421 | 427 |
422 CrossThreadPersistent& operator=(std::nullptr_t) | 428 CrossThreadPersistent& operator=(std::nullptr_t) |
(...skipping 686 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1109 template <typename T> | 1115 template <typename T> |
1110 struct WeakMemberHash : MemberHash<T> { | 1116 struct WeakMemberHash : MemberHash<T> { |
1111 STATIC_ONLY(WeakMemberHash); | 1117 STATIC_ONLY(WeakMemberHash); |
1112 }; | 1118 }; |
1113 | 1119 |
1114 template <typename T> | 1120 template <typename T> |
1115 struct UntracedMemberHash : MemberHash<T> { | 1121 struct UntracedMemberHash : MemberHash<T> { |
1116 STATIC_ONLY(UntracedMemberHash); | 1122 STATIC_ONLY(UntracedMemberHash); |
1117 }; | 1123 }; |
1118 | 1124 |
| 1125 template <typename T> |
| 1126 struct CrossThreadPersistentHash : MemberHash<T> { |
| 1127 STATIC_ONLY(CrossThreadPersistentHash); |
| 1128 }; |
| 1129 |
1119 // PtrHash is the default hash for hash tables with members. | 1130 // PtrHash is the default hash for hash tables with members. |
1120 template <typename T> | 1131 template <typename T> |
1121 struct DefaultHash<blink::Member<T>> { | 1132 struct DefaultHash<blink::Member<T>> { |
1122 STATIC_ONLY(DefaultHash); | 1133 STATIC_ONLY(DefaultHash); |
1123 using Hash = MemberHash<T>; | 1134 using Hash = MemberHash<T>; |
1124 }; | 1135 }; |
1125 | 1136 |
1126 template <typename T> | 1137 template <typename T> |
1127 struct DefaultHash<blink::WeakMember<T>> { | 1138 struct DefaultHash<blink::WeakMember<T>> { |
1128 STATIC_ONLY(DefaultHash); | 1139 STATIC_ONLY(DefaultHash); |
1129 using Hash = WeakMemberHash<T>; | 1140 using Hash = WeakMemberHash<T>; |
1130 }; | 1141 }; |
1131 | 1142 |
1132 template <typename T> | 1143 template <typename T> |
1133 struct DefaultHash<blink::UntracedMember<T>> { | 1144 struct DefaultHash<blink::UntracedMember<T>> { |
1134 STATIC_ONLY(DefaultHash); | 1145 STATIC_ONLY(DefaultHash); |
1135 using Hash = UntracedMemberHash<T>; | 1146 using Hash = UntracedMemberHash<T>; |
1136 }; | 1147 }; |
1137 | 1148 |
| 1149 template <typename T> |
| 1150 struct DefaultHash<blink::CrossThreadPersistent<T>> { |
| 1151 STATIC_ONLY(DefaultHash); |
| 1152 using Hash = CrossThreadPersistentHash<T>; |
| 1153 }; |
| 1154 |
1138 template<typename T> | 1155 template<typename T> |
1139 struct NeedsTracing<blink::Member<T>> { | 1156 struct NeedsTracing<blink::Member<T>> { |
1140 STATIC_ONLY(NeedsTracing); | 1157 STATIC_ONLY(NeedsTracing); |
1141 static const bool value = true; | 1158 static const bool value = true; |
1142 }; | 1159 }; |
1143 | 1160 |
1144 template<typename T> | 1161 template<typename T> |
1145 struct IsWeak<blink::WeakMember<T>> { | 1162 struct IsWeak<blink::WeakMember<T>> { |
1146 STATIC_ONLY(IsWeak); | 1163 STATIC_ONLY(IsWeak); |
1147 static const bool value = true; | 1164 static const bool value = true; |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1213 // into it. | 1230 // into it. |
1214 // | 1231 // |
1215 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 1232 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
1216 // CrossThreadWeakPersistent<>. | 1233 // CrossThreadWeakPersistent<>. |
1217 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 1234 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
1218 }; | 1235 }; |
1219 | 1236 |
1220 } // namespace WTF | 1237 } // namespace WTF |
1221 | 1238 |
1222 #endif | 1239 #endif |
OLD | NEW |