Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index e1c020310bcd08e2cb75cd54aab7da52ab499be2..3d3c93d7e337f8867da5bb6c9c104ce8cdc0503c 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -144,6 +144,28 @@ class Isolate; |
class Object; |
} |
+// Generic-purpose unique identifier. |
Michael Starzinger
2013/04/22 11:34:51
nit: Can we turn that into a Doxygen comment (i.e.
marja
2013/04/22 13:49:07
Done.
|
+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 --- |
@@ -3514,6 +3536,8 @@ class V8EXPORT V8 { |
* for partially dependent handles only. |
* See v8-profiler.h for RetainedObjectInfo interface description. |
*/ |
+ // TODO(marja): deprecate AddObjectGroup. Use SetObjectGroupId and |
+ // SetRetainedObjectInfo instead. |
static void AddObjectGroup(Persistent<Value>* objects, |
size_t length, |
RetainedObjectInfo* info = NULL); |
@@ -3522,6 +3546,14 @@ class V8EXPORT V8 { |
size_t length, |
RetainedObjectInfo* info = NULL); |
+ static void SetObjectGroupId(Isolate* isolate, |
yurys
2013/04/22 12:10:43
Since these methods are new why not make them inst
marja
2013/04/22 13:49:07
Done.
|
+ const Persistent<Value>& object, |
+ UniqueId id); |
+ |
+ static void SetRetainedObjectInfo(Isolate* isolate, |
yurys
2013/04/22 12:05:46
As discussed offline, this method should be on v8:
marja
2013/04/22 13:49:07
Done.
|
+ UniqueId id, |
+ RetainedObjectInfo* info); |
+ |
/** |
* Allows the host application to declare implicit references between |
* the objects: if |parent| is alive, all |children| are alive too. |
@@ -3529,11 +3561,24 @@ class V8EXPORT V8 { |
* are removed. It is intended to be used in the before-garbage-collection |
* callback function. |
*/ |
+ // TODO(marja): Deprecate AddImplicitReferences. Use AddImplicitReference |
+ // instead. |
static void AddImplicitReferences(Persistent<Object> parent, |
Persistent<Value>* children, |
size_t length); |
/** |
+ * Allows the host application to declare implicit references. If the |
+ * representative object of the object group (identified by id) is 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. |
+ */ |
+ static void AddImplicitReference(Isolate* isolate, |
+ UniqueId id, |
+ const Persistent<Value>& object); |
+ |
+ /** |
* Initializes from snapshot if possible. Otherwise, attempts to |
* initialize from scratch. This function is called implicitly if |
* you use the API without calling it first. |