| OLD | NEW | 
|     1 // Copyright 2012 the V8 project authors. All rights reserved. |     1 // Copyright 2012 the V8 project authors. All rights reserved. | 
|     2 // Use of this source code is governed by a BSD-style license that can be |     2 // Use of this source code is governed by a BSD-style license that can be | 
|     3 // found in the LICENSE file. |     3 // found in the LICENSE file. | 
|     4  |     4  | 
|     5 /** \mainpage V8 API Reference Guide |     5 /** \mainpage V8 API Reference Guide | 
|     6  * |     6  * | 
|     7  * V8 is Google's open source JavaScript engine. |     7  * V8 is Google's open source JavaScript engine. | 
|     8  * |     8  * | 
|     9  * This set of documents provides reference material generated from the |     9  * This set of documents provides reference material generated from the | 
|    10  * V8 header file, include/v8.h. |    10  * V8 header file, include/v8.h. | 
| (...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   108 class Value; |   108 class Value; | 
|   109 template <class T> class Handle; |   109 template <class T> class Handle; | 
|   110 template <class T> class Local; |   110 template <class T> class Local; | 
|   111 template <class T> |   111 template <class T> | 
|   112 class MaybeLocal; |   112 class MaybeLocal; | 
|   113 template <class T> class Eternal; |   113 template <class T> class Eternal; | 
|   114 template<class T> class NonCopyablePersistentTraits; |   114 template<class T> class NonCopyablePersistentTraits; | 
|   115 template<class T> class PersistentBase; |   115 template<class T> class PersistentBase; | 
|   116 template<class T, |   116 template<class T, | 
|   117          class M = NonCopyablePersistentTraits<T> > class Persistent; |   117          class M = NonCopyablePersistentTraits<T> > class Persistent; | 
|   118 template <class T> |   118 template<class T> class UniquePersistent; | 
|   119 class Global; |  | 
|   120 template<class K, class V, class T> class PersistentValueMap; |   119 template<class K, class V, class T> class PersistentValueMap; | 
|   121 template <class K, class V, class T> |   120 template <class K, class V, class T> | 
|   122 class PersistentValueMapBase; |   121 class PersistentValueMapBase; | 
|   123 template <class K, class V, class T> |   122 template <class K, class V, class T> | 
|   124 class PhantomPersistentValueMap; |   123 class PhantomPersistentValueMap; | 
|   125 template<class V, class T> class PersistentValueVector; |   124 template<class V, class T> class PersistentValueVector; | 
|   126 template<class T, class P> class WeakCallbackObject; |   125 template<class T, class P> class WeakCallbackObject; | 
|   127 class FunctionTemplate; |   126 class FunctionTemplate; | 
|   128 class ObjectTemplate; |   127 class ObjectTemplate; | 
|   129 class Data; |   128 class Data; | 
| (...skipping 520 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   650    * was previously assigned. |   649    * was previously assigned. | 
|   651    */ |   650    */ | 
|   652   V8_INLINE uint16_t WrapperClassId() const; |   651   V8_INLINE uint16_t WrapperClassId() const; | 
|   653  |   652  | 
|   654  private: |   653  private: | 
|   655   friend class Isolate; |   654   friend class Isolate; | 
|   656   friend class Utils; |   655   friend class Utils; | 
|   657   template<class F> friend class Handle; |   656   template<class F> friend class Handle; | 
|   658   template<class F> friend class Local; |   657   template<class F> friend class Local; | 
|   659   template<class F1, class F2> friend class Persistent; |   658   template<class F1, class F2> friend class Persistent; | 
|   660   template <class F> |   659   template<class F> friend class UniquePersistent; | 
|   661   friend class Global; |  | 
|   662   template<class F> friend class PersistentBase; |   660   template<class F> friend class PersistentBase; | 
|   663   template<class F> friend class ReturnValue; |   661   template<class F> friend class ReturnValue; | 
|   664   template <class F1, class F2, class F3> |   662   template <class F1, class F2, class F3> | 
|   665   friend class PersistentValueMapBase; |   663   friend class PersistentValueMapBase; | 
|   666   template<class F1, class F2> friend class PersistentValueVector; |   664   template<class F1, class F2> friend class PersistentValueVector; | 
|   667   friend class Object; |   665   friend class Object; | 
|   668  |   666  | 
|   669   explicit V8_INLINE PersistentBase(T* val) : val_(val) {} |   667   explicit V8_INLINE PersistentBase(T* val) : val_(val) {} | 
|   670   PersistentBase(PersistentBase& other) = delete;  // NOLINT |   668   PersistentBase(PersistentBase& other) = delete;  // NOLINT | 
|   671   void operator=(PersistentBase&) = delete; |   669   void operator=(PersistentBase&) = delete; | 
| (...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   807   template<class S, class M2> |   805   template<class S, class M2> | 
|   808   V8_INLINE void Copy(const Persistent<S, M2>& that); |   806   V8_INLINE void Copy(const Persistent<S, M2>& that); | 
|   809 }; |   807 }; | 
|   810  |   808  | 
|   811  |   809  | 
|   812 /** |   810 /** | 
|   813  * A PersistentBase which has move semantics. |   811  * A PersistentBase which has move semantics. | 
|   814  * |   812  * | 
|   815  * Note: Persistent class hierarchy is subject to future changes. |   813  * Note: Persistent class hierarchy is subject to future changes. | 
|   816  */ |   814  */ | 
|   817 template <class T> |   815 template<class T> | 
|   818 class Global : public PersistentBase<T> { |   816 class UniquePersistent : public PersistentBase<T> { | 
|   819  public: |   817  public: | 
|   820   /** |   818   /** | 
|   821    * A Global with no storage cell. |   819    * A UniquePersistent with no storage cell. | 
|   822    */ |   820    */ | 
|   823   V8_INLINE Global() : PersistentBase<T>(nullptr) {} |   821   V8_INLINE UniquePersistent() : PersistentBase<T>(nullptr) {} | 
|   824   /** |   822   /** | 
|   825    * Construct a Global from a Handle. |   823    * Construct a UniquePersistent from a Handle. | 
|   826    * When the Handle is non-empty, a new storage cell is created |   824    * When the Handle is non-empty, a new storage cell is created | 
|   827    * pointing to the same object, and no flags are set. |   825    * pointing to the same object, and no flags are set. | 
|   828    */ |   826    */ | 
|   829   template <class S> |   827   template <class S> | 
|   830   V8_INLINE Global(Isolate* isolate, Handle<S> that) |   828   V8_INLINE UniquePersistent(Isolate* isolate, Handle<S> that) | 
|   831       : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) { |   829       : PersistentBase<T>(PersistentBase<T>::New(isolate, *that)) { | 
|   832     TYPE_CHECK(T, S); |   830     TYPE_CHECK(T, S); | 
|   833   } |   831   } | 
|   834   /** |   832   /** | 
|   835    * Construct a Global from a PersistentBase. |   833    * Construct a UniquePersistent from a PersistentBase. | 
|   836    * When the Persistent is non-empty, a new storage cell is created |   834    * When the Persistent is non-empty, a new storage cell is created | 
|   837    * pointing to the same object, and no flags are set. |   835    * pointing to the same object, and no flags are set. | 
|   838    */ |   836    */ | 
|   839   template <class S> |   837   template <class S> | 
|   840   V8_INLINE Global(Isolate* isolate, const PersistentBase<S>& that) |   838   V8_INLINE UniquePersistent(Isolate* isolate, const PersistentBase<S>& that) | 
|   841       : PersistentBase<T>(PersistentBase<T>::New(isolate, that.val_)) { |   839     : PersistentBase<T>(PersistentBase<T>::New(isolate, that.val_)) { | 
|   842     TYPE_CHECK(T, S); |   840     TYPE_CHECK(T, S); | 
|   843   } |   841   } | 
|   844   /** |   842   /** | 
|   845    * Move constructor. |   843    * Move constructor. | 
|   846    */ |   844    */ | 
|   847   V8_INLINE Global(Global&& other) : PersistentBase<T>(other.val_) { |   845   V8_INLINE UniquePersistent(UniquePersistent&& other) | 
 |   846       : PersistentBase<T>(other.val_) { | 
|   848     other.val_ = nullptr; |   847     other.val_ = nullptr; | 
|   849   } |   848   } | 
|   850   V8_INLINE ~Global() { this->Reset(); } |   849   V8_INLINE ~UniquePersistent() { this->Reset(); } | 
|   851   /** |   850   /** | 
|   852    * Move via assignment. |   851    * Move via assignment. | 
|   853    */ |   852    */ | 
|   854   template <class S> |   853   template <class S> | 
|   855   V8_INLINE Global& operator=(Global<S>&& rhs) { |   854   V8_INLINE UniquePersistent& operator=(UniquePersistent<S>&& rhs) { | 
|   856     TYPE_CHECK(T, S); |   855     TYPE_CHECK(T, S); | 
|   857     if (this != &rhs) { |   856     if (this != &rhs) { | 
|   858       this->Reset(); |   857       this->Reset(); | 
|   859       this->val_ = rhs.val_; |   858       this->val_ = rhs.val_; | 
|   860       rhs.val_ = nullptr; |   859       rhs.val_ = nullptr; | 
|   861     } |   860     } | 
|   862     return *this; |   861     return *this; | 
|   863   } |   862   } | 
|   864   /** |   863   /** | 
|   865    * Pass allows returning uniques from functions, etc. |   864    * Pass allows returning uniques from functions, etc. | 
|   866    */ |   865    */ | 
|   867   Global Pass() { return static_cast<Global&&>(*this); } |   866   UniquePersistent Pass() { return static_cast<UniquePersistent&&>(*this); } | 
|   868  |   867  | 
|   869  private: |   868  private: | 
|   870   Global(Global&) = delete; |   869   UniquePersistent(UniquePersistent&) = delete; | 
|   871   void operator=(Global&) = delete; |   870   void operator=(UniquePersistent&) = delete; | 
|   872 }; |   871 }; | 
|   873  |   872  | 
|   874  |   873  | 
|   875 // UniquePersistent is an alias for Global for historical reason. |  | 
|   876 template <class T> |  | 
|   877 using UniquePersistent = Global<T>; |  | 
|   878  |  | 
|   879  |  | 
|   880  /** |   874  /** | 
|   881  * A stack-allocated class that governs a number of local handles. |   875  * A stack-allocated class that governs a number of local handles. | 
|   882  * After a handle scope has been created, all local handles will be |   876  * After a handle scope has been created, all local handles will be | 
|   883  * allocated within that handle scope until either the handle scope is |   877  * allocated within that handle scope until either the handle scope is | 
|   884  * deleted or another handle scope is created.  If there is already a |   878  * deleted or another handle scope is created.  If there is already a | 
|   885  * handle scope and a new one is created, all allocations will take |   879  * handle scope and a new one is created, all allocations will take | 
|   886  * place in the new handle scope until it is deleted.  After that, |   880  * place in the new handle scope until it is deleted.  After that, | 
|   887  * new handles will again be allocated in the original handle scope. |   881  * new handles will again be allocated in the original handle scope. | 
|   888  * |   882  * | 
|   889  * After the handle scope of a local handle has been deleted the |   883  * After the handle scope of a local handle has been deleted the | 
| (...skipping 6831 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  7721  */ |  7715  */ | 
|  7722  |  7716  | 
|  7723  |  7717  | 
|  7724 }  // namespace v8 |  7718 }  // namespace v8 | 
|  7725  |  7719  | 
|  7726  |  7720  | 
|  7727 #undef TYPE_CHECK |  7721 #undef TYPE_CHECK | 
|  7728  |  7722  | 
|  7729  |  7723  | 
|  7730 #endif  // V8_H_ |  7724 #endif  // V8_H_ | 
| OLD | NEW |