Skip to content

Commit

Permalink
src: replace usage of v8::Handle with v8::Local
Browse files Browse the repository at this point in the history
v8::Handle is deprecated: https://codereview.chromium.org/1224623004

PR-URL: #2202
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
  • Loading branch information
targos authored and rvagg committed Sep 6, 2015
1 parent 9a03ae6 commit 4abc896
Show file tree
Hide file tree
Showing 72 changed files with 347 additions and 383 deletions.
2 changes: 1 addition & 1 deletion benchmark/misc/function_call/binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ void Hello(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(c++);
}

extern "C" void init (Handle<Object> target) {
extern "C" void init (Local<Object> target) {
HandleScope scope(Isolate::GetCurrent());
NODE_SET_METHOD(target, "hello", Hello);
}
Expand Down
12 changes: 6 additions & 6 deletions src/async-wrap-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
namespace node {

inline AsyncWrap::AsyncWrap(Environment* env,
v8::Handle<v8::Object> object,
v8::Local<v8::Object> object,
ProviderType provider,
AsyncWrap* parent)
: BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1) {
Expand Down Expand Up @@ -58,20 +58,20 @@ inline AsyncWrap::ProviderType AsyncWrap::provider_type() const {
}


inline v8::Handle<v8::Value> AsyncWrap::MakeCallback(
const v8::Handle<v8::String> symbol,
inline v8::Local<v8::Value> AsyncWrap::MakeCallback(
const v8::Local<v8::String> symbol,
int argc,
v8::Handle<v8::Value>* argv) {
v8::Local<v8::Value>* argv) {
v8::Local<v8::Value> cb_v = object()->Get(symbol);
CHECK(cb_v->IsFunction());
return MakeCallback(cb_v.As<v8::Function>(), argc, argv);
}


inline v8::Handle<v8::Value> AsyncWrap::MakeCallback(
inline v8::Local<v8::Value> AsyncWrap::MakeCallback(
uint32_t index,
int argc,
v8::Handle<v8::Value>* argv) {
v8::Local<v8::Value>* argv) {
v8::Local<v8::Value> cb_v = object()->Get(index);
CHECK(cb_v->IsFunction());
return MakeCallback(cb_v.As<v8::Function>(), argc, argv);
Expand Down
13 changes: 6 additions & 7 deletions src/async-wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -83,7 +82,7 @@ intptr_t RetainedAsyncInfo::GetSizeInBytes() {
}


RetainedObjectInfo* WrapperInfo(uint16_t class_id, Handle<Value> wrapper) {
RetainedObjectInfo* WrapperInfo(uint16_t class_id, Local<Value> wrapper) {
// No class_id should be the provider type of NONE.
CHECK_NE(NODE_ASYNC_ID_OFFSET, class_id);
CHECK(wrapper->IsObject());
Expand Down Expand Up @@ -129,9 +128,9 @@ static void SetupHooks(const FunctionCallbackInfo<Value>& args) {
}


static void Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context) {
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate();
HandleScope scope(isolate);
Expand Down Expand Up @@ -160,9 +159,9 @@ void LoadAsyncWrapperInfo(Environment* env) {
}


Handle<Value> AsyncWrap::MakeCallback(const Handle<Function> cb,
Local<Value> AsyncWrap::MakeCallback(const Local<Function> cb,
int argc,
Handle<Value>* argv) {
Local<Value>* argv) {
CHECK(env()->context() == env()->isolate()->GetCurrentContext());

Local<Object> context = object();
Expand Down
14 changes: 7 additions & 7 deletions src/async-wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class AsyncWrap : public BaseObject {
};

inline AsyncWrap(Environment* env,
v8::Handle<v8::Object> object,
v8::Local<v8::Object> object,
ProviderType provider,
AsyncWrap* parent = nullptr);

Expand All @@ -56,15 +56,15 @@ class AsyncWrap : public BaseObject {
inline ProviderType provider_type() const;

// Only call these within a valid HandleScope.
v8::Handle<v8::Value> MakeCallback(const v8::Handle<v8::Function> cb,
v8::Local<v8::Value> MakeCallback(const v8::Local<v8::Function> cb,
int argc,
v8::Handle<v8::Value>* argv);
inline v8::Handle<v8::Value> MakeCallback(const v8::Handle<v8::String> symbol,
v8::Local<v8::Value>* argv);
inline v8::Local<v8::Value> MakeCallback(const v8::Local<v8::String> symbol,
int argc,
v8::Handle<v8::Value>* argv);
inline v8::Handle<v8::Value> MakeCallback(uint32_t index,
v8::Local<v8::Value>* argv);
inline v8::Local<v8::Value> MakeCallback(uint32_t index,
int argc,
v8::Handle<v8::Value>* argv);
v8::Local<v8::Value>* argv);

virtual size_t self_size() const = 0;

Expand Down
7 changes: 3 additions & 4 deletions src/cares_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -1240,9 +1239,9 @@ static void CaresTimerClose(Environment* env,
}


static void Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context) {
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);

int r = ares_library_init(ARES_LIB_INIT_ALL);
Expand Down
1 change: 0 additions & 1 deletion src/debug-agent.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
17 changes: 8 additions & 9 deletions src/fs_event_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -24,17 +23,17 @@ using v8::Value;

class FSEventWrap: public HandleWrap {
public:
static void Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context);
static void Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context);
static void New(const FunctionCallbackInfo<Value>& args);
static void Start(const FunctionCallbackInfo<Value>& args);
static void Close(const FunctionCallbackInfo<Value>& args);

size_t self_size() const override { return sizeof(*this); }

private:
FSEventWrap(Environment* env, Handle<Object> object);
FSEventWrap(Environment* env, Local<Object> object);
virtual ~FSEventWrap() override;

static void OnEvent(uv_fs_event_t* handle, const char* filename, int events,
Expand All @@ -45,7 +44,7 @@ class FSEventWrap: public HandleWrap {
};


FSEventWrap::FSEventWrap(Environment* env, Handle<Object> object)
FSEventWrap::FSEventWrap(Environment* env, Local<Object> object)
: HandleWrap(env,
object,
reinterpret_cast<uv_handle_t*>(&handle_),
Expand All @@ -59,9 +58,9 @@ FSEventWrap::~FSEventWrap() {
}


void FSEventWrap::Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context) {
void FSEventWrap::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);

Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
Expand Down
3 changes: 1 addition & 2 deletions src/handle_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ namespace node {

using v8::Context;
using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope;
using v8::Local;
using v8::Object;
Expand Down Expand Up @@ -59,7 +58,7 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {


HandleWrap::HandleWrap(Environment* env,
Handle<Object> object,
Local<Object> object,
uv_handle_t* handle,
AsyncWrap::ProviderType provider,
AsyncWrap* parent)
Expand Down
2 changes: 1 addition & 1 deletion src/handle_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ class HandleWrap : public AsyncWrap {

protected:
HandleWrap(Environment* env,
v8::Handle<v8::Object> object,
v8::Local<v8::Object> object,
uv_handle_t* handle,
AsyncWrap::ProviderType provider,
AsyncWrap* parent = nullptr);
Expand Down
9 changes: 4 additions & 5 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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<Object> obj, AsyncWrap* parent)
JSStream::JSStream(Environment* env, Local<Object> obj, AsyncWrap* parent)
: StreamBase(env),
AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent) {
node::Wrap(obj, this);
Expand Down Expand Up @@ -201,9 +200,9 @@ void JSStream::EmitEOF(const FunctionCallbackInfo<Value>& args) {
}


void JSStream::Initialize(Handle<Object> target,
Handle<Value> unused,
Handle<Context> context) {
void JSStream::Initialize(Local<Object> target,
Local<Value> unused,
Local<Context> context) {
Environment* env = Environment::GetCurrent(context);

Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
Expand Down
8 changes: 4 additions & 4 deletions src/js_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ namespace node {

class JSStream : public StreamBase, public AsyncWrap {
public:
static void Initialize(v8::Handle<v8::Object> target,
v8::Handle<v8::Value> unused,
v8::Handle<v8::Context> context);
static void Initialize(v8::Local<v8::Object> target,
v8::Local<v8::Value> unused,
v8::Local<v8::Context> context);

~JSStream();

Expand All @@ -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<v8::Object> obj, AsyncWrap* parent);
JSStream(Environment* env, v8::Local<v8::Object> obj, AsyncWrap* parent);

AsyncWrap* GetAsyncWrap() override;

Expand Down
Loading

0 comments on commit 4abc896

Please sign in to comment.