diff --git a/benchmark/misc/function_call/binding.cc b/benchmark/misc/function_call/binding.cc index b8cedd7018..c6718e8e33 100644 --- a/benchmark/misc/function_call/binding.cc +++ b/benchmark/misc/function_call/binding.cc @@ -9,7 +9,7 @@ void Hello(const FunctionCallbackInfo& args) { args.GetReturnValue().Set(c++); } -extern "C" void init (Handle target) { +extern "C" void init (Local target) { HandleScope scope(Isolate::GetCurrent()); NODE_SET_METHOD(target, "hello", Hello); } diff --git a/src/async-wrap-inl.h b/src/async-wrap-inl.h index 5841c58faf..4e33153ca0 100644 --- a/src/async-wrap-inl.h +++ b/src/async-wrap-inl.h @@ -14,7 +14,7 @@ namespace node { inline AsyncWrap::AsyncWrap(Environment* env, - v8::Handle object, + v8::Local object, ProviderType provider, AsyncWrap* parent) : BaseObject(env, object), bits_(static_cast(provider) << 1) { @@ -58,20 +58,20 @@ inline AsyncWrap::ProviderType AsyncWrap::provider_type() const { } -inline v8::Handle AsyncWrap::MakeCallback( - const v8::Handle symbol, +inline v8::Local AsyncWrap::MakeCallback( + const v8::Local symbol, int argc, - v8::Handle* argv) { + v8::Local* argv) { v8::Local cb_v = object()->Get(symbol); CHECK(cb_v->IsFunction()); return MakeCallback(cb_v.As(), argc, argv); } -inline v8::Handle AsyncWrap::MakeCallback( +inline v8::Local AsyncWrap::MakeCallback( uint32_t index, int argc, - v8::Handle* argv) { + v8::Local* argv) { v8::Local cb_v = object()->Get(index); CHECK(cb_v->IsFunction()); return MakeCallback(cb_v.As(), argc, argv); diff --git a/src/async-wrap.cc b/src/async-wrap.cc index 43a647b6d7..37de0588b2 100644 --- a/src/async-wrap.cc +++ b/src/async-wrap.cc @@ -12,7 +12,6 @@ using v8::Array; using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HandleScope; using v8::HeapProfiler; using v8::Integer; @@ -83,7 +82,7 @@ intptr_t RetainedAsyncInfo::GetSizeInBytes() { } -RetainedObjectInfo* WrapperInfo(uint16_t class_id, Handle wrapper) { +RetainedObjectInfo* WrapperInfo(uint16_t class_id, Local wrapper) { // No class_id should be the provider type of NONE. CHECK_NE(NODE_ASYNC_ID_OFFSET, class_id); CHECK(wrapper->IsObject()); @@ -129,9 +128,9 @@ static void SetupHooks(const FunctionCallbackInfo& args) { } -static void Initialize(Handle target, - Handle unused, - Handle context) { +static void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Isolate* isolate = env->isolate(); HandleScope scope(isolate); @@ -160,9 +159,9 @@ void LoadAsyncWrapperInfo(Environment* env) { } -Handle AsyncWrap::MakeCallback(const Handle cb, +Local AsyncWrap::MakeCallback(const Local cb, int argc, - Handle* argv) { + Local* argv) { CHECK(env()->context() == env()->isolate()->GetCurrentContext()); Local context = object(); diff --git a/src/async-wrap.h b/src/async-wrap.h index bb93872ff7..d292bb4774 100644 --- a/src/async-wrap.h +++ b/src/async-wrap.h @@ -47,7 +47,7 @@ class AsyncWrap : public BaseObject { }; inline AsyncWrap(Environment* env, - v8::Handle object, + v8::Local object, ProviderType provider, AsyncWrap* parent = nullptr); @@ -56,15 +56,15 @@ class AsyncWrap : public BaseObject { inline ProviderType provider_type() const; // Only call these within a valid HandleScope. - v8::Handle MakeCallback(const v8::Handle cb, + v8::Local MakeCallback(const v8::Local cb, int argc, - v8::Handle* argv); - inline v8::Handle MakeCallback(const v8::Handle symbol, + v8::Local* argv); + inline v8::Local MakeCallback(const v8::Local symbol, int argc, - v8::Handle* argv); - inline v8::Handle MakeCallback(uint32_t index, + v8::Local* argv); + inline v8::Local MakeCallback(uint32_t index, int argc, - v8::Handle* argv); + v8::Local* argv); virtual size_t self_size() const = 0; diff --git a/src/cares_wrap.cc b/src/cares_wrap.cc index d4be7c9b9b..4ef5e01e77 100644 --- a/src/cares_wrap.cc +++ b/src/cares_wrap.cc @@ -38,7 +38,6 @@ using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -1240,9 +1239,9 @@ static void CaresTimerClose(Environment* env, } -static void Initialize(Handle target, - Handle unused, - Handle context) { +static void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); int r = ares_library_init(ARES_LIB_INIT_ALL); diff --git a/src/debug-agent.cc b/src/debug-agent.cc index b99446f69c..3409fb2603 100644 --- a/src/debug-agent.cc +++ b/src/debug-agent.cc @@ -39,7 +39,6 @@ using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; diff --git a/src/fs_event_wrap.cc b/src/fs_event_wrap.cc index e17f9ce58e..0d0096cab7 100644 --- a/src/fs_event_wrap.cc +++ b/src/fs_event_wrap.cc @@ -14,7 +14,6 @@ namespace node { using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -24,9 +23,9 @@ using v8::Value; class FSEventWrap: public HandleWrap { public: - static void Initialize(Handle target, - Handle unused, - Handle context); + static void Initialize(Local target, + Local unused, + Local context); static void New(const FunctionCallbackInfo& args); static void Start(const FunctionCallbackInfo& args); static void Close(const FunctionCallbackInfo& args); @@ -34,7 +33,7 @@ class FSEventWrap: public HandleWrap { size_t self_size() const override { return sizeof(*this); } private: - FSEventWrap(Environment* env, Handle object); + FSEventWrap(Environment* env, Local object); virtual ~FSEventWrap() override; static void OnEvent(uv_fs_event_t* handle, const char* filename, int events, @@ -45,7 +44,7 @@ class FSEventWrap: public HandleWrap { }; -FSEventWrap::FSEventWrap(Environment* env, Handle object) +FSEventWrap::FSEventWrap(Environment* env, Local object) : HandleWrap(env, object, reinterpret_cast(&handle_), @@ -59,9 +58,9 @@ FSEventWrap::~FSEventWrap() { } -void FSEventWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void FSEventWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); diff --git a/src/handle_wrap.cc b/src/handle_wrap.cc index 341ecfdef5..43c5490eef 100644 --- a/src/handle_wrap.cc +++ b/src/handle_wrap.cc @@ -11,7 +11,6 @@ namespace node { using v8::Context; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HandleScope; using v8::Local; using v8::Object; @@ -59,7 +58,7 @@ void HandleWrap::Close(const FunctionCallbackInfo& args) { HandleWrap::HandleWrap(Environment* env, - Handle object, + Local object, uv_handle_t* handle, AsyncWrap::ProviderType provider, AsyncWrap* parent) diff --git a/src/handle_wrap.h b/src/handle_wrap.h index 94cfe3d558..da712b33be 100644 --- a/src/handle_wrap.h +++ b/src/handle_wrap.h @@ -44,7 +44,7 @@ class HandleWrap : public AsyncWrap { protected: HandleWrap(Environment* env, - v8::Handle object, + v8::Local object, uv_handle_t* handle, AsyncWrap::ProviderType provider, AsyncWrap* parent = nullptr); diff --git a/src/js_stream.cc b/src/js_stream.cc index 16fabc9df3..77595ad3cd 100644 --- a/src/js_stream.cc +++ b/src/js_stream.cc @@ -15,14 +15,13 @@ using v8::Context; using v8::External; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Local; using v8::Object; using v8::Value; -JSStream::JSStream(Environment* env, Handle obj, AsyncWrap* parent) +JSStream::JSStream(Environment* env, Local obj, AsyncWrap* parent) : StreamBase(env), AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent) { node::Wrap(obj, this); @@ -201,9 +200,9 @@ void JSStream::EmitEOF(const FunctionCallbackInfo& args) { } -void JSStream::Initialize(Handle target, - Handle unused, - Handle context) { +void JSStream::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); diff --git a/src/js_stream.h b/src/js_stream.h index 9f7ba7de27..1a8902af46 100644 --- a/src/js_stream.h +++ b/src/js_stream.h @@ -10,9 +10,9 @@ namespace node { class JSStream : public StreamBase, public AsyncWrap { public: - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); ~JSStream(); @@ -31,7 +31,7 @@ class JSStream : public StreamBase, public AsyncWrap { size_t self_size() const override { return sizeof(*this); } protected: - JSStream(Environment* env, v8::Handle obj, AsyncWrap* parent); + JSStream(Environment* env, v8::Local obj, AsyncWrap* parent); AsyncWrap* GetAsyncWrap() override; diff --git a/src/node.cc b/src/node.cc index f460c8d161..f27541bc32 100644 --- a/src/node.cc +++ b/src/node.cc @@ -92,7 +92,6 @@ using v8::Exception; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::HeapStatistics; using v8::Integer; @@ -990,11 +989,11 @@ void SetupPromises(const FunctionCallbackInfo& args) { } -Handle MakeCallback(Environment* env, - Handle recv, - const Handle callback, +Local MakeCallback(Environment* env, + Local recv, + const Local callback, int argc, - Handle argv[]) { + Local argv[]) { // If you hit this assertion, you forgot to enter the v8::Context first. CHECK_EQ(env->context(), env->isolate()->GetCurrentContext()); @@ -1071,43 +1070,43 @@ Handle MakeCallback(Environment* env, // Internal only. -Handle MakeCallback(Environment* env, - Handle recv, +Local MakeCallback(Environment* env, + Local recv, uint32_t index, int argc, - Handle argv[]) { + Local argv[]) { Local cb_v = recv->Get(index); CHECK(cb_v->IsFunction()); return MakeCallback(env, recv.As(), cb_v.As(), argc, argv); } -Handle MakeCallback(Environment* env, - Handle recv, - Handle symbol, +Local MakeCallback(Environment* env, + Local recv, + Local symbol, int argc, - Handle argv[]) { + Local argv[]) { Local cb_v = recv->Get(symbol); CHECK(cb_v->IsFunction()); return MakeCallback(env, recv.As(), cb_v.As(), argc, argv); } -Handle MakeCallback(Environment* env, - Handle recv, +Local MakeCallback(Environment* env, + Local recv, const char* method, int argc, - Handle argv[]) { + Local argv[]) { Local method_string = OneByteString(env->isolate(), method); return MakeCallback(env, recv, method_string, argc, argv); } -Handle MakeCallback(Isolate* isolate, - Handle recv, +Local MakeCallback(Isolate* isolate, + Local recv, const char* method, int argc, - Handle argv[]) { + Local argv[]) { EscapableHandleScope handle_scope(isolate); Local context = recv->CreationContext(); Environment* env = Environment::GetCurrent(context); @@ -1117,11 +1116,11 @@ Handle MakeCallback(Isolate* isolate, } -Handle MakeCallback(Isolate* isolate, - Handle recv, - Handle symbol, +Local MakeCallback(Isolate* isolate, + Local recv, + Local symbol, int argc, - Handle argv[]) { + Local argv[]) { EscapableHandleScope handle_scope(isolate); Local context = recv->CreationContext(); Environment* env = Environment::GetCurrent(context); @@ -1131,11 +1130,11 @@ Handle MakeCallback(Isolate* isolate, } -Handle MakeCallback(Isolate* isolate, - Handle recv, - Handle callback, +Local MakeCallback(Isolate* isolate, + Local recv, + Local callback, int argc, - Handle argv[]) { + Local argv[]) { EscapableHandleScope handle_scope(isolate); Local context = recv->CreationContext(); Environment* env = Environment::GetCurrent(context); @@ -1225,7 +1224,7 @@ enum encoding ParseEncoding(const char* encoding, enum encoding ParseEncoding(Isolate* isolate, - Handle encoding_v, + Local encoding_v, enum encoding default_encoding) { if (!encoding_v->IsString()) return default_encoding; @@ -1249,7 +1248,7 @@ Local Encode(Isolate* isolate, const uint16_t* buf, size_t len) { // Returns -1 if the handle was not valid for decoding ssize_t DecodeBytes(Isolate* isolate, - Handle val, + Local val, enum encoding encoding) { HandleScope scope(isolate); @@ -1267,14 +1266,14 @@ ssize_t DecodeBytes(Isolate* isolate, ssize_t DecodeWrite(Isolate* isolate, char* buf, size_t buflen, - Handle val, + Local val, enum encoding encoding) { return StringBytes::Write(isolate, buf, buflen, val, encoding, nullptr); } void AppendExceptionLine(Environment* env, - Handle er, - Handle message) { + Local er, + Local message) { if (message.IsEmpty()) return; @@ -1373,8 +1372,8 @@ void AppendExceptionLine(Environment* env, static void ReportException(Environment* env, - Handle er, - Handle message) { + Local er, + Local message) { HandleScope scope(env->isolate()); AppendExceptionLine(env, er, message); @@ -1449,8 +1448,8 @@ static void ReportException(Environment* env, const TryCatch& try_catch) { // Executes a str within the current v8 context. static Local ExecuteString(Environment* env, - Handle source, - Handle filename) { + Local source, + Local filename) { EscapableHandleScope scope(env->isolate()); TryCatch try_catch; @@ -1673,7 +1672,7 @@ static const char* name_by_gid(gid_t gid) { #endif -static uid_t uid_by_name(Isolate* isolate, Handle value) { +static uid_t uid_by_name(Isolate* isolate, Local value) { if (value->IsUint32()) { return static_cast(value->Uint32Value()); } else { @@ -1683,7 +1682,7 @@ static uid_t uid_by_name(Isolate* isolate, Handle value) { } -static gid_t gid_by_name(Isolate* isolate, Handle value) { +static gid_t gid_by_name(Isolate* isolate, Local value) { if (value->IsUint32()) { return static_cast(value->Uint32Value()); } else { @@ -2040,7 +2039,7 @@ struct node_module* get_linked_module(const char* name) { return mp; } -typedef void (UV_DYNAMIC* extInit)(Handle exports); +typedef void (UV_DYNAMIC* extInit)(Local exports); // DLOpen is process.dlopen(module, filename). // Used to load 'module.node' dynamically shared objects. @@ -2142,8 +2141,8 @@ NO_RETURN void FatalError(const char* location, const char* message) { void FatalException(Isolate* isolate, - Handle error, - Handle message) { + Local error, + Local message) { HandleScope scope(isolate); Environment* env = Environment::GetCurrent(isolate); @@ -2189,7 +2188,7 @@ void FatalException(Isolate* isolate, const TryCatch& try_catch) { } -void OnMessage(Handle message, Handle error) { +void OnMessage(Local message, Local error) { // The current version of V8 sends messages for errors only // (thus `error` is always set). FatalException(Isolate::GetCurrent(), error, message); @@ -2458,7 +2457,7 @@ static void EnvEnumerator(const PropertyCallbackInfo& info) { } -static Handle GetFeatures(Environment* env) { +static Local GetFeatures(Environment* env) { EscapableHandleScope scope(env->isolate()); Local obj = Object::New(env->isolate()); @@ -3742,7 +3741,7 @@ int EmitExit(Environment* env) { Local process_object = env->process_object(); process_object->Set(env->exiting_string(), True(env->isolate())); - Handle exitCode = env->exit_code_string(); + Local exitCode = env->exit_code_string(); int code = process_object->Get(exitCode)->Int32Value(); Local args[] = { @@ -3759,7 +3758,7 @@ int EmitExit(Environment* env) { // Just a convenience method Environment* CreateEnvironment(Isolate* isolate, - Handle context, + Local context, int argc, const char* const* argv, int exec_argc, @@ -3781,7 +3780,7 @@ Environment* CreateEnvironment(Isolate* isolate, } static Environment* CreateEnvironment(Isolate* isolate, - Handle context, + Local context, NodeInstanceData* instance_data) { return CreateEnvironment(isolate, instance_data->event_loop(), @@ -3809,7 +3808,7 @@ static void HandleCleanup(Environment* env, Environment* CreateEnvironment(Isolate* isolate, uv_loop_t* loop, - Handle context, + Local context, int argc, const char* const* argv, int exec_argc, diff --git a/src/node.h b/src/node.h index 4d85514366..b5941ff06b 100644 --- a/src/node.h +++ b/src/node.h @@ -131,24 +131,24 @@ inline v8::Local UVException(int errorno, * cb, you will appear to leak 4-bytes for every invocation. Take heed. */ -NODE_EXTERN v8::Handle MakeCallback( +NODE_EXTERN v8::Local MakeCallback( v8::Isolate* isolate, - v8::Handle recv, + v8::Local recv, const char* method, int argc, - v8::Handle* argv); -NODE_EXTERN v8::Handle MakeCallback( + v8::Local* argv); +NODE_EXTERN v8::Local MakeCallback( v8::Isolate* isolate, - v8::Handle recv, - v8::Handle symbol, + v8::Local recv, + v8::Local symbol, int argc, - v8::Handle* argv); -NODE_EXTERN v8::Handle MakeCallback( + v8::Local* argv); +NODE_EXTERN v8::Local MakeCallback( v8::Isolate* isolate, - v8::Handle recv, - v8::Handle callback, + v8::Local recv, + v8::Local callback, int argc, - v8::Handle* argv); + v8::Local* argv); } // namespace node @@ -190,7 +190,7 @@ class Environment; NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate, struct uv_loop_s* loop, - v8::Handle context, + v8::Local context, int argc, const char* const* argv, int exec_argc, @@ -201,7 +201,7 @@ NODE_EXTERN void LoadEnvironment(Environment* env); // CreateEnvironment() + LoadEnvironment() from above. // `uv_default_loop()` will be passed as `loop`. NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate, - v8::Handle context, + v8::Local context, int argc, const char* const* argv, int exec_argc, @@ -249,14 +249,14 @@ inline void NODE_SET_METHOD(const TypeName& recv, // Used to be a macro, hence the uppercase name. // Not a template because it only makes sense for FunctionTemplates. -inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle recv, +inline void NODE_SET_PROTOTYPE_METHOD(v8::Local recv, const char* name, v8::FunctionCallback callback) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::HandleScope handle_scope(isolate); - v8::Handle s = v8::Signature::New(isolate, recv); + v8::Local s = v8::Signature::New(isolate, recv); v8::Local t = - v8::FunctionTemplate::New(isolate, callback, v8::Handle(), s); + v8::FunctionTemplate::New(isolate, callback, v8::Local(), s); v8::Local fn = t->GetFunction(); recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), fn); v8::Local fn_name = v8::String::NewFromUtf8(isolate, name); @@ -267,11 +267,11 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle recv, enum encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; NODE_EXTERN enum encoding ParseEncoding( v8::Isolate* isolate, - v8::Handle encoding_v, + v8::Local encoding_v, enum encoding default_encoding = BINARY); NODE_DEPRECATED("Use ParseEncoding(isolate, ...)", inline enum encoding ParseEncoding( - v8::Handle encoding_v, + v8::Local encoding_v, enum encoding default_encoding = BINARY) { return ParseEncoding(v8::Isolate::GetCurrent(), encoding_v, default_encoding); }) @@ -312,11 +312,11 @@ NODE_DEPRECATED("Use Encode(isolate, ...)", // Returns -1 if the handle was not valid for decoding NODE_EXTERN ssize_t DecodeBytes(v8::Isolate* isolate, - v8::Handle, + v8::Local, enum encoding encoding = BINARY); NODE_DEPRECATED("Use DecodeBytes(isolate, ...)", inline ssize_t DecodeBytes( - v8::Handle val, + v8::Local val, enum encoding encoding = BINARY) { return DecodeBytes(v8::Isolate::GetCurrent(), val, encoding); }) @@ -325,12 +325,12 @@ NODE_DEPRECATED("Use DecodeBytes(isolate, ...)", NODE_EXTERN ssize_t DecodeWrite(v8::Isolate* isolate, char* buf, size_t buflen, - v8::Handle, + v8::Local, enum encoding encoding = BINARY); NODE_DEPRECATED("Use DecodeWrite(isolate, ...)", inline ssize_t DecodeWrite(char* buf, size_t buflen, - v8::Handle val, + v8::Local val, enum encoding encoding = BINARY) { return DecodeWrite(v8::Isolate::GetCurrent(), buf, buflen, val, encoding); }) @@ -359,14 +359,14 @@ const char *signo_string(int errorno); typedef void (*addon_register_func)( - v8::Handle exports, - v8::Handle module, + v8::Local exports, + v8::Local module, void* priv); typedef void (*addon_context_register_func)( - v8::Handle exports, - v8::Handle module, - v8::Handle context, + v8::Local exports, + v8::Local module, + v8::Local context, void* priv); #define NM_F_BUILTIN 0x01 diff --git a/src/node_buffer.cc b/src/node_buffer.cc index 3eceae5946..878c6c5e00 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -57,7 +57,6 @@ using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; @@ -78,7 +77,7 @@ class CallbackInfo { public: static inline void Free(char* data, void* hint); static inline CallbackInfo* New(Isolate* isolate, - Handle object, + Local object, FreeCallback callback, void* hint = 0); inline void Dispose(Isolate* isolate); @@ -87,7 +86,7 @@ class CallbackInfo { static void WeakCallback(const WeakCallbackData&); inline void WeakCallback(Isolate* isolate, Local object); inline CallbackInfo(Isolate* isolate, - Handle object, + Local object, FreeCallback callback, void* hint); ~CallbackInfo(); @@ -104,7 +103,7 @@ void CallbackInfo::Free(char* data, void*) { CallbackInfo* CallbackInfo::New(Isolate* isolate, - Handle object, + Local object, FreeCallback callback, void* hint) { return new CallbackInfo(isolate, object, callback, hint); @@ -122,7 +121,7 @@ Persistent* CallbackInfo::persistent() { CallbackInfo::CallbackInfo(Isolate* isolate, - Handle object, + Local object, FreeCallback callback, void* hint) : persistent_(isolate, object), @@ -162,12 +161,12 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local object) { // Buffer methods -bool HasInstance(Handle val) { +bool HasInstance(Local val) { return val->IsObject() && HasInstance(val.As()); } -bool HasInstance(Handle obj) { +bool HasInstance(Local obj) { if (!obj->IsUint8Array()) return false; Local array = obj.As(); @@ -176,7 +175,7 @@ bool HasInstance(Handle obj) { } -char* Data(Handle val) { +char* Data(Local val) { CHECK(val->IsObject()); // Use a fully qualified name here to work around a bug in gcc 4.2. // It mistakes an unadorned call to Data() for the v8::String::Data type. @@ -184,7 +183,7 @@ char* Data(Handle val) { } -char* Data(Handle obj) { +char* Data(Local obj) { CHECK(obj->IsUint8Array()); Local ui = obj.As(); ArrayBuffer::Contents ab_c = ui->Buffer()->GetContents(); @@ -192,13 +191,13 @@ char* Data(Handle obj) { } -size_t Length(Handle val) { +size_t Length(Local val) { CHECK(val->IsObject()); return Length(val.As()); } -size_t Length(Handle obj) { +size_t Length(Local obj) { CHECK(obj->IsUint8Array()); Local ui = obj.As(); return ui->ByteLength(); @@ -993,9 +992,9 @@ void SetupBufferJS(const FunctionCallbackInfo& args) { } -void Initialize(Handle target, - Handle unused, - Handle context) { +void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "setupBufferJS", SetupBufferJS); diff --git a/src/node_buffer.h b/src/node_buffer.h index 49fb574164..503cbb1675 100644 --- a/src/node_buffer.h +++ b/src/node_buffer.h @@ -12,12 +12,12 @@ static const unsigned int kMaxLength = NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint); -NODE_EXTERN bool HasInstance(v8::Handle val); -NODE_EXTERN bool HasInstance(v8::Handle val); -NODE_EXTERN char* Data(v8::Handle val); -NODE_EXTERN char* Data(v8::Handle val); -NODE_EXTERN size_t Length(v8::Handle val); -NODE_EXTERN size_t Length(v8::Handle val); +NODE_EXTERN bool HasInstance(v8::Local val); +NODE_EXTERN bool HasInstance(v8::Local val); +NODE_EXTERN char* Data(v8::Local val); +NODE_EXTERN char* Data(v8::Local val); +NODE_EXTERN size_t Length(v8::Local val); +NODE_EXTERN size_t Length(v8::Local val); // public constructor - data is copied NODE_EXTERN v8::MaybeLocal Copy(v8::Isolate* isolate, @@ -29,7 +29,7 @@ NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, size_t length); // public constructor from string NODE_EXTERN v8::MaybeLocal New(v8::Isolate* isolate, - v8::Handle string, + v8::Local string, enum encoding enc = UTF8); // public constructor - data is used, callback is passed data on object gc diff --git a/src/node_constants.cc b/src/node_constants.cc index 59dd11113e..51c2ee814a 100644 --- a/src/node_constants.cc +++ b/src/node_constants.cc @@ -21,14 +21,14 @@ namespace node { -using v8::Handle; +using v8::Local; using v8::Object; #if HAVE_OPENSSL const char* default_cipher_list = DEFAULT_CIPHER_LIST_CORE; #endif -void DefineErrnoConstants(Handle target) { +void DefineErrnoConstants(Local target) { #ifdef E2BIG NODE_DEFINE_CONSTANT(target, E2BIG); #endif @@ -346,7 +346,7 @@ void DefineErrnoConstants(Handle target) { #endif } -void DefineWindowsErrorConstants(Handle target) { +void DefineWindowsErrorConstants(Local target) { #ifdef WSAEINTR NODE_DEFINE_CONSTANT(target, WSAEINTR); #endif @@ -580,7 +580,7 @@ void DefineWindowsErrorConstants(Handle target) { #endif } -void DefineSignalConstants(Handle target) { +void DefineSignalConstants(Local target) { #ifdef SIGHUP NODE_DEFINE_CONSTANT(target, SIGHUP); #endif @@ -725,7 +725,7 @@ void DefineSignalConstants(Handle target) { #endif } -void DefineOpenSSLConstants(Handle target) { +void DefineOpenSSLConstants(Local target) { #ifdef SSL_OP_ALL NODE_DEFINE_CONSTANT(target, SSL_OP_ALL); #endif @@ -969,7 +969,7 @@ void DefineOpenSSLConstants(Handle target) { #endif } -void DefineSystemConstants(Handle target) { +void DefineSystemConstants(Local target) { // file access modes NODE_DEFINE_CONSTANT(target, O_RDONLY); NODE_DEFINE_CONSTANT(target, O_WRONLY); @@ -1108,11 +1108,11 @@ void DefineSystemConstants(Handle target) { #endif } -void DefineUVConstants(Handle target) { +void DefineUVConstants(Local target) { NODE_DEFINE_CONSTANT(target, UV_UDP_REUSEADDR); } -void DefineCryptoConstants(Handle target) { +void DefineCryptoConstants(Local target) { #if HAVE_OPENSSL NODE_DEFINE_STRING_CONSTANT(target, "defaultCoreCipherList", @@ -1123,7 +1123,7 @@ void DefineCryptoConstants(Handle target) { #endif } -void DefineConstants(Handle target) { +void DefineConstants(Local target) { DefineErrnoConstants(target); DefineWindowsErrorConstants(target); DefineSignalConstants(target); diff --git a/src/node_constants.h b/src/node_constants.h index 45c991022e..a7c75c4eb2 100644 --- a/src/node_constants.h +++ b/src/node_constants.h @@ -34,7 +34,7 @@ namespace node { extern const char* default_cipher_list; #endif -void DefineConstants(v8::Handle target); +void DefineConstants(v8::Local target); } // namespace node #endif // SRC_NODE_CONSTANTS_H_ diff --git a/src/node_contextify.cc b/src/node_contextify.cc index 16fc91836c..6520355239 100644 --- a/src/node_contextify.cc +++ b/src/node_contextify.cc @@ -21,7 +21,6 @@ using v8::External; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; @@ -189,7 +188,7 @@ class ContextifyContext { Local wrapper = env->script_data_constructor_function()->NewInstance(); if (wrapper.IsEmpty()) - return scope.Escape(Local::New(env->isolate(), Handle())); + return scope.Escape(Local::New(env->isolate(), Local())); Wrap(wrapper, this); return scope.Escape(wrapper); @@ -732,9 +731,9 @@ class ContextifyScript : public BaseObject { }; -void InitContextify(Handle target, - Handle unused, - Handle context) { +void InitContextify(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); ContextifyContext::Init(env, target); ContextifyScript::Init(env, target); diff --git a/src/node_counters.cc b/src/node_counters.cc index 4e2cc0a5c2..ca05e25319 100644 --- a/src/node_counters.cc +++ b/src/node_counters.cc @@ -14,7 +14,6 @@ using v8::GCCallbackFlags; using v8::GCEpilogueCallback; using v8::GCPrologueCallback; using v8::GCType; -using v8::Handle; using v8::HandleScope; using v8::Isolate; using v8::Local; @@ -82,7 +81,7 @@ static void counter_gc_done(Isolate* isolate, } -void InitPerfCounters(Environment* env, Handle target) { +void InitPerfCounters(Environment* env, Local target) { HandleScope scope(env->isolate()); static struct { @@ -118,7 +117,7 @@ void InitPerfCounters(Environment* env, Handle target) { } -void TermPerfCounters(Handle target) { +void TermPerfCounters(Local target) { // Only Windows performance counters supported // To enable other OS, use conditional compilation here TermPerfCountersWin32(); diff --git a/src/node_counters.h b/src/node_counters.h index 78dd949199..8c93b34f1f 100644 --- a/src/node_counters.h +++ b/src/node_counters.h @@ -26,8 +26,8 @@ namespace node { -void InitPerfCounters(Environment* env, v8::Handle target); -void TermPerfCounters(v8::Handle target); +void InitPerfCounters(Environment* env, v8::Local target); +void TermPerfCounters(v8::Local target); } // namespace node diff --git a/src/node_crypto.cc b/src/node_crypto.cc index eab0e0ef92..bf1f369d2b 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -72,7 +72,6 @@ using v8::External; using v8::False; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; @@ -135,7 +134,7 @@ X509_STORE* root_cert_store; // Just to generate static methods template class SSLWrap; template void SSLWrap::AddMethods(Environment* env, - Handle t); + Local t); template void SSLWrap::InitNPN(SecureContext* sc); template SSL_SESSION* SSLWrap::GetSessionCallback( SSL* s, @@ -276,7 +275,7 @@ bool EntropySource(unsigned char* buffer, size_t length) { } -void SecureContext::Initialize(Environment* env, Handle target) { +void SecureContext::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(SecureContext::New); t->InstanceTemplate()->SetInternalFieldCount(1); t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "SecureContext")); @@ -415,7 +414,7 @@ void SecureContext::Init(const FunctionCallbackInfo& args) { // Takes a string or buffer and loads it into a BIO. // Caller responsible for BIO_free_all-ing the returned object. -static BIO* LoadBIO(Environment* env, Handle v) { +static BIO* LoadBIO(Environment* env, Local v) { BIO* bio = NodeBIO::New(); if (!bio) return nullptr; @@ -444,7 +443,7 @@ static BIO* LoadBIO(Environment* env, Handle v) { // Takes a string or buffer and loads it into an X509 // Caller responsible for X509_free-ing the returned object. -static X509* LoadX509(Environment* env, Handle v) { +static X509* LoadX509(Environment* env, Local v) { HandleScope scope(env->isolate()); BIO *bio = LoadBIO(env, v); @@ -1122,7 +1121,7 @@ void SecureContext::GetCertificate(const FunctionCallbackInfo& args) { template -void SSLWrap::AddMethods(Environment* env, Handle t) { +void SSLWrap::AddMethods(Environment* env, Local t) { HandleScope scope(env->isolate()); env->SetProtoMethod(t, "getPeerCertificate", GetPeerCertificate); @@ -1914,7 +1913,7 @@ int SSLWrap::SelectNextProtoCallback(SSL* s, size_t len = Buffer::Length(obj); int status = SSL_select_next_proto(out, outlen, in, inlen, npn_protos, len); - Handle result; + Local result; switch (status) { case OPENSSL_NPN_UNSUPPORTED: result = Null(env->isolate()); @@ -2326,7 +2325,7 @@ void Connection::NewSessionDoneCb() { } -void Connection::Initialize(Environment* env, Handle target) { +void Connection::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(Connection::New); t->InstanceTemplate()->SetInternalFieldCount(1); t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Connection")); @@ -2841,7 +2840,7 @@ void Connection::SetSNICallback(const FunctionCallbackInfo& args) { #endif -void CipherBase::Initialize(Environment* env, Handle target) { +void CipherBase::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3212,7 +3211,7 @@ void CipherBase::Final(const FunctionCallbackInfo& args) { } -void Hmac::Initialize(Environment* env, v8::Handle target) { +void Hmac::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3341,7 +3340,7 @@ void Hmac::HmacDigest(const FunctionCallbackInfo& args) { } -void Hash::Initialize(Environment* env, v8::Handle target) { +void Hash::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3486,7 +3485,7 @@ void SignBase::CheckThrow(SignBase::Error error) { -void Sign::Initialize(Environment* env, v8::Handle target) { +void Sign::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -3662,7 +3661,7 @@ void Sign::SignFinal(const FunctionCallbackInfo& args) { } -void Verify::Initialize(Environment* env, v8::Handle target) { +void Verify::Initialize(Environment* env, v8::Local target) { Local t = env->NewFunctionTemplate(New); t->InstanceTemplate()->SetInternalFieldCount(1); @@ -4006,7 +4005,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo& args) { } -void DiffieHellman::Initialize(Environment* env, Handle target) { +void DiffieHellman::Initialize(Environment* env, Local target) { Local t = env->NewFunctionTemplate(New); const PropertyAttribute attributes = @@ -4392,7 +4391,7 @@ bool DiffieHellman::VerifyContext() { } -void ECDH::Initialize(Environment* env, Handle target) { +void ECDH::Initialize(Environment* env, Local target) { HandleScope scope(env->isolate()); Local t = env->NewFunctionTemplate(New); @@ -5133,7 +5132,7 @@ void GetCurves(const FunctionCallbackInfo& args) { } -void Certificate::Initialize(Environment* env, Handle target) { +void Certificate::Initialize(Environment* env, Local target) { HandleScope scope(env->isolate()); Local t = env->NewFunctionTemplate(New); @@ -5399,9 +5398,9 @@ void SetEngine(const FunctionCallbackInfo& args) { // FIXME(bnoordhuis) Handle global init correctly. -void InitCrypto(Handle target, - Handle unused, - Handle context, +void InitCrypto(Local target, + Local unused, + Local context, void* priv) { static uv_once_t init_once = UV_ONCE_INIT; uv_once(&init_once, InitCryptoOnce); diff --git a/src/node_crypto.h b/src/node_crypto.h index edacaa1b00..3bec02c38e 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -59,7 +59,7 @@ class SecureContext : public BaseObject { FreeCTXMem(); } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); X509_STORE* ca_store_; SSL_CTX* ctx_; @@ -209,7 +209,7 @@ class SSLWrap { sizeof(SSL) + sizeof(SSL3_STATE) + 42 * 1024; static void InitNPN(SecureContext* sc); - static void AddMethods(Environment* env, v8::Handle t); + static void AddMethods(Environment* env, v8::Local t); static SSL_SESSION* GetSessionCallback(SSL* s, unsigned char* key, @@ -311,7 +311,7 @@ class Connection : public SSLWrap, public AsyncWrap { #endif } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); void NewSessionDoneCb(); #ifdef OPENSSL_NPN_NEGOTIATED @@ -401,7 +401,7 @@ class CipherBase : public BaseObject { EVP_CIPHER_CTX_cleanup(&ctx_); } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); protected: enum CipherKind { @@ -464,7 +464,7 @@ class Hmac : public BaseObject { HMAC_CTX_cleanup(&ctx_); } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); protected: void HmacInit(const char* hash_type, const char* key, int key_len); @@ -497,7 +497,7 @@ class Hash : public BaseObject { EVP_MD_CTX_cleanup(&mdctx_); } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); bool HashInit(const char* hash_type); bool HashUpdate(const char* data, int len); @@ -555,7 +555,7 @@ class SignBase : public BaseObject { class Sign : public SignBase { public: - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); Error SignInit(const char* sign_type); Error SignUpdate(const char* data, int len); @@ -578,7 +578,7 @@ class Sign : public SignBase { class Verify : public SignBase { public: - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); Error VerifyInit(const char* verify_type); Error VerifyUpdate(const char* data, int len); @@ -637,7 +637,7 @@ class DiffieHellman : public BaseObject { } } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); bool Init(int primeLength, int g); bool Init(const char* p, int p_len, int g); @@ -684,7 +684,7 @@ class ECDH : public BaseObject { group_ = nullptr; } - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); protected: ECDH(Environment* env, v8::Local wrap, EC_KEY* key) @@ -713,9 +713,9 @@ class ECDH : public BaseObject { class Certificate : public AsyncWrap { public: - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); - v8::Handle CertificateInit(const char* sign_type); + v8::Local CertificateInit(const char* sign_type); bool VerifySpkac(const char* data, unsigned int len); const char* ExportPublicKey(const char* data, int len); const char* ExportChallenge(const char* data, int len); @@ -738,7 +738,7 @@ bool EntropySource(unsigned char* buffer, size_t length); #ifndef OPENSSL_NO_ENGINE void SetEngine(const v8::FunctionCallbackInfo& args); #endif // !OPENSSL_NO_ENGINE -void InitCrypto(v8::Handle target); +void InitCrypto(v8::Local target); } // namespace crypto } // namespace node diff --git a/src/node_dtrace.cc b/src/node_dtrace.cc index d82e0f7dcb..568972bab3 100644 --- a/src/node_dtrace.cc +++ b/src/node_dtrace.cc @@ -37,7 +37,6 @@ using v8::GCCallbackFlags; using v8::GCEpilogueCallback; using v8::GCPrologueCallback; using v8::GCType; -using v8::Handle; using v8::HandleScope; using v8::Isolate; using v8::Local; @@ -241,7 +240,7 @@ void dtrace_gc_done(Isolate* isolate, GCType type, GCCallbackFlags flags) { } -void InitDTrace(Environment* env, Handle target) { +void InitDTrace(Environment* env, Local target) { HandleScope scope(env->isolate()); static struct { diff --git a/src/node_dtrace.h b/src/node_dtrace.h index fad453b1ec..9243d02f5a 100644 --- a/src/node_dtrace.h +++ b/src/node_dtrace.h @@ -54,7 +54,7 @@ typedef struct { namespace node { -void InitDTrace(Environment* env, v8::Handle target); +void InitDTrace(Environment* env, v8::Local target); } // namespace node diff --git a/src/node_file.cc b/src/node_file.cc index f10b99e94b..e1fb1ce4f3 100644 --- a/src/node_file.cc +++ b/src/node_file.cc @@ -32,7 +32,6 @@ using v8::EscapableHandleScope; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -1218,9 +1217,9 @@ void FSInitialize(const FunctionCallbackInfo& args) { env->set_fs_stats_constructor_function(stats_constructor); } -void InitFs(Handle target, - Handle unused, - Handle context, +void InitFs(Local target, + Local unused, + Local context, void* priv) { Environment* env = Environment::GetCurrent(context); diff --git a/src/node_file.h b/src/node_file.h index f242ee4f4f..8192ed9c2f 100644 --- a/src/node_file.h +++ b/src/node_file.h @@ -6,7 +6,7 @@ namespace node { -void InitFs(v8::Handle target); +void InitFs(v8::Local target); } // namespace node diff --git a/src/node_http_parser.cc b/src/node_http_parser.cc index 665ce285be..21be19eb84 100644 --- a/src/node_http_parser.cc +++ b/src/node_http_parser.cc @@ -43,7 +43,6 @@ using v8::Exception; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -687,9 +686,9 @@ const struct http_parser_settings Parser::settings = { }; -void InitHttpParser(Handle target, - Handle unused, - Handle context, +void InitHttpParser(Local target, + Local unused, + Local context, void* priv) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(Parser::New); diff --git a/src/node_http_parser.h b/src/node_http_parser.h index 6fd8b76c6c..9b49d4d99e 100644 --- a/src/node_http_parser.h +++ b/src/node_http_parser.h @@ -7,7 +7,7 @@ namespace node { -void InitHttpParser(v8::Handle target); +void InitHttpParser(v8::Local target); } // namespace node diff --git a/src/node_internals.h b/src/node_internals.h index 5ea4e0b9bd..1fb58c9274 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -42,32 +42,32 @@ inline v8::Local PersistentToLocal( const v8::Persistent& persistent); // Call with valid HandleScope and while inside Context scope. -v8::Handle MakeCallback(Environment* env, - v8::Handle recv, +v8::Local MakeCallback(Environment* env, + v8::Local recv, const char* method, int argc = 0, - v8::Handle* argv = nullptr); + v8::Local* argv = nullptr); // Call with valid HandleScope and while inside Context scope. -v8::Handle MakeCallback(Environment* env, - v8::Handle recv, +v8::Local MakeCallback(Environment* env, + v8::Local recv, uint32_t index, int argc = 0, - v8::Handle* argv = nullptr); + v8::Local* argv = nullptr); // Call with valid HandleScope and while inside Context scope. -v8::Handle MakeCallback(Environment* env, - v8::Handle recv, - v8::Handle symbol, +v8::Local MakeCallback(Environment* env, + v8::Local recv, + v8::Local symbol, int argc = 0, - v8::Handle* argv = nullptr); + v8::Local* argv = nullptr); // Call with valid HandleScope and while inside Context scope. -v8::Handle MakeCallback(Environment* env, - v8::Handle recv, - v8::Handle callback, +v8::Local MakeCallback(Environment* env, + v8::Local recv, + v8::Local callback, int argc = 0, - v8::Handle* argv = nullptr); + v8::Local* argv = nullptr); bool KickNextTick(); @@ -77,7 +77,7 @@ bool KickNextTick(); v8::Local AddressToJS( Environment* env, const sockaddr* addr, - v8::Local info = v8::Handle()); + v8::Local info = v8::Local()); template void GetSockOrPeerName(const v8::FunctionCallbackInfo& args) { @@ -130,8 +130,8 @@ inline static int snprintf(char* buf, unsigned int len, const char* fmt, ...) { #endif void AppendExceptionLine(Environment* env, - v8::Handle er, - v8::Handle message); + v8::Local er, + v8::Local message); NO_RETURN void FatalError(const char* location, const char* message); @@ -162,7 +162,7 @@ inline bool IsBigEndian() { } // parse index for external array data -inline MUST_USE_RESULT bool ParseArrayIndex(v8::Handle arg, +inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local arg, size_t def, size_t* ret) { if (arg->IsUndefined()) { diff --git a/src/node_javascript.cc b/src/node_javascript.cc index bd94a645cf..e8dc4ac4ea 100644 --- a/src/node_javascript.cc +++ b/src/node_javascript.cc @@ -11,23 +11,22 @@ namespace node { -using v8::Handle; using v8::HandleScope; using v8::Local; using v8::Object; using v8::String; -Handle MainSource(Environment* env) { +Local MainSource(Environment* env) { return OneByteString(env->isolate(), node_native, sizeof(node_native) - 1); } -void DefineJavaScript(Environment* env, Handle target) { +void DefineJavaScript(Environment* env, Local target) { HandleScope scope(env->isolate()); for (int i = 0; natives[i].name; i++) { if (natives[i].source != node_native) { Local name = String::NewFromUtf8(env->isolate(), natives[i].name); - Handle source = String::NewFromUtf8(env->isolate(), + Local source = String::NewFromUtf8(env->isolate(), natives[i].source, String::kNormalString, natives[i].source_len); diff --git a/src/node_javascript.h b/src/node_javascript.h index 247c3b8c2b..1de6611b31 100644 --- a/src/node_javascript.h +++ b/src/node_javascript.h @@ -6,8 +6,8 @@ namespace node { -void DefineJavaScript(Environment* env, v8::Handle target); -v8::Handle MainSource(Environment* env); +void DefineJavaScript(Environment* env, v8::Local target); +v8::Local MainSource(Environment* env); } // namespace node diff --git a/src/node_lttng.cc b/src/node_lttng.cc index 0c63882c79..876bcda92f 100644 --- a/src/node_lttng.cc +++ b/src/node_lttng.cc @@ -32,7 +32,6 @@ using v8::GCCallbackFlags; using v8::GCEpilogueCallback; using v8::GCPrologueCallback; using v8::GCType; -using v8::Handle; using v8::HandleScope; using v8::Isolate; using v8::Local; @@ -234,7 +233,7 @@ void lttng_gc_done(Isolate* isolate, GCType type, GCCallbackFlags flags) { NODE_GC_DONE(type, flags, isolate); } -void InitLTTNG(Environment* env, Handle target) { +void InitLTTNG(Environment* env, Local target) { HandleScope scope(env->isolate()); static struct { diff --git a/src/node_lttng.h b/src/node_lttng.h index 31f706f758..4e4147438f 100644 --- a/src/node_lttng.h +++ b/src/node_lttng.h @@ -33,7 +33,7 @@ typedef struct { namespace node { -void InitLTTNG(Environment* env, v8::Handle target); +void InitLTTNG(Environment* env, v8::Local target); } // namespace node diff --git a/src/node_object_wrap.h b/src/node_object_wrap.h index f022662227..2d67bc1db6 100644 --- a/src/node_object_wrap.h +++ b/src/node_object_wrap.h @@ -24,7 +24,7 @@ class ObjectWrap { template - static inline T* Unwrap(v8::Handle handle) { + static inline T* Unwrap(v8::Local handle) { assert(!handle.IsEmpty()); assert(handle->InternalFieldCount() > 0); // Cast to ObjectWrap before casting to T. A direct cast from void @@ -51,7 +51,7 @@ class ObjectWrap { protected: - inline void Wrap(v8::Handle handle) { + inline void Wrap(v8::Local handle) { assert(persistent().IsEmpty()); assert(handle->InternalFieldCount() > 0); handle->SetAlignedPointerInInternalField(0, this); diff --git a/src/node_os.cc b/src/node_os.cc index 3abc7ccec1..a100090748 100644 --- a/src/node_os.cc +++ b/src/node_os.cc @@ -30,7 +30,6 @@ using v8::Array; using v8::Boolean; using v8::Context; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::Integer; using v8::Local; using v8::Number; @@ -291,9 +290,9 @@ static void GetHomeDirectory(const FunctionCallbackInfo& args) { } -void Initialize(Handle target, - Handle unused, - Handle context) { +void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "getHostname", GetHostname); env->SetMethod(target, "getLoadAvg", GetLoadAvg); diff --git a/src/node_stat_watcher.cc b/src/node_stat_watcher.cc index 8d27cbc9eb..bd1cb73248 100644 --- a/src/node_stat_watcher.cc +++ b/src/node_stat_watcher.cc @@ -14,7 +14,6 @@ namespace node { using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -22,7 +21,7 @@ using v8::Object; using v8::Value; -void StatWatcher::Initialize(Environment* env, Handle target) { +void StatWatcher::Initialize(Environment* env, Local target) { HandleScope scope(env->isolate()); Local t = env->NewFunctionTemplate(StatWatcher::New); diff --git a/src/node_stat_watcher.h b/src/node_stat_watcher.h index e0ef76601f..bc7929880b 100644 --- a/src/node_stat_watcher.h +++ b/src/node_stat_watcher.h @@ -13,7 +13,7 @@ class StatWatcher : public AsyncWrap { public: virtual ~StatWatcher() override; - static void Initialize(Environment* env, v8::Handle target); + static void Initialize(Environment* env, v8::Local target); protected: StatWatcher(Environment* env, v8::Local wrap); diff --git a/src/node_v8.cc b/src/node_v8.cc index db492e3d1a..9f456daec4 100644 --- a/src/node_v8.cc +++ b/src/node_v8.cc @@ -11,7 +11,6 @@ using v8::ArrayBuffer; using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HeapStatistics; using v8::Isolate; using v8::Local; @@ -59,9 +58,9 @@ void SetFlagsFromString(const FunctionCallbackInfo& args) { } -void InitializeV8Bindings(Handle target, - Handle unused, - Handle context) { +void InitializeV8Bindings(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "updateHeapStatisticsArrayBuffer", diff --git a/src/node_zlib.cc b/src/node_zlib.cc index 699d5c453c..50c7a906a6 100644 --- a/src/node_zlib.cc +++ b/src/node_zlib.cc @@ -22,7 +22,6 @@ using v8::Array; using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -43,7 +42,7 @@ enum node_zlib_mode { }; -void InitZlib(v8::Handle target); +void InitZlib(v8::Local target); /** @@ -573,9 +572,9 @@ class ZCtx : public AsyncWrap { }; -void InitZlib(Handle target, - Handle unused, - Handle context, +void InitZlib(Local target, + Local unused, + Local context, void* priv) { Environment* env = Environment::GetCurrent(context); Local z = env->NewFunctionTemplate(ZCtx::New); diff --git a/src/pipe_wrap.cc b/src/pipe_wrap.cc index 2e1ab5b262..62bfe0a92e 100644 --- a/src/pipe_wrap.cc +++ b/src/pipe_wrap.cc @@ -22,7 +22,6 @@ using v8::External; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -70,9 +69,9 @@ Local PipeWrap::Instantiate(Environment* env, AsyncWrap* parent) { } -void PipeWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void PipeWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); @@ -123,7 +122,7 @@ void PipeWrap::New(const FunctionCallbackInfo& args) { PipeWrap::PipeWrap(Environment* env, - Handle object, + Local object, bool ipc, AsyncWrap* parent) : StreamWrap(env, diff --git a/src/pipe_wrap.h b/src/pipe_wrap.h index 6c74de984b..eb3d18b80d 100644 --- a/src/pipe_wrap.h +++ b/src/pipe_wrap.h @@ -12,15 +12,15 @@ class PipeWrap : public StreamWrap { uv_pipe_t* UVHandle(); static v8::Local Instantiate(Environment* env, AsyncWrap* parent); - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); size_t self_size() const override { return sizeof(*this); } private: PipeWrap(Environment* env, - v8::Handle object, + v8::Local object, bool ipc, AsyncWrap* parent); diff --git a/src/process_wrap.cc b/src/process_wrap.cc index 14bbb9c9e9..adf1606591 100644 --- a/src/process_wrap.cc +++ b/src/process_wrap.cc @@ -15,7 +15,6 @@ using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -26,9 +25,9 @@ using v8::Value; class ProcessWrap : public HandleWrap { public: - static void Initialize(Handle target, - Handle unused, - Handle context) { + static void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount(1); @@ -58,7 +57,7 @@ class ProcessWrap : public HandleWrap { new ProcessWrap(env, args.This()); } - ProcessWrap(Environment* env, Handle object) + ProcessWrap(Environment* env, Local object) : HandleWrap(env, object, reinterpret_cast(&process_), diff --git a/src/req-wrap-inl.h b/src/req-wrap-inl.h index 78c6735302..63229260ec 100644 --- a/src/req-wrap-inl.h +++ b/src/req-wrap-inl.h @@ -13,7 +13,7 @@ namespace node { template ReqWrap::ReqWrap(Environment* env, - v8::Handle object, + v8::Local object, AsyncWrap::ProviderType provider) : AsyncWrap(env, object, provider) { if (env->in_domain()) diff --git a/src/req-wrap.h b/src/req-wrap.h index 27b51425d1..240df76ebf 100644 --- a/src/req-wrap.h +++ b/src/req-wrap.h @@ -12,7 +12,7 @@ template class ReqWrap : public AsyncWrap { public: inline ReqWrap(Environment* env, - v8::Handle object, + v8::Local object, AsyncWrap::ProviderType provider); inline ~ReqWrap() override; inline void Dispatched(); // Call this after the req has been dispatched. diff --git a/src/signal_wrap.cc b/src/signal_wrap.cc index 4811aca53a..5f6a6a52bc 100644 --- a/src/signal_wrap.cc +++ b/src/signal_wrap.cc @@ -13,7 +13,6 @@ using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -22,9 +21,9 @@ using v8::Value; class SignalWrap : public HandleWrap { public: - static void Initialize(Handle target, - Handle unused, - Handle context) { + static void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount(1); @@ -52,7 +51,7 @@ class SignalWrap : public HandleWrap { new SignalWrap(env, args.This()); } - SignalWrap(Environment* env, Handle object) + SignalWrap(Environment* env, Local object) : HandleWrap(env, object, reinterpret_cast(&handle_), diff --git a/src/spawn_sync.cc b/src/spawn_sync.cc index 97bccfd4b7..144af3e747 100644 --- a/src/spawn_sync.cc +++ b/src/spawn_sync.cc @@ -13,7 +13,6 @@ using v8::Array; using v8::Context; using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; @@ -340,9 +339,9 @@ void SyncProcessStdioPipe::CloseCallback(uv_handle_t* handle) { } -void SyncProcessRunner::Initialize(Handle target, - Handle unused, - Handle context) { +void SyncProcessRunner::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "spawn", Spawn); } diff --git a/src/spawn_sync.h b/src/spawn_sync.h index 3069df610f..fab2f09eef 100644 --- a/src/spawn_sync.h +++ b/src/spawn_sync.h @@ -9,7 +9,6 @@ namespace node { using v8::Array; using v8::Context; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; @@ -129,9 +128,9 @@ class SyncProcessRunner { }; public: - static void Initialize(Handle target, - Handle unused, - Handle context); + static void Initialize(Local target, + Local unused, + Local context); static void Spawn(const FunctionCallbackInfo& args); private: diff --git a/src/stream_base-inl.h b/src/stream_base-inl.h index dd0bbcfbd8..81114a265e 100644 --- a/src/stream_base-inl.h +++ b/src/stream_base-inl.h @@ -13,7 +13,6 @@ namespace node { using v8::External; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Local; using v8::Object; @@ -24,7 +23,7 @@ using v8::Value; template void StreamBase::AddMethods(Environment* env, - Handle t, + Local t, int flags) { HandleScope scope(env->isolate()); diff --git a/src/stream_base.cc b/src/stream_base.cc index d957465abc..3139274c6f 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -19,7 +19,6 @@ namespace node { using v8::Array; using v8::Context; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -109,14 +108,14 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { for (size_t i = 0; i < count; i++) { storage_size = ROUND_UP(storage_size, WriteWrap::kAlignSize); - Handle chunk = chunks->Get(i * 2); + Local chunk = chunks->Get(i * 2); if (Buffer::HasInstance(chunk)) continue; // Buffer chunk, no additional storage required // String chunk - Handle string = chunk->ToString(env->isolate()); + Local string = chunk->ToString(env->isolate()); enum encoding encoding = ParseEncoding(env->isolate(), chunks->Get(i * 2 + 1)); size_t chunk_size; @@ -143,7 +142,7 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { uint32_t bytes = 0; size_t offset = 0; for (size_t i = 0; i < count; i++) { - Handle chunk = chunks->Get(i * 2); + Local chunk = chunks->Get(i * 2); // Write buffer if (Buffer::HasInstance(chunk)) { @@ -159,7 +158,7 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { char* str_storage = req_wrap->Extra(offset); size_t str_size = storage_size - offset; - Handle string = chunk->ToString(env->isolate()); + Local string = chunk->ToString(env->isolate()); enum encoding encoding = ParseEncoding(env->isolate(), chunks->Get(i * 2 + 1)); str_size = StringBytes::Write(env->isolate(), diff --git a/src/stream_base.h b/src/stream_base.h index c5a0977792..d0e1d4b9b2 100644 --- a/src/stream_base.h +++ b/src/stream_base.h @@ -187,7 +187,7 @@ class StreamBase : public StreamResource { template static inline void AddMethods(Environment* env, - v8::Handle target, + v8::Local target, int flags = kFlagNone); virtual void* Cast() = 0; diff --git a/src/stream_wrap.cc b/src/stream_wrap.cc index ec98acbb30..cd9b2c9064 100644 --- a/src/stream_wrap.cc +++ b/src/stream_wrap.cc @@ -27,7 +27,6 @@ using v8::Context; using v8::EscapableHandleScope; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -40,9 +39,9 @@ using v8::Undefined; using v8::Value; -void StreamWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void StreamWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local sw = @@ -81,7 +80,7 @@ StreamWrap::StreamWrap(Environment* env, void StreamWrap::AddMethods(Environment* env, - v8::Handle target, + v8::Local target, int flags) { env->SetProtoMethod(target, "setBlocking", SetBlocking); StreamBase::AddMethods(env, target, flags); diff --git a/src/stream_wrap.h b/src/stream_wrap.h index 8e4cdf20be..b0d9986db5 100644 --- a/src/stream_wrap.h +++ b/src/stream_wrap.h @@ -15,9 +15,9 @@ class StreamWrap; class StreamWrap : public HandleWrap, public StreamBase { public: - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); int GetFD() override; void* Cast() override; @@ -68,7 +68,7 @@ class StreamWrap : public HandleWrap, public StreamBase { void UpdateWriteQueueSize(); static void AddMethods(Environment* env, - v8::Handle target, + v8::Local target, int flags = StreamBase::kFlagNone); private: diff --git a/src/string_bytes.cc b/src/string_bytes.cc index 7fc03c0f51..90fafd40cd 100644 --- a/src/string_bytes.cc +++ b/src/string_bytes.cc @@ -15,7 +15,6 @@ namespace node { using v8::EscapableHandleScope; -using v8::Handle; using v8::HandleScope; using v8::Isolate; using v8::Local; @@ -270,7 +269,7 @@ size_t hex_decode(char* buf, bool StringBytes::GetExternalParts(Isolate* isolate, - Handle val, + Local val, const char** data, size_t* len) { if (Buffer::HasInstance(val)) { @@ -346,7 +345,7 @@ size_t StringBytes::WriteUCS2(char* buf, size_t StringBytes::Write(Isolate* isolate, char* buf, size_t buflen, - Handle val, + Local val, enum encoding encoding, int* chars_written) { HandleScope scope(isolate); @@ -455,7 +454,7 @@ size_t StringBytes::Write(Isolate* isolate, bool StringBytes::IsValidString(Isolate* isolate, - Handle string, + Local string, enum encoding enc) { if (enc == HEX && string->Length() % 2 != 0) return false; @@ -468,7 +467,7 @@ bool StringBytes::IsValidString(Isolate* isolate, // Will always be at least big enough, but may have some extra // UTF8 can be as much as 3x the size, Base64 can have 1-2 extra bytes size_t StringBytes::StorageSize(Isolate* isolate, - Handle val, + Local val, enum encoding encoding) { HandleScope scope(isolate); size_t data_size = 0; @@ -517,7 +516,7 @@ size_t StringBytes::StorageSize(Isolate* isolate, size_t StringBytes::Size(Isolate* isolate, - Handle val, + Local val, enum encoding encoding) { HandleScope scope(isolate); size_t data_size = 0; diff --git a/src/string_bytes.h b/src/string_bytes.h index 7c044ebaf5..79520d2470 100644 --- a/src/string_bytes.h +++ b/src/string_bytes.h @@ -1,7 +1,7 @@ #ifndef SRC_STRING_BYTES_H_ #define SRC_STRING_BYTES_H_ -// Decodes a v8::Handle or Buffer to a raw char* +// Decodes a v8::Local or Buffer to a raw char* #include "v8.h" #include "node.h" @@ -24,8 +24,8 @@ class StringBytes { } inline bool Decode(Environment* env, - v8::Handle string, - v8::Handle encoding, + v8::Local string, + v8::Local encoding, enum encoding _default) { enum encoding enc = ParseEncoding(env->isolate(), encoding, _default); if (!StringBytes::IsValidString(env->isolate(), string, enc)) { @@ -61,25 +61,25 @@ class StringBytes { // Example: a HEX string must have a length that's a multiple of two. // FIXME(bnoordhuis) IsMaybeValidString()? Naming things is hard... static bool IsValidString(v8::Isolate* isolate, - v8::Handle string, + v8::Local string, enum encoding enc); // Fast, but can be 2 bytes oversized for Base64, and // as much as triple UTF-8 strings <= 65536 chars in length static size_t StorageSize(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, enum encoding enc); // Precise byte count, but slightly slower for Base64 and // very much slower for UTF-8 static size_t Size(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, enum encoding enc); // If the string is external then assign external properties to data and len, // then return true. If not return false. static bool GetExternalParts(v8::Isolate* isolate, - v8::Handle val, + v8::Local val, const char** data, size_t* len); @@ -90,7 +90,7 @@ class StringBytes { static size_t Write(v8::Isolate* isolate, char* buf, size_t buflen, - v8::Handle val, + v8::Local val, enum encoding enc, int* chars_written = nullptr); @@ -110,25 +110,25 @@ class StringBytes { NODE_DEPRECATED("Use IsValidString(isolate, ...)", static inline bool IsValidString( - v8::Handle string, + v8::Local string, enum encoding enc) { return IsValidString(v8::Isolate::GetCurrent(), string, enc); }) NODE_DEPRECATED("Use StorageSize(isolate, ...)", - static inline size_t StorageSize(v8::Handle val, + static inline size_t StorageSize(v8::Local val, enum encoding enc) { return StorageSize(v8::Isolate::GetCurrent(), val, enc); }) NODE_DEPRECATED("Use Size(isolate, ...)", - static inline size_t Size(v8::Handle val, + static inline size_t Size(v8::Local val, enum encoding enc) { return Size(v8::Isolate::GetCurrent(), val, enc); }) NODE_DEPRECATED("Use GetExternalParts(isolate, ...)", - static inline bool GetExternalParts(v8::Handle val, + static inline bool GetExternalParts(v8::Local val, const char** data, size_t* len) { return GetExternalParts(v8::Isolate::GetCurrent(), val, data, len); @@ -137,7 +137,7 @@ class StringBytes { NODE_DEPRECATED("Use Write(isolate, ...)", static inline size_t Write(char* buf, size_t buflen, - v8::Handle val, + v8::Local val, enum encoding enc, int* chars_written = nullptr) { v8::Isolate* isolate = v8::Isolate::GetCurrent(); diff --git a/src/tcp_wrap.cc b/src/tcp_wrap.cc index d9a35886cb..9bdf8ccc1d 100644 --- a/src/tcp_wrap.cc +++ b/src/tcp_wrap.cc @@ -23,7 +23,6 @@ using v8::External; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -64,9 +63,9 @@ Local TCPWrap::Instantiate(Environment* env, AsyncWrap* parent) { } -void TCPWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void TCPWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); @@ -146,7 +145,7 @@ void TCPWrap::New(const FunctionCallbackInfo& args) { } -TCPWrap::TCPWrap(Environment* env, Handle object, AsyncWrap* parent) +TCPWrap::TCPWrap(Environment* env, Local object, AsyncWrap* parent) : StreamWrap(env, object, reinterpret_cast(&handle_), diff --git a/src/tcp_wrap.h b/src/tcp_wrap.h index 79404a7e42..4810f1dc1b 100644 --- a/src/tcp_wrap.h +++ b/src/tcp_wrap.h @@ -10,9 +10,9 @@ namespace node { class TCPWrap : public StreamWrap { public: static v8::Local Instantiate(Environment* env, AsyncWrap* parent); - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); uv_tcp_t* UVHandle(); @@ -25,7 +25,7 @@ class TCPWrap : public StreamWrap { int (*F)(const typename T::HandleType*, sockaddr*, int*)> friend void GetSockOrPeerName(const v8::FunctionCallbackInfo&); - TCPWrap(Environment* env, v8::Handle object, AsyncWrap* parent); + TCPWrap(Environment* env, v8::Local object, AsyncWrap* parent); ~TCPWrap(); static void New(const v8::FunctionCallbackInfo& args); diff --git a/src/timer_wrap.cc b/src/timer_wrap.cc index f3d5d1fedb..79fa86953d 100644 --- a/src/timer_wrap.cc +++ b/src/timer_wrap.cc @@ -14,7 +14,6 @@ using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -25,9 +24,9 @@ const uint32_t kOnTimeout = 0; class TimerWrap : public HandleWrap { public: - static void Initialize(Handle target, - Handle unused, - Handle context) { + static void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local constructor = env->NewFunctionTemplate(New); constructor->InstanceTemplate()->SetInternalFieldCount(1); @@ -60,7 +59,7 @@ class TimerWrap : public HandleWrap { new TimerWrap(env, args.This()); } - TimerWrap(Environment* env, Handle object) + TimerWrap(Environment* env, Local object) : HandleWrap(env, object, reinterpret_cast(&handle_), diff --git a/src/tls_wrap.cc b/src/tls_wrap.cc index 56dac0fe1f..b466afb152 100644 --- a/src/tls_wrap.cc +++ b/src/tls_wrap.cc @@ -24,7 +24,6 @@ using v8::Exception; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::Integer; using v8::Local; using v8::Null; @@ -865,9 +864,9 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) { #endif // SSL_CTRL_SET_TLSEXT_SERVERNAME_CB -void TLSWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void TLSWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); env->SetMethod(target, "wrap", TLSWrap::Wrap); diff --git a/src/tls_wrap.h b/src/tls_wrap.h index 7a9dc888cc..47cbf27fe2 100644 --- a/src/tls_wrap.h +++ b/src/tls_wrap.h @@ -27,9 +27,9 @@ class TLSWrap : public crypto::SSLWrap, public: ~TLSWrap() override; - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); void* Cast() override; int GetFD() override; diff --git a/src/tty_wrap.cc b/src/tty_wrap.cc index eaec271937..76a2472f8a 100644 --- a/src/tty_wrap.cc +++ b/src/tty_wrap.cc @@ -18,7 +18,6 @@ using v8::Context; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::Integer; using v8::Local; using v8::Object; @@ -27,9 +26,9 @@ using v8::String; using v8::Value; -void TTYWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void TTYWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); @@ -130,7 +129,7 @@ void TTYWrap::New(const FunctionCallbackInfo& args) { } -TTYWrap::TTYWrap(Environment* env, Handle object, int fd, bool readable) +TTYWrap::TTYWrap(Environment* env, Local object, int fd, bool readable) : StreamWrap(env, object, reinterpret_cast(&handle_), diff --git a/src/tty_wrap.h b/src/tty_wrap.h index 6d423e1ae5..581972a3b9 100644 --- a/src/tty_wrap.h +++ b/src/tty_wrap.h @@ -9,9 +9,9 @@ namespace node { class TTYWrap : public StreamWrap { public: - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); uv_tty_t* UVHandle(); @@ -19,7 +19,7 @@ class TTYWrap : public StreamWrap { private: TTYWrap(Environment* env, - v8::Handle object, + v8::Local object, int fd, bool readable); diff --git a/src/udp_wrap.cc b/src/udp_wrap.cc index 71cc547675..4c0d38dfb2 100644 --- a/src/udp_wrap.cc +++ b/src/udp_wrap.cc @@ -19,7 +19,6 @@ using v8::External; using v8::Function; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Local; @@ -61,7 +60,7 @@ static void NewSendWrap(const FunctionCallbackInfo& args) { } -UDPWrap::UDPWrap(Environment* env, Handle object, AsyncWrap* parent) +UDPWrap::UDPWrap(Environment* env, Local object, AsyncWrap* parent) : HandleWrap(env, object, reinterpret_cast(&handle_), @@ -71,9 +70,9 @@ UDPWrap::UDPWrap(Environment* env, Handle object, AsyncWrap* parent) } -void UDPWrap::Initialize(Handle target, - Handle unused, - Handle context) { +void UDPWrap::Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); Local t = env->NewFunctionTemplate(New); diff --git a/src/udp_wrap.h b/src/udp_wrap.h index 1582fb46ce..2a92cb340d 100644 --- a/src/udp_wrap.h +++ b/src/udp_wrap.h @@ -13,9 +13,9 @@ namespace node { class UDPWrap: public HandleWrap { public: - static void Initialize(v8::Handle target, - v8::Handle unused, - v8::Handle context); + static void Initialize(v8::Local target, + v8::Local unused, + v8::Local context); static void GetFD(v8::Local, const v8::PropertyCallbackInfo&); static void New(const v8::FunctionCallbackInfo& args); @@ -46,7 +46,7 @@ class UDPWrap: public HandleWrap { int (*F)(const typename T::HandleType*, sockaddr*, int*)> friend void GetSockOrPeerName(const v8::FunctionCallbackInfo&); - UDPWrap(Environment* env, v8::Handle object, AsyncWrap* parent); + UDPWrap(Environment* env, v8::Local object, AsyncWrap* parent); static void DoBind(const v8::FunctionCallbackInfo& args, int family); diff --git a/src/util.cc b/src/util.cc index a793368c2c..903fbbba13 100644 --- a/src/util.cc +++ b/src/util.cc @@ -3,7 +3,7 @@ namespace node { -Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle value) +Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local value) : length_(0), str_(str_st_) { if (value.IsEmpty()) return; diff --git a/src/util.h b/src/util.h index ea17a15574..24c633e286 100644 --- a/src/util.h +++ b/src/util.h @@ -170,7 +170,7 @@ inline TypeName* Unwrap(v8::Local object); class Utf8Value { public: - explicit Utf8Value(v8::Isolate* isolate, v8::Handle value); + explicit Utf8Value(v8::Isolate* isolate, v8::Local value); ~Utf8Value() { if (str_ != str_st_) diff --git a/src/uv.cc b/src/uv.cc index 2208ebde3c..d03e775008 100644 --- a/src/uv.cc +++ b/src/uv.cc @@ -9,7 +9,7 @@ namespace uv { using v8::Context; using v8::FunctionCallbackInfo; using v8::FunctionTemplate; -using v8::Handle; +using v8::Local; using v8::Integer; using v8::Object; using v8::String; @@ -26,9 +26,9 @@ void ErrName(const FunctionCallbackInfo& args) { } -void Initialize(Handle target, - Handle unused, - Handle context) { +void Initialize(Local target, + Local unused, + Local context) { Environment* env = Environment::GetCurrent(context); target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "errname"), env->NewFunctionTemplate(ErrName)->GetFunction()); diff --git a/test/addons/async-hello-world/binding.cc b/test/addons/async-hello-world/binding.cc index aee3a3763f..b087bf9aa0 100644 --- a/test/addons/async-hello-world/binding.cc +++ b/test/addons/async-hello-world/binding.cc @@ -22,7 +22,7 @@ void AfterAsync(uv_work_t* r) { v8::Isolate* isolate = req->isolate; v8::HandleScope scope(isolate); - v8::Handle argv[2] = { + v8::Local argv[2] = { v8::Null(isolate), v8::Integer::New(isolate, req->output) }; @@ -62,7 +62,7 @@ void Method(const v8::FunctionCallbackInfo& args) { (uv_after_work_cb)AfterAsync); } -void init(v8::Handle exports, v8::Handle module) { +void init(v8::Local exports, v8::Local module) { NODE_SET_METHOD(module, "exports", Method); } diff --git a/test/addons/at-exit/binding.cc b/test/addons/at-exit/binding.cc index d300aad3e8..5210de298b 100644 --- a/test/addons/at-exit/binding.cc +++ b/test/addons/at-exit/binding.cc @@ -5,7 +5,6 @@ #include using node::AtExit; -using v8::Handle; using v8::HandleScope; using v8::Isolate; using v8::Local; @@ -34,7 +33,7 @@ static void sanity_check(void) { assert(at_exit_cb2_called == 2); } -void init(Handle target) { +void init(Local target) { AtExit(at_exit_cb1, target->CreationContext()->GetIsolate()); AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb2, cookie); diff --git a/test/addons/hello-world-function-export/binding.cc b/test/addons/hello-world-function-export/binding.cc index 68db22748f..fa2cbc59a0 100644 --- a/test/addons/hello-world-function-export/binding.cc +++ b/test/addons/hello-world-function-export/binding.cc @@ -7,7 +7,7 @@ void Method(const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); } -void init(v8::Handle exports, v8::Handle module) { +void init(v8::Local exports, v8::Local module) { NODE_SET_METHOD(module, "exports", Method); } diff --git a/test/addons/hello-world/binding.cc b/test/addons/hello-world/binding.cc index 4982bc3e55..b21f87d0fd 100644 --- a/test/addons/hello-world/binding.cc +++ b/test/addons/hello-world/binding.cc @@ -7,7 +7,7 @@ void Method(const v8::FunctionCallbackInfo& args) { args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); } -void init(v8::Handle target) { +void init(v8::Local target) { NODE_SET_METHOD(target, "hello", Method); } diff --git a/test/addons/repl-domain-abort/binding.cc b/test/addons/repl-domain-abort/binding.cc index a875eabb71..7d9b6e5513 100644 --- a/test/addons/repl-domain-abort/binding.cc +++ b/test/addons/repl-domain-abort/binding.cc @@ -3,7 +3,7 @@ using v8::Function; using v8::FunctionCallbackInfo; -using v8::Handle; +using v8::Local; using v8::HandleScope; using v8::Isolate; using v8::Object; @@ -19,7 +19,7 @@ void Method(const FunctionCallbackInfo& args) { NULL); } -void init(Handle target) { +void init(Local target) { NODE_SET_METHOD(target, "method", Method); } diff --git a/test/gc/node_modules/weak/src/weakref.cc b/test/gc/node_modules/weak/src/weakref.cc index 548a224a83..64629b48d7 100644 --- a/test/gc/node_modules/weak/src/weakref.cc +++ b/test/gc/node_modules/weak/src/weakref.cc @@ -27,7 +27,6 @@ using v8::Exception; using v8::Function; using v8::FunctionTemplate; using v8::FunctionCallbackInfo; -using v8::Handle; using v8::HandleScope; using v8::Integer; using v8::Isolate; @@ -51,7 +50,7 @@ typedef struct proxy_container { Persistent proxyClass; -bool IsDead(Handle proxy) { +bool IsDead(Local proxy) { assert(proxy->InternalFieldCount() == 1); proxy_container *cont = reinterpret_cast( proxy->GetAlignedPointerFromInternalField(0)); @@ -59,7 +58,7 @@ bool IsDead(Handle proxy) { } -Handle Unwrap(Handle proxy) { +Local Unwrap(Local proxy) { assert(!IsDead(proxy)); proxy_container *cont = reinterpret_cast( proxy->GetAlignedPointerFromInternalField(0)); @@ -67,7 +66,7 @@ Handle Unwrap(Handle proxy) { return Local::New(isolate, cont->target); } -Handle GetCallbacks(Handle proxy) { +Local GetCallbacks(Local proxy) { proxy_container *cont = reinterpret_cast( proxy->GetAlignedPointerFromInternalField(0)); assert(cont != NULL); @@ -78,7 +77,7 @@ Handle GetCallbacks(Handle proxy) { #define UNWRAP \ HandleScope scope(info.GetIsolate()); \ - Handle obj; \ + Local obj; \ const bool dead = IsDead(info.This()); \ if (!dead) obj = Unwrap(info.This()); \ @@ -152,8 +151,8 @@ void WeakPropertyEnumerator(const PropertyCallbackInfo& info) { } -void AddCallback(Isolate* isolate, Handle proxy, Handle callback) { - Handle callbacks = GetCallbacks(proxy); +void AddCallback(Isolate* isolate, Local proxy, Local callback) { + Local callbacks = GetCallbacks(proxy); callbacks->Set(Integer::New(isolate, callbacks->Length()), callback); } @@ -168,11 +167,11 @@ static void TargetCallback(const v8::WeakCallbackData callbacks = Local::New(isolate, cont->callbacks); uint32_t len = callbacks->Length(); - Handle argv[1]; + Local argv[1]; argv[0] = target; for (uint32_t i=0; i cb = Handle::Cast( + Local cb = Local::Cast( callbacks->Get(Integer::New(isolate, i))); TryCatch try_catch; @@ -212,7 +211,7 @@ void Create(const FunctionCallbackInfo& args) { cont->target.SetWeak(cont, TargetCallback); if (args.Length() >= 2) { - AddCallback(args.GetIsolate(), proxy, Handle::Cast(args[1])); + AddCallback(args.GetIsolate(), proxy, Local::Cast(args[1])); } args.GetReturnValue().Set(proxy); @@ -222,7 +221,7 @@ void Create(const FunctionCallbackInfo& args) { * TODO: Make this better. */ -bool isWeakRef (Handle val) { +bool isWeakRef (Local val) { return val->IsObject() && val->ToObject()->InternalFieldCount() == 1; } @@ -241,7 +240,7 @@ void Get(const FunctionCallbackInfo& args) { Local proxy = args[0]->ToObject(); if (IsDead(proxy)) return; - Handle obj = Unwrap(proxy); + Local obj = Unwrap(proxy); args.GetReturnValue().Set(obj); } @@ -283,7 +282,7 @@ void AddCallback(const FunctionCallbackInfo& args) { } Local proxy = args[0]->ToObject(); - AddCallback(args.GetIsolate(), proxy, Handle::Cast(args[1])); + AddCallback(args.GetIsolate(), proxy, Local::Cast(args[1])); } void Callbacks(const FunctionCallbackInfo& args) { @@ -299,7 +298,7 @@ void Callbacks(const FunctionCallbackInfo& args) { } -void Initialize(Handle target) { +void Initialize(Local target) { HandleScope scope(target->CreationContext()->GetIsolate()); Local tmpl = ObjectTemplate::New();