From 269be869988bda9a7e8ad0ef56af178a741af09c Mon Sep 17 00:00:00 2001 From: Cheng Zhao Date: Fri, 22 May 2015 19:11:02 +0800 Subject: [PATCH] Use Local instead of Handle --- native_mate/arguments.cc | 10 +-- native_mate/arguments.h | 14 +-- native_mate/callback.h | 70 +++++++-------- native_mate/callback.h.pump | 16 ++-- native_mate/compat.h | 2 +- native_mate/constructor.h | 2 +- native_mate/constructor.h.pump | 2 +- native_mate/converter.cc | 94 ++++++++++---------- native_mate/converter.h | 116 ++++++++++++------------- native_mate/dictionary.cc | 10 +-- native_mate/dictionary.h | 12 +-- native_mate/function_template.cc | 2 +- native_mate/function_template.h | 20 ++--- native_mate/function_template.h.pump | 6 +- native_mate/handle.h | 10 +-- native_mate/object_template_builder.cc | 6 +- native_mate/object_template_builder.h | 18 ++-- native_mate/persistent_dictionary.cc | 8 +- native_mate/persistent_dictionary.h | 6 +- native_mate/scoped_persistent.h | 20 ++--- native_mate/try_catch.cc | 6 +- native_mate/wrappable.cc | 14 +-- native_mate/wrappable.h | 12 +-- 23 files changed, 238 insertions(+), 238 deletions(-) diff --git a/native_mate/arguments.cc b/native_mate/arguments.cc index fcb34db..57aa552 100644 --- a/native_mate/arguments.cc +++ b/native_mate/arguments.cc @@ -26,13 +26,13 @@ Arguments::Arguments(const MATE_METHOD_ARGS_TYPE& info) Arguments::~Arguments() { } -v8::Handle Arguments::PeekNext() const { +v8::Local Arguments::PeekNext() const { if (next_ >= info_->Length()) - return v8::Handle(); + return v8::Local(); return (*info_)[next_]; } -v8::Handle Arguments::ThrowError() const { +v8::Local Arguments::ThrowError() const { if (insufficient_arguments_) return ThrowTypeError("Insufficient number of arguments."); @@ -40,13 +40,13 @@ v8::Handle Arguments::ThrowError() const { "Error processing argument %d.", next_ - 1)); } -v8::Handle Arguments::ThrowError(const std::string& message) const { +v8::Local Arguments::ThrowError(const std::string& message) const { MATE_THROW_EXCEPTION(isolate_, v8::Exception::Error( StringToV8(isolate_, message))); return MATE_UNDEFINED(isolate_); } -v8::Handle Arguments::ThrowTypeError( +v8::Local Arguments::ThrowTypeError( const std::string& message) const { MATE_THROW_EXCEPTION(isolate_, v8::Exception::TypeError( StringToV8(isolate_, message))); diff --git a/native_mate/arguments.h b/native_mate/arguments.h index 29877a7..493af7c 100644 --- a/native_mate/arguments.h +++ b/native_mate/arguments.h @@ -36,7 +36,7 @@ class Arguments { insufficient_arguments_ = true; return false; } - v8::Handle val = (*info_)[next_++]; + v8::Local val = (*info_)[next_++]; return ConvertFromV8(isolate_, val, out); } @@ -49,14 +49,14 @@ class Arguments { int remaining = info_->Length() - next_; out->resize(remaining); for (int i = 0; i < remaining; ++i) { - v8::Handle val = (*info_)[next_++]; + v8::Local val = (*info_)[next_++]; if (!ConvertFromV8(isolate_, val, &out->at(i))) return false; } return true; } - v8::Handle GetThis() { + v8::Local GetThis() { return info_->This(); } @@ -75,11 +75,11 @@ class Arguments { } #endif - v8::Handle PeekNext() const; + v8::Local PeekNext() const; - v8::Handle ThrowError() const; - v8::Handle ThrowError(const std::string& message) const; - v8::Handle ThrowTypeError(const std::string& message) const; + v8::Local ThrowError() const; + v8::Local ThrowError(const std::string& message) const; + v8::Local ThrowTypeError(const std::string& message) const; v8::Isolate* isolate() const { return isolate_; } diff --git a/native_mate/callback.h b/native_mate/callback.h index d80d381..28e572f 100644 --- a/native_mate/callback.h +++ b/native_mate/callback.h @@ -28,8 +28,8 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle val(holder->Call(holder, 0, NULL)); + v8::Local holder = function->NewHandle(); + v8::Local val(holder->Call(holder, 0, NULL)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -40,7 +40,7 @@ struct V8FunctionInvoker { static void Go(v8::Isolate* isolate, SafeV8Function function) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); + v8::Local holder = function->NewHandle(); holder->Call(holder, 0, NULL); } }; @@ -51,11 +51,11 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -66,8 +66,8 @@ struct V8FunctionInvoker { static void Go(v8::Isolate* isolate, SafeV8Function function, P1 a1) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), }; holder->Call(holder, arraysize(args), args); @@ -80,12 +80,12 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -96,8 +96,8 @@ struct V8FunctionInvoker { static void Go(v8::Isolate* isolate, SafeV8Function function, P1 a1, P2 a2) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), }; @@ -112,13 +112,13 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -130,8 +130,8 @@ struct V8FunctionInvoker { P3 a3) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), @@ -147,14 +147,14 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), ConvertToV8(isolate, a4), }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -166,8 +166,8 @@ struct V8FunctionInvoker { P3 a3, P4 a4) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), @@ -185,15 +185,15 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), ConvertToV8(isolate, a4), ConvertToV8(isolate, a5), }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -205,8 +205,8 @@ struct V8FunctionInvoker { P3 a3, P4 a4, P5 a5) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), @@ -225,8 +225,8 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), @@ -234,7 +234,7 @@ struct V8FunctionInvoker { ConvertToV8(isolate, a5), ConvertToV8(isolate, a6), }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); Converter::FromV8(isolate, val, &ret); return ret; } @@ -247,8 +247,8 @@ struct V8FunctionInvoker { P3 a3, P4 a4, P5 a5, P6 a6) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); - v8::Handle args[] = { + v8::Local holder = function->NewHandle(); + v8::Local args[] = { ConvertToV8(isolate, a1), ConvertToV8(isolate, a2), ConvertToV8(isolate, a3), @@ -264,12 +264,12 @@ struct V8FunctionInvoker { template struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const base::Callback& val) { return CreateFunctionTemplate(isolate, val)->GetFunction(); } static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, base::Callback* out) { if (!val->IsFunction()) return false; diff --git a/native_mate/callback.h.pump b/native_mate/callback.h.pump index 9f0220e..1286fd0 100644 --- a/native_mate/callback.h.pump +++ b/native_mate/callback.h.pump @@ -35,19 +35,19 @@ struct V8FunctionInvoker { R ret; Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); + v8::Local holder = function->NewHandle(); $if ARITY == 0 [[ - v8::Handle val(holder->Call(holder, 0, NULL)); + v8::Local val(holder->Call(holder, 0, NULL)); ]] $else [[ - v8::Handle args[] = { + v8::Local args[] = { $for ARG [[ ConvertToV8(isolate, a$(ARG)), ]] }; - v8::Handle val(holder->Call(holder, arraysize(args), args)); + v8::Local val(holder->Call(holder, arraysize(args), args)); ]] Converter::FromV8(isolate, val, &ret); @@ -60,12 +60,12 @@ struct V8FunctionInvoker { static void Go(v8::Isolate* isolate, SafeV8Function function$for ARG [[, P$(ARG) a$(ARG)]]) { Locker locker(isolate); MATE_HANDLE_SCOPE(isolate); - v8::Handle holder = function->NewHandle(); + v8::Local holder = function->NewHandle(); $if ARITY == 0 [[ holder->Call(holder, 0, NULL); ]] $else [[ - v8::Handle args[] = { + v8::Local args[] = { $for ARG [[ ConvertToV8(isolate, a$(ARG)), @@ -84,12 +84,12 @@ $for ARG [[ template struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const base::Callback& val) { return CreateFunctionTemplate(isolate, val)->GetFunction(); } static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, base::Callback* out) { if (!val->IsFunction()) return false; diff --git a/native_mate/compat.h b/native_mate/compat.h index 021c0ca..5baefb4 100644 --- a/native_mate/compat.h +++ b/native_mate/compat.h @@ -69,7 +69,7 @@ #define MATE_HANDLE_SCOPE(isolate) v8::HandleScope handle_scope #define MATE_METHOD_ARGS_TYPE v8::Arguments -#define MATE_METHOD_RETURN_TYPE v8::Handle +#define MATE_METHOD_RETURN_TYPE v8::Local #define MATE_METHOD_RETURN_VALUE(value) return value #define MATE_METHOD_RETURN_UNDEFINED() return v8::Undefined() diff --git a/native_mate/constructor.h b/native_mate/constructor.h index 14ea119..98cd62b 100644 --- a/native_mate/constructor.h +++ b/native_mate/constructor.h @@ -133,7 +133,7 @@ class Constructor { MATE_PERSISTENT_RESET(constructor_); } - v8::Handle GetFunctionTemplate( + v8::Local GetFunctionTemplate( v8::Isolate* isolate, const WrappableFactoryFunction& factory) { if (constructor_.IsEmpty()) { v8::Local constructor = CreateFunctionTemplate( diff --git a/native_mate/constructor.h.pump b/native_mate/constructor.h.pump index 94a56d4..ec4944f 100644 --- a/native_mate/constructor.h.pump +++ b/native_mate/constructor.h.pump @@ -69,7 +69,7 @@ class Constructor { MATE_PERSISTENT_RESET(constructor_); } - v8::Handle GetFunctionTemplate( + v8::Local GetFunctionTemplate( v8::Isolate* isolate, const WrappableFactoryFunction& factory) { if (constructor_.IsEmpty()) { v8::Local constructor = CreateFunctionTemplate( diff --git a/native_mate/converter.cc b/native_mate/converter.cc index 2c9d95f..25ebf4c 100644 --- a/native_mate/converter.cc +++ b/native_mate/converter.cc @@ -10,9 +10,9 @@ using v8::Boolean; using v8::External; using v8::Function; -using v8::Handle; using v8::Integer; using v8::Isolate; +using v8::Local; using v8::Number; using v8::Object; using v8::String; @@ -20,11 +20,11 @@ using v8::Value; namespace mate { -Handle Converter::ToV8(Isolate* isolate, bool val) { +Local Converter::ToV8(Isolate* isolate, bool val) { return MATE_BOOLEAN_NEW(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, bool* out) { +bool Converter::FromV8(Isolate* isolate, Local val, bool* out) { if (!val->IsBoolean()) return false; *out = val->BooleanValue(); @@ -32,12 +32,12 @@ bool Converter::FromV8(Isolate* isolate, Handle val, bool* out) { } #if !defined(OS_LINUX) -Handle Converter::ToV8(Isolate* isolate, +Local Converter::ToV8(Isolate* isolate, unsigned long val) { return MATE_INTEGER_NEW(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, unsigned long* out) { if (!val->IsNumber()) return false; @@ -46,11 +46,11 @@ bool Converter::FromV8(Isolate* isolate, Handle val, } #endif -Handle Converter::ToV8(Isolate* isolate, int32_t val) { +Local Converter::ToV8(Isolate* isolate, int32_t val) { return MATE_INTEGER_NEW(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, int32_t* out) { if (!val->IsInt32()) return false; @@ -58,11 +58,11 @@ bool Converter::FromV8(Isolate* isolate, Handle val, return true; } -Handle Converter::ToV8(Isolate* isolate, uint32_t val) { +Local Converter::ToV8(Isolate* isolate, uint32_t val) { return MATE_INTEGER_NEW_UNSIGNED(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, uint32_t* out) { if (!val->IsUint32()) return false; @@ -70,11 +70,11 @@ bool Converter::FromV8(Isolate* isolate, Handle val, return true; } -Handle Converter::ToV8(Isolate* isolate, int64_t val) { +Local Converter::ToV8(Isolate* isolate, int64_t val) { return MATE_NUMBER_NEW(isolate, static_cast(val)); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, int64_t* out) { if (!val->IsNumber()) return false; @@ -84,11 +84,11 @@ bool Converter::FromV8(Isolate* isolate, Handle val, return true; } -Handle Converter::ToV8(Isolate* isolate, uint64_t val) { +Local Converter::ToV8(Isolate* isolate, uint64_t val) { return MATE_NUMBER_NEW(isolate, static_cast(val)); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, uint64_t* out) { if (!val->IsNumber()) return false; @@ -96,11 +96,11 @@ bool Converter::FromV8(Isolate* isolate, Handle val, return true; } -Handle Converter::ToV8(Isolate* isolate, float val) { +Local Converter::ToV8(Isolate* isolate, float val) { return MATE_NUMBER_NEW(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, float* out) { if (!val->IsNumber()) return false; @@ -108,11 +108,11 @@ bool Converter::FromV8(Isolate* isolate, Handle val, return true; } -Handle Converter::ToV8(Isolate* isolate, double val) { +Local Converter::ToV8(Isolate* isolate, double val) { return MATE_NUMBER_NEW(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, double* out) { if (!val->IsNumber()) return false; @@ -120,100 +120,100 @@ bool Converter::FromV8(Isolate* isolate, Handle val, return true; } -Handle Converter::ToV8( +Local Converter::ToV8( Isolate* isolate, const char* val) { return MATE_STRING_NEW_FROM_UTF8(isolate, val, -1); } -Handle Converter::ToV8( +Local Converter::ToV8( Isolate* isolate, const base::StringPiece& val) { return MATE_STRING_NEW_FROM_UTF8(isolate, val.data(), static_cast(val.length())); } -Handle Converter::ToV8(Isolate* isolate, +Local Converter::ToV8(Isolate* isolate, const std::string& val) { return Converter::ToV8(isolate, val); } -bool Converter::FromV8(Isolate* isolate, Handle val, +bool Converter::FromV8(Isolate* isolate, Local val, std::string* out) { if (!val->IsString()) return false; - Handle str = Handle::Cast(val); + Local str = Local::Cast(val); int length = str->Utf8Length(); out->resize(length); str->WriteUtf8(&(*out)[0], length, NULL, String::NO_NULL_TERMINATION); return true; } -bool Converter >::FromV8(Isolate* isolate, Handle val, - Handle* out) { +bool Converter >::FromV8(Isolate* isolate, Local val, + Local* out) { if (!val->IsFunction()) return false; - *out = Handle::Cast(val); + *out = Local::Cast(val); return true; } -Handle Converter >::ToV8(Isolate* isolate, - Handle val) { +Local Converter >::ToV8(Isolate* isolate, + Local val) { return val; } -bool Converter >::FromV8(Isolate* isolate, Handle val, - Handle* out) { +bool Converter >::FromV8(Isolate* isolate, Local val, + Local* out) { if (!val->IsObject()) return false; - *out = Handle::Cast(val); + *out = Local::Cast(val); return true; } -Handle Converter >::ToV8(Isolate* isolate, - Handle val) { +Local Converter >::ToV8(Isolate* isolate, + Local val) { return val; } -bool Converter >::FromV8(Isolate* isolate, Handle val, - Handle* out) { +bool Converter >::FromV8(Isolate* isolate, Local val, + Local* out) { if (!val->IsString()) return false; - *out = Handle::Cast(val); + *out = Local::Cast(val); return true; } -Handle Converter >::ToV8(Isolate* isolate, - Handle val) { +Local Converter >::ToV8(Isolate* isolate, + Local val) { return val; } -bool Converter >::FromV8(Isolate* isolate, - v8::Handle val, - Handle* out) { +bool Converter >::FromV8(Isolate* isolate, + v8::Local val, + Local* out) { if (!val->IsExternal()) return false; - *out = Handle::Cast(val); + *out = Local::Cast(val); return true; } -Handle Converter >::ToV8(Isolate* isolate, - Handle val) { +Local Converter >::ToV8(Isolate* isolate, + Local val) { return val; } -bool Converter >::FromV8(Isolate* isolate, Handle val, - Handle* out) { +bool Converter >::FromV8(Isolate* isolate, Local val, + Local* out) { *out = val; return true; } -v8::Handle StringToSymbol(v8::Isolate* isolate, +v8::Local StringToSymbol(v8::Isolate* isolate, const base::StringPiece& val) { return MATE_STRING_NEW_SYMBOL(isolate, val.data(), static_cast(val.length())); } -std::string V8ToString(v8::Handle value) { +std::string V8ToString(v8::Local value) { if (value.IsEmpty()) return std::string(); std::string result; diff --git a/native_mate/converter.h b/native_mate/converter.h index 2093ce0..050b1c0 100644 --- a/native_mate/converter.h +++ b/native_mate/converter.h @@ -20,156 +20,156 @@ struct Converter {}; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, void* val) { + static v8::Local ToV8(v8::Isolate* isolate, void* val) { return MATE_UNDEFINED(isolate); } }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, bool val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, bool* out); }; #if !defined(OS_LINUX) template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, unsigned long val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, unsigned long* out); }; #endif template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, int32_t val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, int32_t* out); }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, uint32_t val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, uint32_t* out); }; template<> struct Converter { // Warning: JavaScript cannot represent 64 integers precisely. - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, int64_t val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, int64_t* out); }; template<> struct Converter { // Warning: JavaScript cannot represent 64 integers precisely. - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, uint64_t val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, uint64_t* out); }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, float val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, float* out); }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, double val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, double* out); }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, const char* val); + static v8::Local ToV8(v8::Isolate* isolate, const char* val); }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const base::StringPiece& val); // No conversion out is possible because StringPiece does not contain storage. }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const std::string& val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, std::string* out); }; template<> -struct Converter > { +struct Converter > { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, - v8::Handle* out); + v8::Local val, + v8::Local* out); }; template<> -struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, - v8::Handle val); +struct Converter > { + static v8::Local ToV8(v8::Isolate* isolate, + v8::Local val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, - v8::Handle* out); + v8::Local val, + v8::Local* out); }; template<> -struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, - v8::Handle val); +struct Converter > { + static v8::Local ToV8(v8::Isolate* isolate, + v8::Local val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, - v8::Handle* out); + v8::Local val, + v8::Local* out); }; template<> -struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, - v8::Handle val); +struct Converter > { + static v8::Local ToV8(v8::Isolate* isolate, + v8::Local val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, - v8::Handle* out); + v8::Local val, + v8::Local* out); }; template<> -struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, - v8::Handle val); +struct Converter > { + static v8::Local ToV8(v8::Isolate* isolate, + v8::Local val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, - v8::Handle* out); + v8::Local val, + v8::Local* out); }; template struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const std::vector& val) { - v8::Handle result( + v8::Local result( MATE_ARRAY_NEW(isolate, static_cast(val.size()))); for (size_t i = 0; i < val.size(); ++i) { result->Set(static_cast(i), Converter::ToV8(isolate, val[i])); @@ -178,13 +178,13 @@ struct Converter > { } static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, std::vector* out) { if (!val->IsArray()) return false; std::vector result; - v8::Handle array(v8::Handle::Cast(val)); + v8::Local array(v8::Local::Cast(val)); uint32_t length = array->Length(); for (uint32_t i = 0; i < length; ++i) { T item; @@ -200,9 +200,9 @@ struct Converter > { template struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const std::set& val) { - v8::Handle result( + v8::Local result( MATE_ARRAY_NEW(isolate, static_cast(val.size()))); typename std::set::const_iterator it; int i; @@ -212,13 +212,13 @@ struct Converter > { } static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, std::set* out) { if (!val->IsArray()) return false; std::set result; - v8::Handle array(v8::Handle::Cast(val)); + v8::Local array(v8::Local::Cast(val)); uint32_t length = array->Length(); for (uint32_t i = 0; i < length; ++i) { T item; @@ -234,32 +234,32 @@ struct Converter > { // Convenience functions that deduce T. template -v8::Handle ConvertToV8(v8::Isolate* isolate, +v8::Local ConvertToV8(v8::Isolate* isolate, const T& input) { return Converter::ToV8(isolate, input); } -inline v8::Handle ConvertToV8(v8::Isolate* isolate, +inline v8::Local ConvertToV8(v8::Isolate* isolate, const char* input) { return Converter::ToV8(isolate, input); } -inline v8::Handle StringToV8( +inline v8::Local StringToV8( v8::Isolate* isolate, const base::StringPiece& input) { return ConvertToV8(isolate, input).As(); } -v8::Handle StringToSymbol(v8::Isolate* isolate, +v8::Local StringToSymbol(v8::Isolate* isolate, const base::StringPiece& input); template -bool ConvertFromV8(v8::Isolate* isolate, v8::Handle input, +bool ConvertFromV8(v8::Isolate* isolate, v8::Local input, T* result) { return Converter::FromV8(isolate, input, result); } -std::string V8ToString(v8::Handle value); +std::string V8ToString(v8::Local value); } // namespace mate diff --git a/native_mate/dictionary.cc b/native_mate/dictionary.cc index 6c154ea..7ab7020 100644 --- a/native_mate/dictionary.cc +++ b/native_mate/dictionary.cc @@ -11,7 +11,7 @@ Dictionary::Dictionary() } Dictionary::Dictionary(v8::Isolate* isolate, - v8::Handle object) + v8::Local object) : isolate_(isolate), object_(object) { } @@ -19,21 +19,21 @@ Dictionary::Dictionary(v8::Isolate* isolate, Dictionary::~Dictionary() { } -v8::Handle Dictionary::GetHandle() const { +v8::Local Dictionary::GetHandle() const { return object_; } -v8::Handle Converter::ToV8(v8::Isolate* isolate, +v8::Local Converter::ToV8(v8::Isolate* isolate, Dictionary val) { return val.GetHandle(); } bool Converter::FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, Dictionary* out) { if (!val->IsObject()) return false; - *out = Dictionary(isolate, v8::Handle::Cast(val)); + *out = Dictionary(isolate, v8::Local::Cast(val)); return true; } diff --git a/native_mate/dictionary.h b/native_mate/dictionary.h index fab215e..9279d49 100644 --- a/native_mate/dictionary.h +++ b/native_mate/dictionary.h @@ -25,12 +25,12 @@ namespace mate { class Dictionary { public: Dictionary(); - Dictionary(v8::Isolate* isolate, v8::Handle object); + Dictionary(v8::Isolate* isolate, v8::Local object); ~Dictionary(); template bool Get(const base::StringPiece& key, T* out) const { - v8::Handle val = GetHandle()->Get(StringToV8(isolate_, key)); + v8::Local val = GetHandle()->Get(StringToV8(isolate_, key)); return ConvertFromV8(isolate_, val, out); } @@ -49,7 +49,7 @@ class Dictionary { bool IsEmpty() const { return isolate() == NULL; } - virtual v8::Handle GetHandle() const; + virtual v8::Local GetHandle() const; v8::Isolate* isolate() const { return isolate_; } @@ -57,15 +57,15 @@ class Dictionary { v8::Isolate* isolate_; private: - v8::Handle object_; + v8::Local object_; }; template<> struct Converter { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, Dictionary val); static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, Dictionary* out); }; diff --git a/native_mate/function_template.cc b/native_mate/function_template.cc index c8b71c4..3d40436 100644 --- a/native_mate/function_template.cc +++ b/native_mate/function_template.cc @@ -17,7 +17,7 @@ CallbackHolderBase::~CallbackHolderBase() { DCHECK(v8_ref_.IsEmpty()); } -v8::Handle CallbackHolderBase::GetHandle(v8::Isolate* isolate) { +v8::Local CallbackHolderBase::GetHandle(v8::Isolate* isolate) { return MATE_PERSISTENT_TO_LOCAL(v8::External, isolate, v8_ref_); } diff --git a/native_mate/function_template.h b/native_mate/function_template.h index 14ed170..cb3c90d 100644 --- a/native_mate/function_template.h +++ b/native_mate/function_template.h @@ -48,7 +48,7 @@ struct CallbackParamTraits { // among every CallbackHolder instance. class CallbackHolderBase { public: - v8::Handle GetHandle(v8::Isolate* isolate); + v8::Local GetHandle(v8::Isolate* isolate); protected: explicit CallbackHolderBase(v8::Isolate* isolate); @@ -333,7 +333,7 @@ template struct Dispatcher { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -349,7 +349,7 @@ template struct Dispatcher { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -371,7 +371,7 @@ template struct Dispatcher { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -395,7 +395,7 @@ template struct Dispatcher { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -421,7 +421,7 @@ template struct Dispatcher { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -451,7 +451,7 @@ template { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -483,7 +483,7 @@ template { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -517,7 +517,7 @@ template { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -567,7 +567,7 @@ v8::Local CreateFunctionTemplate( isolate, #endif &internal::Dispatcher::DispatchToCallback, - ConvertToV8 >(isolate, + ConvertToV8 >(isolate, holder->GetHandle(isolate))); } diff --git a/native_mate/function_template.h.pump b/native_mate/function_template.h.pump index c3009f2..e01bef4 100644 --- a/native_mate/function_template.h.pump +++ b/native_mate/function_template.h.pump @@ -51,7 +51,7 @@ struct CallbackParamTraits { // among every CallbackHolder instance. class CallbackHolderBase { public: - v8::Handle GetHandle(v8::Isolate* isolate); + v8::Local GetHandle(v8::Isolate* isolate); protected: explicit CallbackHolderBase(v8::Isolate* isolate); @@ -169,7 +169,7 @@ template struct Dispatcher { static MATE_METHOD(DispatchToCallback) { Arguments args(info); - v8::Handle v8_holder; + v8::Local v8_holder; CHECK(args.GetData(&v8_holder)); CallbackHolderBase* holder_base = reinterpret_cast( v8_holder->Value()); @@ -216,7 +216,7 @@ v8::Local CreateFunctionTemplate( isolate, #endif &internal::Dispatcher::DispatchToCallback, - ConvertToV8 >(isolate, + ConvertToV8 >(isolate, holder->GetHandle(isolate))); } diff --git a/native_mate/handle.h b/native_mate/handle.h index f81b9d1..15e0bb5 100644 --- a/native_mate/handle.h +++ b/native_mate/handle.h @@ -18,7 +18,7 @@ class Handle { public: Handle() : object_(NULL) {} - Handle(v8::Handle wrapper, T* object) + Handle(v8::Local wrapper, T* object) : wrapper_(wrapper), object_(object) { } @@ -31,21 +31,21 @@ class Handle { } T* operator->() const { return object_; } - v8::Handle ToV8() const { return wrapper_; } + v8::Local ToV8() const { return wrapper_; } T* get() const { return object_; } private: - v8::Handle wrapper_; + v8::Local wrapper_; T* object_; }; template struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const mate::Handle& val) { return val.ToV8(); } - static bool FromV8(v8::Isolate* isolate, v8::Handle val, + static bool FromV8(v8::Isolate* isolate, v8::Local val, mate::Handle* out) { T* object = NULL; if (!Converter::FromV8(isolate, val, &object)) { diff --git a/native_mate/object_template_builder.cc b/native_mate/object_template_builder.cc index 7c40b58..a2011f0 100644 --- a/native_mate/object_template_builder.cc +++ b/native_mate/object_template_builder.cc @@ -17,14 +17,14 @@ ObjectTemplateBuilder::~ObjectTemplateBuilder() { } ObjectTemplateBuilder& ObjectTemplateBuilder::SetImpl( - const base::StringPiece& name, v8::Handle val) { + const base::StringPiece& name, v8::Local val) { template_->Set(StringToSymbol(isolate_, name), val); return *this; } ObjectTemplateBuilder& ObjectTemplateBuilder::SetPropertyImpl( - const base::StringPiece& name, v8::Handle getter, - v8::Handle setter) { + const base::StringPiece& name, v8::Local getter, + v8::Local setter) { #if NODE_VERSION_AT_LEAST(0, 11, 0) template_->SetAccessorProperty(StringToSymbol(isolate_, name), getter, setter); diff --git a/native_mate/object_template_builder.h b/native_mate/object_template_builder.h index cd69c47..d37f009 100644 --- a/native_mate/object_template_builder.h +++ b/native_mate/object_template_builder.h @@ -22,7 +22,7 @@ namespace { // because of base::Bind(). template struct CallbackTraits { - static v8::Handle CreateTemplate(v8::Isolate* isolate, + static v8::Local CreateTemplate(v8::Isolate* isolate, T callback) { return CreateFunctionTemplate(isolate, base::Bind(callback)); } @@ -31,7 +31,7 @@ struct CallbackTraits { // Specialization for base::Callback. template struct CallbackTraits > { - static v8::Handle CreateTemplate( + static v8::Local CreateTemplate( v8::Isolate* isolate, const base::Callback& callback) { return CreateFunctionTemplate(isolate, callback); } @@ -44,7 +44,7 @@ struct CallbackTraits > { template struct CallbackTraits::value>::type> { - static v8::Handle CreateTemplate(v8::Isolate* isolate, + static v8::Local CreateTemplate(v8::Isolate* isolate, T callback) { return CreateFunctionTemplate(isolate, base::Bind(callback), HolderIsFirstArgument); @@ -54,9 +54,9 @@ struct CallbackTraits -struct CallbackTraits > { - static v8::Handle CreateTemplate( - v8::Handle templ) { +struct CallbackTraits > { + static v8::Local CreateTemplate( + v8::Local templ) { return templ; } }; @@ -109,10 +109,10 @@ class ObjectTemplateBuilder { private: ObjectTemplateBuilder& SetImpl(const base::StringPiece& name, - v8::Handle val); + v8::Local val); ObjectTemplateBuilder& SetPropertyImpl( - const base::StringPiece& name, v8::Handle getter, - v8::Handle setter); + const base::StringPiece& name, v8::Local getter, + v8::Local setter); v8::Isolate* isolate_; diff --git a/native_mate/persistent_dictionary.cc b/native_mate/persistent_dictionary.cc index 05c83e5..fd68cdc 100644 --- a/native_mate/persistent_dictionary.cc +++ b/native_mate/persistent_dictionary.cc @@ -10,7 +10,7 @@ PersistentDictionary::PersistentDictionary() { } PersistentDictionary::PersistentDictionary(v8::Isolate* isolate, - v8::Handle object) + v8::Local object) : handle_(new RefCountedPersistent(isolate, object)) { isolate_ = isolate; } @@ -18,16 +18,16 @@ PersistentDictionary::PersistentDictionary(v8::Isolate* isolate, PersistentDictionary::~PersistentDictionary() { } -v8::Handle PersistentDictionary::GetHandle() const { +v8::Local PersistentDictionary::GetHandle() const { return handle_->NewHandle(); } bool Converter::FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, PersistentDictionary* out) { if (!val->IsObject()) return false; - *out = PersistentDictionary(isolate, v8::Handle::Cast(val)); + *out = PersistentDictionary(isolate, v8::Local::Cast(val)); return true; } diff --git a/native_mate/persistent_dictionary.h b/native_mate/persistent_dictionary.h index ae86c6b..26c8998 100644 --- a/native_mate/persistent_dictionary.h +++ b/native_mate/persistent_dictionary.h @@ -15,10 +15,10 @@ namespace mate { class PersistentDictionary : public Dictionary { public: PersistentDictionary(); - PersistentDictionary(v8::Isolate* isolate, v8::Handle object); + PersistentDictionary(v8::Isolate* isolate, v8::Local object); virtual ~PersistentDictionary(); - v8::Handle GetHandle() const override; + v8::Local GetHandle() const override; private: scoped_refptr > handle_; @@ -27,7 +27,7 @@ class PersistentDictionary : public Dictionary { template<> struct Converter { static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, PersistentDictionary* out); }; diff --git a/native_mate/scoped_persistent.h b/native_mate/scoped_persistent.h index bbc91b9..c7c5355 100644 --- a/native_mate/scoped_persistent.h +++ b/native_mate/scoped_persistent.h @@ -18,16 +18,16 @@ class ScopedPersistent { public: ScopedPersistent() : isolate_(v8::Isolate::GetCurrent()) {} - ScopedPersistent(v8::Isolate* isolate, v8::Handle handle) + ScopedPersistent(v8::Isolate* isolate, v8::Local handle) : isolate_(isolate) { - reset(isolate, v8::Handle::Cast(handle)); + reset(isolate, v8::Local::Cast(handle)); } ~ScopedPersistent() { reset(); } - void reset(v8::Isolate* isolate, v8::Handle handle) { + void reset(v8::Isolate* isolate, v8::Local handle) { if (!handle.IsEmpty()) { isolate_ = isolate; MATE_PERSISTENT_ASSIGN(T, isolate, handle_, handle); @@ -44,11 +44,11 @@ class ScopedPersistent { return handle_.IsEmpty(); } - v8::Handle NewHandle() const { + v8::Local NewHandle() const { return NewHandle(isolate_); } - v8::Handle NewHandle(v8::Isolate* isolate) const { + v8::Local NewHandle(v8::Isolate* isolate) const { if (handle_.IsEmpty()) return v8::Local(); return MATE_PERSISTENT_TO_LOCAL(T, isolate, handle_); @@ -74,7 +74,7 @@ class RefCountedPersistent : public ScopedPersistent, public: RefCountedPersistent() {} - RefCountedPersistent(v8::Isolate* isolate, v8::Handle handle) + RefCountedPersistent(v8::Isolate* isolate, v8::Local handle) : ScopedPersistent(isolate, handle) { } @@ -89,16 +89,16 @@ class RefCountedPersistent : public ScopedPersistent, template struct Converter > { - static v8::Handle ToV8(v8::Isolate* isolate, + static v8::Local ToV8(v8::Isolate* isolate, const ScopedPersistent& val) { return val.NewHandle(isolate); } static bool FromV8(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, ScopedPersistent* out) { - v8::Handle converted; - if (!Converter >::FromV8(isolate, val, &converted)) + v8::Local converted; + if (!Converter >::FromV8(isolate, val, &converted)) return false; out->reset(isolate, converted); diff --git a/native_mate/try_catch.cc b/native_mate/try_catch.cc index c3efd3c..c7a9c00 100644 --- a/native_mate/try_catch.cc +++ b/native_mate/try_catch.cc @@ -26,17 +26,17 @@ std::string TryCatch::GetStackTrace() { } std::stringstream ss; - v8::Handle message = try_catch_.Message(); + v8::Local message = try_catch_.Message(); ss << V8ToString(message->Get()) << std::endl << V8ToString(message->GetSourceLine()) << std::endl; - v8::Handle trace = message->GetStackTrace(); + v8::Local trace = message->GetStackTrace(); if (trace.IsEmpty()) return ss.str(); int len = trace->GetFrameCount(); for (int i = 0; i < len; ++i) { - v8::Handle frame = trace->GetFrame(i); + v8::Local frame = trace->GetFrame(i); ss << V8ToString(frame->GetScriptName()) << ":" << frame->GetLineNumber() << ":" << frame->GetColumn() << ": " diff --git a/native_mate/wrappable.cc b/native_mate/wrappable.cc index 070c3c5..274c9c3 100644 --- a/native_mate/wrappable.cc +++ b/native_mate/wrappable.cc @@ -17,7 +17,7 @@ Wrappable::~Wrappable() { MATE_PERSISTENT_RESET(wrapper_); } -void Wrappable::Wrap(v8::Isolate* isolate, v8::Handle wrapper) { +void Wrappable::Wrap(v8::Isolate* isolate, v8::Local wrapper) { if (!wrapper_.IsEmpty()) return; @@ -26,7 +26,7 @@ void Wrappable::Wrap(v8::Isolate* isolate, v8::Handle wrapper) { MATE_PERSISTENT_SET_WEAK(wrapper_, this, WeakCallback); // Call object._init if we have one. - v8::Handle init; + v8::Local init; if (Dictionary(isolate, wrapper).Get("_init", &init)) init->Call(wrapper, 0, NULL); @@ -35,7 +35,7 @@ void Wrappable::Wrap(v8::Isolate* isolate, v8::Handle wrapper) { // static void Wrappable::BuildPrototype(v8::Isolate* isolate, - v8::Handle prototype) { + v8::Local prototype) { } ObjectTemplateBuilder Wrappable::GetObjectTemplateBuilder( @@ -49,7 +49,7 @@ MATE_WEAK_CALLBACK(Wrappable::WeakCallback, v8::Object, Wrappable) { delete self; } -v8::Handle Wrappable::GetWrapper(v8::Isolate* isolate) { +v8::Local Wrappable::GetWrapper(v8::Isolate* isolate) { if (!wrapper_.IsEmpty()) return MATE_PERSISTENT_TO_LOCAL(v8::Object, isolate, wrapper_); @@ -57,17 +57,17 @@ v8::Handle Wrappable::GetWrapper(v8::Isolate* isolate) { GetObjectTemplateBuilder(isolate).Build(); CHECK(!templ.IsEmpty()); CHECK_EQ(1, templ->InternalFieldCount()); - v8::Handle wrapper = templ->NewInstance(); + v8::Local wrapper = templ->NewInstance(); Wrap(isolate, wrapper); return wrapper; } namespace internal { -void* FromV8Impl(v8::Isolate* isolate, v8::Handle val) { +void* FromV8Impl(v8::Isolate* isolate, v8::Local val) { if (!val->IsObject()) return NULL; - v8::Handle obj = v8::Handle::Cast(val); + v8::Local obj = v8::Local::Cast(val); if (obj->InternalFieldCount() != 1) return NULL; return MATE_GET_INTERNAL_FIELD_POINTER(obj, 0); diff --git a/native_mate/wrappable.h b/native_mate/wrappable.h index f93bf6b..b8708f3 100644 --- a/native_mate/wrappable.h +++ b/native_mate/wrappable.h @@ -13,7 +13,7 @@ namespace mate { namespace internal { -void* FromV8Impl(v8::Isolate* isolate, v8::Handle val); +void* FromV8Impl(v8::Isolate* isolate, v8::Local val); } // namespace internal @@ -52,15 +52,15 @@ class Wrappable { // If the type is created via the Constructor, then the GetWrapper would // return the constructed object, otherwise it would try to create a new // object constructed by GetObjectTemplateBuilder. - v8::Handle GetWrapper(v8::Isolate* isolate); + v8::Local GetWrapper(v8::Isolate* isolate); // Bind the C++ class to the JS wrapper. - void Wrap(v8::Isolate* isolate, v8::Handle wrapper); + void Wrap(v8::Isolate* isolate, v8::Local wrapper); // The user should define T::BuildPrototype if they want to use Constructor // to build a constructor function for this type. static void BuildPrototype(v8::Isolate* isolate, - v8::Handle prototype); + v8::Local prototype); protected: Wrappable(); @@ -84,11 +84,11 @@ class Wrappable { template struct Converter::value>::type> { - static v8::Handle ToV8(v8::Isolate* isolate, T* val) { + static v8::Local ToV8(v8::Isolate* isolate, T* val) { return val->GetWrapper(isolate); } - static bool FromV8(v8::Isolate* isolate, v8::Handle val, T** out) { + static bool FromV8(v8::Isolate* isolate, v8::Local val, T** out) { *out = static_cast(static_cast( internal::FromV8Impl(isolate, val))); return *out != NULL;