summaryrefslogtreecommitdiff
path: root/chromium/v8/include/cppgc/trace-trait.h
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-12 14:27:29 +0200
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2020-10-13 09:35:20 +0000
commitc30a6232df03e1efbd9f3b226777b07e087a1122 (patch)
treee992f45784689f373bcc38d1b79a239ebe17ee23 /chromium/v8/include/cppgc/trace-trait.h
parent7b5b123ac58f58ffde0f4f6e488bcd09aa4decd3 (diff)
downloadqtwebengine-chromium-85-based.tar.gz
BASELINE: Update Chromium to 85.0.4183.14085-based
Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/v8/include/cppgc/trace-trait.h')
-rw-r--r--chromium/v8/include/cppgc/trace-trait.h44
1 files changed, 39 insertions, 5 deletions
diff --git a/chromium/v8/include/cppgc/trace-trait.h b/chromium/v8/include/cppgc/trace-trait.h
index e246bc53b7d..59e0b14c451 100644
--- a/chromium/v8/include/cppgc/trace-trait.h
+++ b/chromium/v8/include/cppgc/trace-trait.h
@@ -14,6 +14,8 @@ class Visitor;
namespace internal {
+// Implementation of the default TraceTrait handling GarbageCollected and
+// GarbageCollectedMixin.
template <typename T,
bool =
IsGarbageCollectedMixinTypeV<typename std::remove_const<T>::type>>
@@ -21,25 +23,57 @@ struct TraceTraitImpl;
} // namespace internal
-using TraceCallback = void (*)(Visitor*, const void*);
-
-// TraceDescriptor is used to describe how to trace an object.
+/**
+ * Callback for invoking tracing on a given object.
+ *
+ * \param visitor The visitor to dispatch to.
+ * \param object The object to invoke tracing on.
+ */
+using TraceCallback = void (*)(Visitor* visitor, const void* object);
+
+/**
+ * Describes how to trace an object, i.e., how to visit all Oilpan-relevant
+ * fields of an object.
+ */
struct TraceDescriptor {
- // The adjusted base pointer of the object that should be traced.
+ /**
+ * Adjusted base pointer, i.e., the pointer to the class inheriting directly
+ * from GarbageCollected, of the object that is being traced.
+ */
const void* base_object_payload;
- // A callback for tracing the object.
+ /**
+ * Callback for tracing the object.
+ */
TraceCallback callback;
};
+/**
+ * Trait specifying how the garbage collector processes an object of type T.
+ *
+ * Advanced users may override handling by creating a specialization for their
+ * type.
+ */
template <typename T>
struct TraceTrait {
static_assert(internal::IsTraceableV<T>, "T must have a Trace() method");
+ /**
+ * Accessor for retrieving a TraceDescriptor to process an object of type T.
+ *
+ * \param self The object to be processed.
+ * \returns a TraceDescriptor to process the object.
+ */
static TraceDescriptor GetTraceDescriptor(const void* self) {
return internal::TraceTraitImpl<T>::GetTraceDescriptor(
static_cast<const T*>(self));
}
+ /**
+ * Function invoking the tracing for an object of type T.
+ *
+ * \param visitor The visitor to dispatch to.
+ * \param self The object to invoke tracing on.
+ */
static void Trace(Visitor* visitor, const void* self) {
static_cast<const T*>(self)->Trace(visitor);
}