Index: include/v8.h |
diff --git a/include/v8.h b/include/v8.h |
index 30ba24367f0a6b82f858bf98935065a009af441c..7481a81950b952e7190ce0234898a1f5f5539589 100644 |
--- a/include/v8.h |
+++ b/include/v8.h |
@@ -370,11 +370,11 @@ template <class T> class Handle { |
#endif |
private: |
- template<class F> |
- friend class Persistent; |
- template<class F> |
- friend class Local; |
+ template<class F> friend class Persistent; |
+ template<class F> friend class Local; |
friend class Arguments; |
+ template<class F> friend class FunctionCallbackInfo; |
+ template<class F> friend class PropertyCallbackInfo; |
friend class String; |
friend class Object; |
friend class AccessorInfo; |
@@ -385,6 +385,7 @@ template <class T> class Handle { |
friend class Context; |
friend class InternalHandleHelper; |
friend class LocalContext; |
+ friend class HandleScope; |
#ifndef V8_USE_UNSAFE_HANDLES |
V8_INLINE(static Handle<T> New(Isolate* isolate, T* that)); |
@@ -458,17 +459,18 @@ template <class T> class Local : public Handle<T> { |
#endif |
private: |
- template<class F> |
- friend class Persistent; |
- template<class F> |
- friend class Handle; |
+ template<class F> friend class Persistent; |
+ template<class F> friend class Handle; |
friend class Arguments; |
+ template<class F> friend class FunctionCallbackInfo; |
+ template<class F> friend class PropertyCallbackInfo; |
friend class String; |
friend class Object; |
friend class AccessorInfo; |
friend class Context; |
friend class InternalHandleHelper; |
friend class LocalContext; |
+ friend class HandleScope; |
V8_INLINE(static Local<T> New(Isolate* isolate, T* that)); |
}; |
@@ -751,6 +753,10 @@ template <class T> class Persistent // NOLINT |
*/ |
V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other)); |
+#ifndef V8_USE_UNSAFE_HANDLES |
+ V8_INLINE(void Reset(Isolate* isolate, const Persistent<T>& other)); |
+#endif |
+ |
/** |
* Returns the underlying raw pointer and clears the handle. The caller is |
* responsible of eventually destroying the underlying object (by creating a |
@@ -800,10 +806,8 @@ template <class T> class Persistent // NOLINT |
#endif |
private: |
- template<class F> |
- friend class Handle; |
- template<class F> |
- friend class Local; |
+ template<class F> friend class Handle; |
+ template<class F> friend class Local; |
friend class ImplementationUtilities; |
friend class ObjectTemplate; |
friend class Context; |
@@ -5629,6 +5633,21 @@ void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) { |
} |
+#ifndef V8_USE_UNSAFE_HANDLES |
+template <class T> |
+void Persistent<T>::Reset(Isolate* isolate, const Persistent<T>& other) { |
+ Dispose(isolate); |
+ if (other.IsEmpty()) { |
+ this->val_ = NULL; |
+ return; |
+ } |
+ internal::Object** p = reinterpret_cast<internal::Object**>(other.val_); |
+ this->val_ = reinterpret_cast<T*>( |
+ V8::GlobalizeReference(reinterpret_cast<internal::Isolate*>(isolate), p)); |
+} |
+#endif |
+ |
+ |
template <class T> |
T* Persistent<T>::ClearAndLeak() { |
T* old; |