Chromium Code Reviews| Index: include/v8.h |
| =================================================================== |
| --- include/v8.h (revision 12732) |
| +++ include/v8.h (working copy) |
| @@ -402,6 +402,8 @@ |
| */ |
| inline void MarkIndependent(); |
| + inline bool IsIndependent() const; |
|
Michael Starzinger
2012/10/17 08:47:47
Add short one-liner comment about this function.
|
| + |
| /** |
| *Checks if the handle holds the only reference to an object. |
| */ |
| @@ -417,6 +419,7 @@ |
| * interface description in v8-profiler.h for details. |
| */ |
| inline void SetWrapperClassId(uint16_t class_id); |
| + inline uint16_t WrapperClassId() const; |
|
Michael Starzinger
2012/10/17 08:47:47
Either adapt the above comment to cover both funct
|
| private: |
| friend class ImplementationUtilities; |
| @@ -3021,6 +3024,17 @@ |
| /** |
| + * Interface for iterating though the persistent handles in the heap. |
|
Michael Starzinger
2012/10/17 08:47:47
s/though the/through all/
|
| + */ |
| +class V8EXPORT PersistentHandleVisitor { // NOLINT |
| + public: |
| + virtual ~PersistentHandleVisitor() {} |
| + virtual void VisitPersistentHandle(Persistent<Value> value, |
| + uint16_t class_id) {} |
| +}; |
| + |
| + |
| +/** |
| * Container class for static utility functions. |
| */ |
| class V8EXPORT V8 { |
| @@ -3428,6 +3442,12 @@ |
| static void VisitExternalResources(ExternalResourceVisitor* visitor); |
| /** |
| + * Iterates through all the persistent handles in the current isolate's heap |
| + * that have class_ids. |
| + */ |
| + static void VisitHandlesWithClassIds(PersistentHandleVisitor* visitor); |
| + |
| + /** |
| * Optional notification that the embedder is idle. |
| * V8 uses the notification to reduce memory footprint. |
| * This call can be used repeatedly if the embedder remains idle. |
| @@ -3465,10 +3485,12 @@ |
| WeakReferenceCallback); |
| static void ClearWeak(internal::Object** global_handle); |
| static void MarkIndependent(internal::Object** global_handle); |
| + static bool IsGlobalIndependent(internal::Object** global_handle); |
| static bool IsGlobalNearDeath(internal::Object** global_handle); |
| static bool IsGlobalWeak(internal::Object** global_handle); |
| static void SetWrapperClassId(internal::Object** global_handle, |
| uint16_t class_id); |
| + static uint16_t GetWrapperClassId(internal::Object** global_handle); |
| template <class T> friend class Handle; |
| template <class T> friend class Local; |
| @@ -4186,6 +4208,13 @@ |
| template <class T> |
| +bool Persistent<T>::IsIndependent() const { |
| + if (this->IsEmpty()) return false; |
| + return V8::IsGlobalIndependent(reinterpret_cast<internal::Object**>(**this)); |
| +} |
| + |
| + |
| +template <class T> |
| bool Persistent<T>::IsNearDeath() const { |
| if (this->IsEmpty()) return false; |
| return V8::IsGlobalNearDeath(reinterpret_cast<internal::Object**>(**this)); |
| @@ -4231,6 +4260,11 @@ |
| V8::SetWrapperClassId(reinterpret_cast<internal::Object**>(**this), class_id); |
| } |
| +template <class T> |
| +uint16_t Persistent<T>::WrapperClassId() const { |
| + return V8::GetWrapperClassId(reinterpret_cast<internal::Object**>(**this)); |
| +} |
| + |
| Arguments::Arguments(internal::Object** implicit_args, |
| internal::Object** values, int length, |
| bool is_construct_call) |