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

Unified Diff: include/v8.h

Issue 1815153002: Introduce EmbedderHeapTracer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Incorporate Jochen'c comments Created 4 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 | « no previous file | src/api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: include/v8.h
diff --git a/include/v8.h b/include/v8.h
index 6f2bba09bf14d88060da0225f417f3d7b40df098..99cc4a9bdd82de7d9601cb400287289534f47650 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5158,6 +5158,8 @@ enum GCCallbackFlags {
};
typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
+typedef void (*GCPutOnMarkingDequeCallback)(PersistentBase<Object>* handle,
+ Isolate* isolate);
typedef void (*InterruptCallback)(Isolate* isolate, void* data);
@@ -5350,6 +5352,30 @@ class V8_EXPORT PersistentHandleVisitor { // NOLINT
uint16_t class_id) {}
};
+/**
+ * Interface for tracing through the embedder heap. During the v8 garbage
+ * collection, the embedder is notified that some object he has a reference to
+ * is still alive, and is expected to trace through its heap and call callback
+ * function for each dependent js object.
+ *
+ * After the v8 garbage collection is finished, ClearTracingMarks is called so
+ * the embedder can clear its temporary data.
+ */
+class EmbedderHeapTracer {
+ public:
+ virtual ~EmbedderHeapTracer() {}
+ /**
+ * V8 will call this method with every wrapper. Embedder is expected to call
+ * the provided callback (synchronously) with every dependent wrapper so the
+ * v8 will keep it alive.
+ */
+ virtual void TraceWrappableFrom(Isolate* isolate, Persistent<Object>* value,
+ GCPutOnMarkingDequeCallback callback);
jochen (gone - plz use gerrit) 2016/03/24 14:31:36 as discussed offline, I'd propose to not add callb
+ /**
+ * V8 allocation is *not* allowed in the ClearTracingMarks.
+ */
+ virtual void ClearTracingMarks(Isolate* isolate) {}
+};
/**
* Isolate represents an isolated instance of the V8 engine. V8 isolates have
@@ -5812,6 +5838,11 @@ class V8_EXPORT Isolate {
void RemoveGCPrologueCallback(GCCallback callback);
/**
+ * Sets the embedder heap tracer for the isolate.
+ */
+ void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
+
+ /**
* Enables the host application to receive a notification after a
* garbage collection. Allocations are allowed in the callback function,
* but the callback is not re-entrant: if the allocation inside it will
« no previous file with comments | « no previous file | src/api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698