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

Unified Diff: Source/platform/Supplementable.h

Issue 463543002: Oilpan: Ensure that classes with virtual trace methods always have vtables for their left-most base… (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: new requirements Created 6 years, 4 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/platform/LifecycleContext.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/Supplementable.h
diff --git a/Source/platform/Supplementable.h b/Source/platform/Supplementable.h
index 650a204bd57cbbee12b7ebf1ad25f73e6e3b5791..31e776fa79c035b7c0273b23436d0a7eb6f60234 100644
--- a/Source/platform/Supplementable.h
+++ b/Source/platform/Supplementable.h
@@ -119,6 +119,7 @@ template<>
class SupplementTracing<false> {
public:
virtual ~SupplementTracing() { }
+ virtual void trace(Visitor*) { }
};
template<typename T, bool isGarbageCollected = false>
@@ -143,7 +144,6 @@ public:
return host ? host->requireSupplement(key) : 0;
}
- virtual void trace(Visitor*) { }
virtual void willBeDestroyed() { }
// FIXME: Oilpan: Remove this callback once PersistentHeapSupplementable is removed again.
@@ -153,11 +153,22 @@ public:
template<typename T, bool>
class SupplementableTracing;
+// We have a trace method in the specializations of SupplementableTracing to
+// ensure we have the vtable at the first word of the object. However we don't
+// trace the m_supplements here, but in the partially specialized template
+// subclasses since we only want to trace it for garbage collected classes.
+
template<typename T>
-class SupplementableTracing<T, true> { };
+class SupplementableTracing<T, true> {
sof 2014/08/13 12:29:09 What value does this templated class add now?
zerny-chromium 2014/08/13 13:07:01 None really. I'll remove it. The reason it is/was
+public:
+ virtual void trace(Visitor*) { }
+};
template<typename T>
-class SupplementableTracing<T, false> { };
+class SupplementableTracing<T, false> {
+public:
+ virtual void trace(Visitor*) { }
+};
// Helper class for implementing Supplementable, HeapSupplementable, and
// PersistentHeapSupplementable.
@@ -190,12 +201,6 @@ public:
#endif
}
- // We have a trace method in the SupplementableBase class to ensure we have
- // the vtable at the first word of the object. However we don't trace the
- // m_supplements here, but in the partially specialized template subclasses
- // since we only want to trace it for garbage collected classes.
- virtual void trace(Visitor*) { }
-
void willBeDestroyed()
{
typedef typename SupplementableTraits<T, isGarbageCollected>::SupplementMap::iterator SupplementIterator;
« no previous file with comments | « Source/platform/LifecycleContext.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698