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 1354 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1365 }; | 1365 }; |
1366 #define LEAK_SANITIZER_DISABLED_SCOPE LeakSanitizerDisableScope lsanDisabledScop
e | 1366 #define LEAK_SANITIZER_DISABLED_SCOPE LeakSanitizerDisableScope lsanDisabledScop
e |
1367 #else | 1367 #else |
1368 #define LEAK_SANITIZER_DISABLED_SCOPE | 1368 #define LEAK_SANITIZER_DISABLED_SCOPE |
1369 #endif | 1369 #endif |
1370 | 1370 |
1371 } // namespace blink | 1371 } // namespace blink |
1372 | 1372 |
1373 namespace WTF { | 1373 namespace WTF { |
1374 | 1374 |
1375 template<typename T> struct PtrHash<blink::Member<T>> : PtrHash<T*> { | 1375 template <typename T> |
1376 STATIC_ONLY(PtrHash); | 1376 struct MemberHash : PtrHash<T> { |
1377 template<typename U> | 1377 STATIC_ONLY(MemberHash); |
1378 static unsigned hash(const U& key) { return PtrHash<T*>::hash(key); } | 1378 template <typename U> |
1379 static bool equal(T* a, const blink::Member<T>& b) { return a == b; } | 1379 static unsigned hash(const U& key) { return PtrHash<T>::hash(key); } |
1380 static bool equal(const blink::Member<T>& a, T* b) { return a == b; } | 1380 template <typename U, typename V> |
1381 template<typename U, typename V> | |
1382 static bool equal(const U& a, const V& b) { return a == b; } | 1381 static bool equal(const U& a, const V& b) { return a == b; } |
1383 }; | 1382 }; |
1384 | 1383 |
1385 template<typename T> struct PtrHash<blink::WeakMember<T>> : PtrHash<blink::Membe
r<T>> { | 1384 template <typename T> |
1386 STATIC_ONLY(PtrHash); | 1385 struct WeakMemberHash : MemberHash<T> { |
| 1386 STATIC_ONLY(WeakMemberHash); |
1387 }; | 1387 }; |
1388 | 1388 |
1389 template<typename T> struct PtrHash<blink::UntracedMember<T>> : PtrHash<blink::M
ember<T>> { | 1389 template <typename T> |
1390 STATIC_ONLY(PtrHash); | 1390 struct UntracedMemberHash : MemberHash<T> { |
| 1391 STATIC_ONLY(UntracedMemberHash); |
1391 }; | 1392 }; |
1392 | 1393 |
1393 // PtrHash is the default hash for hash tables with members. | 1394 // PtrHash is the default hash for hash tables with members. |
1394 template<typename T> struct DefaultHash<blink::Member<T>> { | 1395 template <typename T> |
| 1396 struct DefaultHash<blink::Member<T>> { |
1395 STATIC_ONLY(DefaultHash); | 1397 STATIC_ONLY(DefaultHash); |
1396 using Hash = PtrHash<blink::Member<T>>; | 1398 using Hash = MemberHash<T>; |
1397 }; | 1399 }; |
1398 | 1400 |
1399 template<typename T> struct DefaultHash<blink::WeakMember<T>> { | 1401 template <typename T> |
| 1402 struct DefaultHash<blink::WeakMember<T>> { |
1400 STATIC_ONLY(DefaultHash); | 1403 STATIC_ONLY(DefaultHash); |
1401 using Hash = PtrHash<blink::WeakMember<T>>; | 1404 using Hash = WeakMemberHash<T>; |
1402 }; | 1405 }; |
1403 | 1406 |
1404 template<typename T> struct DefaultHash<blink::UntracedMember<T>> { | 1407 template <typename T> |
| 1408 struct DefaultHash<blink::UntracedMember<T>> { |
1405 STATIC_ONLY(DefaultHash); | 1409 STATIC_ONLY(DefaultHash); |
1406 using Hash = PtrHash<blink::UntracedMember<T>>; | 1410 using Hash = UntracedMemberHash<T>; |
1407 }; | 1411 }; |
1408 | 1412 |
1409 template<typename T> | 1413 template<typename T> |
1410 struct NeedsTracing<blink::Member<T>> { | 1414 struct NeedsTracing<blink::Member<T>> { |
1411 STATIC_ONLY(NeedsTracing); | 1415 STATIC_ONLY(NeedsTracing); |
1412 static const bool value = true; | 1416 static const bool value = true; |
1413 }; | 1417 }; |
1414 | 1418 |
1415 template<typename T> | 1419 template<typename T> |
1416 struct IsWeak<blink::WeakMember<T>> { | 1420 struct IsWeak<blink::WeakMember<T>> { |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1491 // into it. | 1495 // into it. |
1492 // | 1496 // |
1493 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like | 1497 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty
pe like |
1494 // CrossThreadWeakPersistent<>. | 1498 // CrossThreadWeakPersistent<>. |
1495 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } | 1499 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR
eference<T>::create(value.get())); } |
1496 }; | 1500 }; |
1497 | 1501 |
1498 } // namespace WTF | 1502 } // namespace WTF |
1499 | 1503 |
1500 #endif | 1504 #endif |
OLD | NEW |