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

Unified Diff: include/v8.h

Issue 1815153002: Introduce EmbedderHeapTracer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix formatting 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..039c6a77cf2b684b56a076cd597be91738cbf861 100644
--- a/include/v8.h
+++ b/include/v8.h
@@ -5158,6 +5158,8 @@ enum GCCallbackFlags {
};
typedef void (*GCCallback)(GCType type, GCCallbackFlags flags);
+typedef void (*GCAliveHandleCallback)(Persistent<Object>* handle,
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 why not add a new method on PersistentBase?
Marcel Hlopko 2016/03/21 14:29:58 Done.
+ Isolate* isolate);
typedef void (*InterruptCallback)(Isolate* isolate, void* data);
@@ -5350,6 +5352,25 @@ 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 V8_EXPORT EmbedderHeapTracer { // NOLINT
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 what is // NOLINT needed for? since the class doe
Marcel Hlopko 2016/03/21 14:29:58 Done.
+ public:
+ virtual ~EmbedderHeapTracer() {}
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 should this be protected?
+ virtual void TraceWrappablesFrom(Isolate* isolate, Persistent<Object>* value,
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 Do you expect this method to return immediately? D
Marcel Hlopko 2016/03/21 14:29:58 I added the comment, made the method pure virtual.
+ GCAliveHandleCallback callback) {}
+ /**
+ * 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 +5833,17 @@ class V8_EXPORT Isolate {
void RemoveGCPrologueCallback(GCCallback callback);
/**
+ * Sets the embedder heap tracer for the isolate.
+ */
+ void SetEmbedderHeapTracer(EmbedderHeapTracer* tracer);
+
+ /**
+ * This function removes the tracer installed by `SetEmbedderHeapTracer`
jochen (gone - plz use gerrit) 2016/03/21 13:31:15 please no backticks you could require the Embedde
Marcel Hlopko 2016/03/21 14:29:58 I will gladly remove the method, I don't think it
+ * function.
+ */
+ void UnsetEmbedderHeapTracer();
+
+ /**
* 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