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

Unified Diff: third_party/WebKit/Source/platform/heap/WrapperVisitor.h

Issue 2748103002: [wrapper-tracing] Redesign dispatching on non-inheriting cases (Closed)
Patch Set: Addressed comment Created 3 years, 9 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 | « third_party/WebKit/Source/platform/heap/TraceTraits.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/platform/heap/WrapperVisitor.h
diff --git a/third_party/WebKit/Source/platform/heap/WrapperVisitor.h b/third_party/WebKit/Source/platform/heap/WrapperVisitor.h
index d5002a677fac428c0b937b82f50277d796b96ba1..5d375983f3149a8ec9a4fe70be002e12d06738b4 100644
--- a/third_party/WebKit/Source/platform/heap/WrapperVisitor.h
+++ b/third_party/WebKit/Source/platform/heap/WrapperVisitor.h
@@ -41,22 +41,6 @@ class TraceWrapperMember;
void traceWrappers(const WrapperVisitor* visitor) const
/**
- * Declares markAndDispatchTraceWrappers and non-virtual traceWrappers methods.
- * Use this on non-TraceWrapperBase classes that participate in wrapper tracing
- * (e.g. NodeRareData):
- *
- * class NodeRareData {
- * public:
- * DECLARE_TRACE_WRAPPERS_WITHOUT_BASE();
- * };
- */
-#define DECLARE_TRACE_WRAPPERS_WITHOUT_BASE() \
- void markAndDispatchTraceWrappers(const WrapperVisitor* visitor) const { \
- traceWrappers(visitor); \
- } \
- DECLARE_TRACE_WRAPPERS()
-
-/**
* Declares virtual traceWrappers method. It is used in ScriptWrappable, can be
* used to override the method in the subclasses, and can be used by
* non-ScriptWrappable classes which expect to be inherited.
@@ -86,6 +70,15 @@ class TraceWrapperMember;
#define DEFINE_INLINE_TRACE_WRAPPERS() DECLARE_TRACE_WRAPPERS()
#define DEFINE_INLINE_VIRTUAL_TRACE_WRAPPERS() DECLARE_VIRTUAL_TRACE_WRAPPERS()
+#define DEFINE_TRAIT_FOR_TRACE_WRAPPERS(ClassName) \
+ template <> \
+ inline void TraceTrait<ClassName>::traceMarkedWrapper( \
+ const WrapperVisitor* visitor, const void* t) { \
+ const ClassName* traceable = ToWrapperTracingType(t); \
+ DCHECK(heapObjectHeader(t)->isWrapperHeaderMarked()); \
+ traceable->traceWrappers(visitor); \
+ }
+
// ###########################################################################
// TODO(hlopko): Get rid of virtual calls using CRTP
class PLATFORM_EXPORT WrapperVisitor {
@@ -100,9 +93,6 @@ class PLATFORM_EXPORT WrapperVisitor {
template <typename T>
void traceWrappers(const T* traceable) const {
static_assert(sizeof(T), "T must be fully defined");
- static_assert(CanTraceWrappers<T>::value,
- "T should be able to trace wrappers. See "
- "dispatchTraceWrappers in WrapperVisitor.h");
if (!traceable) {
return;
@@ -156,6 +146,10 @@ class PLATFORM_EXPORT WrapperVisitor {
virtual bool markWrapperHeader(HeapObjectHeader*) const = 0;
virtual void markWrappersInAllWorlds(const ScriptWrappable*) const = 0;
+ void markWrappersInAllWorlds(const TraceWrapperBase*) const {
+ // TraceWrapperBase cannot point to V8 and thus doesn't need to
+ // mark wrappers.
+ }
template <typename T>
ALWAYS_INLINE void markAndPushToMarkingDeque(const T* traceable) const {
« no previous file with comments | « third_party/WebKit/Source/platform/heap/TraceTraits.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698