Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index e1c020310bcd08e2cb75cd54aab7da52ab499be2..39f32fbcea6fa8673a88865fd27dba357d2287d1 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,30 @@ 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 from an object |
| + * group to an object. If the objects of the object group are alive, the child |
| + * object is 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 SetReferenceFromGroup(UniqueId id, |
|
yurys
2013/04/23 15:25:15
I've just realized that this change will affect he
marja
2013/04/23 16:08:52
For implicit references which are not about event
|
| + const Persistent<Value>& object); |
| + |
| private: |
| Isolate(); |
| Isolate(const Isolate&); |
| @@ -3514,6 +3563,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 +3580,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::SetReferenceFromGroup instead. |
| static void AddImplicitReferences(Persistent<Object> parent, |
| Persistent<Value>* children, |
| size_t length); |