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

Unified Diff: Source/wtf/HashTraits.h

Issue 319593004: Oilpan:Allow custom handling of classes that contain weak pointers that are embedded in collections. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Remove 'typename' that Win compiler does not like Created 6 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Source/wtf/HashTable.h ('k') | Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/wtf/HashTraits.h
diff --git a/Source/wtf/HashTraits.h b/Source/wtf/HashTraits.h
index adca0f85335db622fe6dce98a7a7c3239620bb9b..f76c76e44f7a6308b5384e67a2ce8d9bf2bdda48 100644
--- a/Source/wtf/HashTraits.h
+++ b/Source/wtf/HashTraits.h
@@ -63,7 +63,9 @@ namespace WTF {
struct NeedsTracingLazily {
static const bool value = NeedsTracing<T>::value;
};
- static const bool isWeak = IsWeak<T>::value;
+ static const WeakHandlingFlag weakHandlingFlag = IsWeak<T>::value ? WeakHandlingInCollections : NoWeakHandlingInCollections;
+ template<typename Visitor>
+ static bool shouldRemoveFromCollection(Visitor*, T&) { return false; }
};
// Default integer traits disallow both 0 and -1 as keys (max value instead of -1 for unsigned).
@@ -270,12 +272,18 @@ namespace WTF {
struct NeedsTracingLazily {
static const bool value = ShouldBeTraced<KeyTraits>::value || ShouldBeTraced<ValueTraits>::value;
};
- static const bool isWeak = KeyTraits::isWeak || ValueTraits::isWeak;
+ static const WeakHandlingFlag weakHandlingFlag = (KeyTraits::weakHandlingFlag == WeakHandlingInCollections || ValueTraits::weakHandlingFlag == WeakHandlingInCollections) ? WeakHandlingInCollections : NoWeakHandlingInCollections;
static const unsigned minimumTableSize = KeyTraits::minimumTableSize;
static void constructDeletedValue(TraitType& slot) { KeyTraits::constructDeletedValue(slot.key); }
static bool isDeletedValue(const TraitType& value) { return KeyTraits::isDeletedValue(value.key); }
+ template<typename Visitor>
+ static bool shouldRemoveFromCollection(Visitor* visitor, TraitType& pair)
+ {
+ return KeyTraits::shouldRemoveFromCollection(visitor, pair.key)
+ || ValueTraits::shouldRemoveFromCollection(visitor, pair.value);
+ }
};
template<typename Key, typename Value>
« no previous file with comments | « Source/wtf/HashTable.h ('k') | Source/wtf/LinkedHashSet.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698