| Index: include/v8.h
|
| diff --git a/include/v8.h b/include/v8.h
|
| index b15b1bd21f04b699854a4bfa0b4d3154b81d4571..4b31e87273a5c7c89e503ab71934f73d84ad6341 100644
|
| --- a/include/v8.h
|
| +++ b/include/v8.h
|
| @@ -388,6 +388,11 @@ template <class T> class Handle {
|
| };
|
|
|
|
|
| +// A value which will never be returned by Local::Eternalize
|
| +// Useful for static initialization
|
| +const int kUninitializedEternalIndex = -1;
|
| +
|
| +
|
| /**
|
| * A light-weight stack-allocated object handle. All operations
|
| * that return objects from within v8 return them in local handles. They
|
| @@ -433,6 +438,11 @@ template <class T> class Local : public Handle<T> {
|
| return Local<S>::Cast(*this);
|
| }
|
|
|
| + // Keep this Local alive for the lifetime of the Isolate.
|
| + // It remains retrievable via the returned index,
|
| + V8_INLINE(int Eternalize(Isolate* isolate));
|
| + V8_INLINE(static Local<T> GetEternal(Isolate* isolate, int index));
|
| +
|
| /**
|
| * Create a local handle for the content of another handle.
|
| * The referee is kept alive by the local handle even when
|
| @@ -4787,6 +4797,9 @@ class V8_EXPORT V8 {
|
| void* data,
|
| RevivableCallback weak_reference_callback);
|
| static void ClearWeak(internal::Object** global_handle);
|
| + static int Eternalize(internal::Isolate* isolate,
|
| + internal::Object** handle);
|
| + static internal::Object** GetEternal(internal::Isolate* isolate, int index);
|
|
|
| template <class T> friend class Handle;
|
| template <class T> friend class Local;
|
| @@ -5650,6 +5663,21 @@ Local<T> Local<T>::New(Isolate* isolate, T* that) {
|
| }
|
|
|
|
|
| +template<class T>
|
| +int Local<T>::Eternalize(Isolate* isolate) {
|
| + return V8::Eternalize(reinterpret_cast<internal::Isolate*>(isolate),
|
| + reinterpret_cast<internal::Object**>(this->val_));
|
| +}
|
| +
|
| +
|
| +template<class T>
|
| +Local<T> Local<T>::GetEternal(Isolate* isolate, int index) {
|
| + internal::Object** handle =
|
| + V8::GetEternal(reinterpret_cast<internal::Isolate*>(isolate), index);
|
| + return Local<T>(T::Cast(reinterpret_cast<Value*>(handle)));
|
| +}
|
| +
|
| +
|
| #ifdef V8_USE_UNSAFE_HANDLES
|
| template <class T>
|
| Persistent<T> Persistent<T>::New(Handle<T> that) {
|
|
|