From 4937e76ba042d9cb7ca4781699d0ac3ffe5f8186 Mon Sep 17 00:00:00 2001 From: AbnerLee Date: Fri, 26 Apr 2019 01:08:50 +0800 Subject: [PATCH] replace Handle with Local --- src/common.cc | 8 ++++---- src/handle_map.cc | 2 +- src/handle_map.h | 2 +- src/main.cc | 2 +- src/unsafe_persistent.h | 4 ++-- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/common.cc b/src/common.cc index 563c943..4a5c570 100644 --- a/src/common.cc +++ b/src/common.cc @@ -24,7 +24,7 @@ static void MakeCallbackInMainThread(uv_async_t* handle, int status) { Nan::HandleScope scope; if (!g_callback.IsEmpty()) { - Handle type; + Local type; switch (g_type) { case EVENT_CHANGE: type = Nan::New("change").ToLocalChecked(); @@ -52,7 +52,7 @@ static void MakeCallbackInMainThread(uv_async_t* handle, int status) { return; } - Handle argv[] = { + Local argv[] = { type, WatcherHandleToV8Value(g_handle), Nan::New(g_new_path.data(), g_new_path.size()).ToLocalChecked(), @@ -121,7 +121,7 @@ NAN_METHOD(Watch) { if (!info[0]->IsString()) return Nan::ThrowTypeError("String required"); - Handle path = info[0]->ToString(); + Local path = info[0]->ToString(); WatcherHandle handle = PlatformWatch(*String::Utf8Value(path)); if (!PlatformIsHandleValid(handle)) { int error_number = PlatformInvalidHandleToErrorNumber(handle); @@ -154,7 +154,7 @@ NAN_METHOD(Unwatch) { Nan::HandleScope scope; if (!IsV8ValueWatcherHandle(info[0])) - return Nan::ThrowTypeError("Handle type required"); + return Nan::ThrowTypeError("Local type required"); PlatformUnwatch(V8ValueToWatcherHandle(info[0])); diff --git a/src/handle_map.cc b/src/handle_map.cc index 24a14f0..af6f7da 100644 --- a/src/handle_map.cc +++ b/src/handle_map.cc @@ -121,7 +121,7 @@ NAN_METHOD(HandleMap::Clear) { } // static -void HandleMap::Initialize(Handle target) { +void HandleMap::Initialize(Local target) { Nan::HandleScope scope; Local t = Nan::New(HandleMap::New); diff --git a/src/handle_map.h b/src/handle_map.h index 79f1ad6..a9638b0 100644 --- a/src/handle_map.h +++ b/src/handle_map.h @@ -8,7 +8,7 @@ class HandleMap : public Nan::ObjectWrap { public: - static void Initialize(Handle target); + static void Initialize(Local target); private: typedef std::map > Map; diff --git a/src/main.cc b/src/main.cc index e9d8b7d..898f45f 100644 --- a/src/main.cc +++ b/src/main.cc @@ -3,7 +3,7 @@ namespace { -void Init(Handle exports) { +void Init(Local exports) { CommonInit(); PlatformInit(); diff --git a/src/unsafe_persistent.h b/src/unsafe_persistent.h index a9ae1c8..6b2fb8a 100644 --- a/src/unsafe_persistent.h +++ b/src/unsafe_persistent.h @@ -27,7 +27,7 @@ class NanUnsafePersistent : public NanUnsafePersistentTraits::HandleType { template NAN_INLINE void NanAssignUnsafePersistent( NanUnsafePersistent& handle - , v8::Handle obj) { + , v8::Local obj) { handle.Reset(); handle = NanUnsafePersistent(v8::Isolate::GetCurrent(), obj); } @@ -43,7 +43,7 @@ NAN_INLINE v8::Local NanUnsafePersistentToLocal(const NanUnsafePersistent template NAN_INLINE void NanAssignUnsafePersistent( v8::Persistent& handle - , v8::Handle obj) { + , v8::Local obj) { handle.Dispose(); handle = v8::Persistent::New(obj); }