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 |