| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index b113d74792108c62ff13627b8117598c17b1b297..ec9a9846c11e9b2b78dcff938fbfa64497df3955 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -676,6 +676,11 @@ template <class T> class Persistent // NOLINT
|
| // TODO(dcarney): remove before cutover
|
| V8_INLINE(uint16_t WrapperClassId(Isolate* isolate) const);
|
|
|
| + /**
|
| + * Disposes the current contents of the handle and replaces it.
|
| + */
|
| + V8_INLINE(void Reset(Isolate* isolate, const Handle<T>& other));
|
| +
|
| #ifndef V8_USE_UNSAFE_HANDLES
|
|
|
| #ifndef V8_ALLOW_ACCESS_TO_PERSISTENT_IMPLICIT
|
| @@ -5349,6 +5354,22 @@ void Persistent<T>::SetWrapperClassId(uint16_t class_id) {
|
| }
|
|
|
| template <class T>
|
| +void Persistent<T>::Reset(Isolate* isolate, const Handle<T>& other) {
|
| + Dispose(isolate);
|
| +#ifdef V8_USE_UNSAFE_HANDLES
|
| + *this = *New(isolate, other);
|
| +#else
|
| + 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>
|
| void Persistent<T>::SetWrapperClassId(Isolate* isolate, uint16_t class_id) {
|
| typedef internal::Internals I;
|
| if (this->IsEmpty()) return;
|
|
|