Chromium Code Reviews| Index: include/v8.h |
| diff --git a/include/v8.h b/include/v8.h |
| index 51040fe1a70f57d992f08d6107e8f0316de42955..bc9ecfc635ceab3703dda05aedf9276b2f142130 100644 |
| --- a/include/v8.h |
| +++ b/include/v8.h |
| @@ -375,6 +375,10 @@ template <class T> class Handle { |
| template<class F> |
| friend class Local; |
| friend class Arguments; |
| + template<class F> |
|
Sven Panne
2013/05/29 07:54:54
Similar code has been there before, but anyway: Mo
|
| + friend class FunctionCallbackInfo; |
| + template<class F> |
| + friend class PropertyCallbackInfo; |
| friend class String; |
| friend class Object; |
| friend class AccessorInfo; |
| @@ -385,6 +389,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)); |
| @@ -463,12 +468,17 @@ template <class T> class Local : public Handle<T> { |
| 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)); |
| }; |
| @@ -727,6 +737,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 |
| @@ -5658,6 +5672,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; |