Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index e1c020310bcd08e2cb75cd54aab7da52ab499be2..a98f45f13b05cc571f487e6fae1132eb09402d3d 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -145,6 +145,31 @@ class Object; |
} |
+/** |
+ * General purpose unique identifier. |
+ */ |
+class UniqueId { |
+ public: |
+ explicit UniqueId(intptr_t data) |
+ : data_(data) {} |
+ |
+ bool operator==(const UniqueId& other) const { |
+ return data_ == other.data_; |
+ } |
+ |
+ bool operator!=(const UniqueId& other) const { |
+ return data_ != other.data_; |
+ } |
+ |
+ bool operator<(const UniqueId& other) const { |
+ return data_ < other.data_; |
+ } |
+ |
+ private: |
+ intptr_t data_; |
+}; |
+ |
+ |
// --- Weak Handles --- |
@@ -3110,6 +3135,29 @@ class V8EXPORT Isolate { |
/** Returns the context that is on the top of the stack. */ |
Local<Context> GetCurrentContext(); |
+ /** |
+ * Allows the host application to group objects together. If one |
+ * object in the group is alive, all objects in the group are alive. |
+ * After each garbage collection, object groups are removed. It is |
+ * intended to be used in the before-garbage-collection callback |
+ * function, for instance to simulate DOM tree connections among JS |
+ * wrapper objects. Object groups for all dependent handles need to |
+ * be provided for kGCTypeMarkSweepCompact collections, for all other |
+ * garbage collection types it is sufficient to provide object groups |
+ * for partially dependent handles only. |
+ */ |
+ void SetObjectGroupId(const Persistent<Value>& object, |
+ UniqueId id); |
+ |
+ /** |
+ * Allows the host application to declare implicit references. If the objects |
+ * of the object group are alive, the children are alive too. After each |
+ * garbage collection, all implicit references are removed. It is intended to |
+ * be used in the before-garbage-collection callback function. |
+ */ |
+ void AddImplicitReference(UniqueId id, |
yurys
2013/04/22 14:39:54
Method name is a bit confusing. May be SetReferenc
marja
2013/04/23 12:00:05
Done.
|
+ const Persistent<Value>& object); |
+ |
private: |
Isolate(); |
Isolate(const Isolate&); |
@@ -3514,6 +3562,8 @@ class V8EXPORT V8 { |
* for partially dependent handles only. |
* See v8-profiler.h for RetainedObjectInfo interface description. |
*/ |
+ // TODO(marja): deprecate AddObjectGroup. Use Isolate::SetObjectGroupId and |
+ // HeapProfiler::SetRetainedObjectInfo instead. |
static void AddObjectGroup(Persistent<Value>* objects, |
size_t length, |
RetainedObjectInfo* info = NULL); |
@@ -3529,6 +3579,8 @@ class V8EXPORT V8 { |
* are removed. It is intended to be used in the before-garbage-collection |
* callback function. |
*/ |
+ // TODO(marja): Deprecate AddImplicitReferences. Use |
+ // Isolate::AddImplicitReference instead. |
static void AddImplicitReferences(Persistent<Object> parent, |
Persistent<Value>* children, |
size_t length); |