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

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

Issue 1839003002: WTF: De-specialize PtrHash<T>. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
OLDNEW
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
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 unsigned hash(const U& key) { return PtrHash<T>::hash(key); }
1379 static bool equal(T* a, const blink::Member<T>& b) { return a == b; } 1380 static bool equal(T* a, const blink::Member<T>& b) { return a == b; }
1380 static bool equal(const blink::Member<T>& a, T* b) { return a == b; } 1381 static bool equal(const blink::Member<T>& a, T* b) { return a == b; }
1381 template<typename U, typename V> 1382 template <typename U, typename V>
1382 static bool equal(const U& a, const V& b) { return a == b; } 1383 static bool equal(const U& a, const V& b) { return a == b; }
1383 }; 1384 };
1384 1385
1385 template<typename T> struct PtrHash<blink::WeakMember<T>> : PtrHash<blink::Membe r<T>> { 1386 template <typename T>
1386 STATIC_ONLY(PtrHash); 1387 struct WeakMemberHash : MemberHash<T> {
1388 STATIC_ONLY(WeakMemberHash);
1387 }; 1389 };
1388 1390
1389 template<typename T> struct PtrHash<blink::UntracedMember<T>> : PtrHash<blink::M ember<T>> { 1391 template <typename T>
1390 STATIC_ONLY(PtrHash); 1392 struct UntracedMemberHash : MemberHash<T> {
1393 STATIC_ONLY(UntracedMemberHash);
1391 }; 1394 };
1392 1395
1393 // PtrHash is the default hash for hash tables with members. 1396 // PtrHash is the default hash for hash tables with members.
1394 template<typename T> struct DefaultHash<blink::Member<T>> { 1397 template <typename T>
1398 struct DefaultHash<blink::Member<T>> {
1395 STATIC_ONLY(DefaultHash); 1399 STATIC_ONLY(DefaultHash);
1396 using Hash = PtrHash<blink::Member<T>>; 1400 using Hash = MemberHash<T>;
1397 }; 1401 };
1398 1402
1399 template<typename T> struct DefaultHash<blink::WeakMember<T>> { 1403 template <typename T>
1404 struct DefaultHash<blink::WeakMember<T>> {
1400 STATIC_ONLY(DefaultHash); 1405 STATIC_ONLY(DefaultHash);
1401 using Hash = PtrHash<blink::WeakMember<T>>; 1406 using Hash = WeakMemberHash<T>;
1402 }; 1407 };
1403 1408
1404 template<typename T> struct DefaultHash<blink::UntracedMember<T>> { 1409 template <typename T>
1410 struct DefaultHash<blink::UntracedMember<T>> {
1405 STATIC_ONLY(DefaultHash); 1411 STATIC_ONLY(DefaultHash);
1406 using Hash = PtrHash<blink::UntracedMember<T>>; 1412 using Hash = UntracedMemberHash<T>;
1407 }; 1413 };
1408 1414
1409 template<typename T> 1415 template<typename T>
1410 struct NeedsTracing<blink::Member<T>> { 1416 struct NeedsTracing<blink::Member<T>> {
1411 STATIC_ONLY(NeedsTracing); 1417 STATIC_ONLY(NeedsTracing);
1412 static const bool value = true; 1418 static const bool value = true;
1413 }; 1419 };
1414 1420
1415 template<typename T> 1421 template<typename T>
1416 struct IsWeak<blink::WeakMember<T>> { 1422 struct IsWeak<blink::WeakMember<T>> {
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1491 // into it. 1497 // into it.
1492 // 1498 //
1493 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like 1499 // TODO(sof): remove this hack once wtf/Functional.h can also work with a ty pe like
1494 // CrossThreadWeakPersistent<>. 1500 // CrossThreadWeakPersistent<>.
1495 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); } 1501 static WeakPtr<T> unwrap(const StorageType& value) { return WeakPtr<T>(WeakR eference<T>::create(value.get())); }
1496 }; 1502 };
1497 1503
1498 } // namespace WTF 1504 } // namespace WTF
1499 1505
1500 #endif 1506 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698