Browse Source

src: replace usage of v8::Handle with v8::Local

v8::Handle is deprecated: https://codereview.chromium.org/1224623004

PR-URL: https://github.com/nodejs/io.js/pull/2202
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
v5.x
Michaël Zasso 10 years ago
committed by Rod Vagg
parent
commit
4abc896a82
  1. 2
      benchmark/misc/function_call/binding.cc
  2. 12
      src/async-wrap-inl.h
  3. 13
      src/async-wrap.cc
  4. 14
      src/async-wrap.h
  5. 7
      src/cares_wrap.cc
  6. 1
      src/debug-agent.cc
  7. 17
      src/fs_event_wrap.cc
  8. 3
      src/handle_wrap.cc
  9. 2
      src/handle_wrap.h
  10. 9
      src/js_stream.cc
  11. 8
      src/js_stream.h
  12. 91
      src/node.cc
  13. 54
      src/node.h
  14. 27
      src/node_buffer.cc
  15. 14
      src/node_buffer.h
  16. 18
      src/node_constants.cc
  17. 2
      src/node_constants.h
  18. 9
      src/node_contextify.cc
  19. 5
      src/node_counters.cc
  20. 4
      src/node_counters.h
  21. 37
      src/node_crypto.cc
  22. 26
      src/node_crypto.h
  23. 3
      src/node_dtrace.cc
  24. 2
      src/node_dtrace.h
  25. 7
      src/node_file.cc
  26. 2
      src/node_file.h
  27. 7
      src/node_http_parser.cc
  28. 2
      src/node_http_parser.h
  29. 36
      src/node_internals.h
  30. 7
      src/node_javascript.cc
  31. 4
      src/node_javascript.h
  32. 3
      src/node_lttng.cc
  33. 2
      src/node_lttng.h
  34. 4
      src/node_object_wrap.h
  35. 7
      src/node_os.cc
  36. 3
      src/node_stat_watcher.cc
  37. 2
      src/node_stat_watcher.h
  38. 7
      src/node_v8.cc
  39. 9
      src/node_zlib.cc
  40. 9
      src/pipe_wrap.cc
  41. 8
      src/pipe_wrap.h
  42. 9
      src/process_wrap.cc
  43. 2
      src/req-wrap-inl.h
  44. 2
      src/req-wrap.h
  45. 9
      src/signal_wrap.cc
  46. 7
      src/spawn_sync.cc
  47. 7
      src/spawn_sync.h
  48. 3
      src/stream_base-inl.h
  49. 9
      src/stream_base.cc
  50. 2
      src/stream_base.h
  51. 9
      src/stream_wrap.cc
  52. 8
      src/stream_wrap.h
  53. 11
      src/string_bytes.cc
  54. 26
      src/string_bytes.h
  55. 9
      src/tcp_wrap.cc
  56. 8
      src/tcp_wrap.h
  57. 9
      src/timer_wrap.cc
  58. 7
      src/tls_wrap.cc
  59. 6
      src/tls_wrap.h
  60. 9
      src/tty_wrap.cc
  61. 8
      src/tty_wrap.h
  62. 9
      src/udp_wrap.cc
  63. 8
      src/udp_wrap.h
  64. 2
      src/util.cc
  65. 2
      src/util.h
  66. 8
      src/uv.cc
  67. 4
      test/addons/async-hello-world/binding.cc
  68. 3
      test/addons/at-exit/binding.cc
  69. 2
      test/addons/hello-world-function-export/binding.cc
  70. 2
      test/addons/hello-world/binding.cc
  71. 4
      test/addons/repl-domain-abort/binding.cc
  72. 27
      test/gc/node_modules/weak/src/weakref.cc

2
benchmark/misc/function_call/binding.cc

@ -9,7 +9,7 @@ void Hello(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(c++); args.GetReturnValue().Set(c++);
} }
extern "C" void init (Handle<Object> target) { extern "C" void init (Local<Object> target) {
HandleScope scope(Isolate::GetCurrent()); HandleScope scope(Isolate::GetCurrent());
NODE_SET_METHOD(target, "hello", Hello); NODE_SET_METHOD(target, "hello", Hello);
} }

12
src/async-wrap-inl.h

@ -14,7 +14,7 @@
namespace node { namespace node {
inline AsyncWrap::AsyncWrap(Environment* env, inline AsyncWrap::AsyncWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
ProviderType provider, ProviderType provider,
AsyncWrap* parent) AsyncWrap* parent)
: BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1) { : BaseObject(env, object), bits_(static_cast<uint32_t>(provider) << 1) {
@ -58,20 +58,20 @@ inline AsyncWrap::ProviderType AsyncWrap::provider_type() const {
} }
inline v8::Handle<v8::Value> AsyncWrap::MakeCallback( inline v8::Local<v8::Value> AsyncWrap::MakeCallback(
const v8::Handle<v8::String> symbol, const v8::Local<v8::String> symbol,
int argc, int argc,
v8::Handle<v8::Value>* argv) { v8::Local<v8::Value>* argv) {
v8::Local<v8::Value> cb_v = object()->Get(symbol); v8::Local<v8::Value> cb_v = object()->Get(symbol);
CHECK(cb_v->IsFunction()); CHECK(cb_v->IsFunction());
return MakeCallback(cb_v.As<v8::Function>(), argc, argv); 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, uint32_t index,
int argc, int argc,
v8::Handle<v8::Value>* argv) { v8::Local<v8::Value>* argv) {
v8::Local<v8::Value> cb_v = object()->Get(index); v8::Local<v8::Value> cb_v = object()->Get(index);
CHECK(cb_v->IsFunction()); CHECK(cb_v->IsFunction());
return MakeCallback(cb_v.As<v8::Function>(), argc, argv); return MakeCallback(cb_v.As<v8::Function>(), argc, argv);

13
src/async-wrap.cc

@ -12,7 +12,6 @@ using v8::Array;
using v8::Context; using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::HeapProfiler; using v8::HeapProfiler;
using v8::Integer; using v8::Integer;
@ -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. // No class_id should be the provider type of NONE.
CHECK_NE(NODE_ASYNC_ID_OFFSET, class_id); CHECK_NE(NODE_ASYNC_ID_OFFSET, class_id);
CHECK(wrapper->IsObject()); CHECK(wrapper->IsObject());
@ -129,9 +128,9 @@ static void SetupHooks(const FunctionCallbackInfo<Value>& args) {
} }
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Isolate* isolate = env->isolate(); Isolate* isolate = env->isolate();
HandleScope scope(isolate); HandleScope scope(isolate);
@ -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, int argc,
Handle<Value>* argv) { Local<Value>* argv) {
CHECK(env()->context() == env()->isolate()->GetCurrentContext()); CHECK(env()->context() == env()->isolate()->GetCurrentContext());
Local<Object> context = object(); Local<Object> context = object();

14
src/async-wrap.h

@ -47,7 +47,7 @@ class AsyncWrap : public BaseObject {
}; };
inline AsyncWrap(Environment* env, inline AsyncWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
ProviderType provider, ProviderType provider,
AsyncWrap* parent = nullptr); AsyncWrap* parent = nullptr);
@ -56,15 +56,15 @@ class AsyncWrap : public BaseObject {
inline ProviderType provider_type() const; inline ProviderType provider_type() const;
// Only call these within a valid HandleScope. // 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, int argc,
v8::Handle<v8::Value>* argv); v8::Local<v8::Value>* argv);
inline v8::Handle<v8::Value> MakeCallback(const v8::Handle<v8::String> symbol, inline v8::Local<v8::Value> MakeCallback(const v8::Local<v8::String> symbol,
int argc, int argc,
v8::Handle<v8::Value>* argv); v8::Local<v8::Value>* argv);
inline v8::Handle<v8::Value> MakeCallback(uint32_t index, inline v8::Local<v8::Value> MakeCallback(uint32_t index,
int argc, int argc,
v8::Handle<v8::Value>* argv); v8::Local<v8::Value>* argv);
virtual size_t self_size() const = 0; virtual size_t self_size() const = 0;

7
src/cares_wrap.cc

@ -38,7 +38,6 @@ using v8::EscapableHandleScope;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -1240,9 +1239,9 @@ static void CaresTimerClose(Environment* env,
} }
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
int r = ares_library_init(ARES_LIB_INIT_ALL); int r = ares_library_init(ARES_LIB_INIT_ALL);

1
src/debug-agent.cc

@ -39,7 +39,6 @@ using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;

17
src/fs_event_wrap.cc

@ -14,7 +14,6 @@ namespace node {
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -24,9 +23,9 @@ using v8::Value;
class FSEventWrap: public HandleWrap { class FSEventWrap: public HandleWrap {
public: public:
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context); Local<Context> context);
static void New(const FunctionCallbackInfo<Value>& args); static void New(const FunctionCallbackInfo<Value>& args);
static void Start(const FunctionCallbackInfo<Value>& args); static void Start(const FunctionCallbackInfo<Value>& args);
static void Close(const FunctionCallbackInfo<Value>& args); static void Close(const FunctionCallbackInfo<Value>& args);
@ -34,7 +33,7 @@ class FSEventWrap: public HandleWrap {
size_t self_size() const override { return sizeof(*this); } size_t self_size() const override { return sizeof(*this); }
private: private:
FSEventWrap(Environment* env, Handle<Object> object); FSEventWrap(Environment* env, Local<Object> object);
virtual ~FSEventWrap() override; virtual ~FSEventWrap() override;
static void OnEvent(uv_fs_event_t* handle, const char* filename, int events, 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> object) FSEventWrap::FSEventWrap(Environment* env, Local<Object> object)
: HandleWrap(env, : HandleWrap(env,
object, object,
reinterpret_cast<uv_handle_t*>(&handle_), reinterpret_cast<uv_handle_t*>(&handle_),
@ -59,9 +58,9 @@ FSEventWrap::~FSEventWrap() {
} }
void FSEventWrap::Initialize(Handle<Object> target, void FSEventWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);

3
src/handle_wrap.cc

@ -11,7 +11,6 @@ namespace node {
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
@ -59,7 +58,7 @@ void HandleWrap::Close(const FunctionCallbackInfo<Value>& args) {
HandleWrap::HandleWrap(Environment* env, HandleWrap::HandleWrap(Environment* env,
Handle<Object> object, Local<Object> object,
uv_handle_t* handle, uv_handle_t* handle,
AsyncWrap::ProviderType provider, AsyncWrap::ProviderType provider,
AsyncWrap* parent) AsyncWrap* parent)

2
src/handle_wrap.h

@ -44,7 +44,7 @@ class HandleWrap : public AsyncWrap {
protected: protected:
HandleWrap(Environment* env, HandleWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
uv_handle_t* handle, uv_handle_t* handle,
AsyncWrap::ProviderType provider, AsyncWrap::ProviderType provider,
AsyncWrap* parent = nullptr); AsyncWrap* parent = nullptr);

9
src/js_stream.cc

@ -15,14 +15,13 @@ using v8::Context;
using v8::External; using v8::External;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
using v8::Value; using v8::Value;
JSStream::JSStream(Environment* env, Handle<Object> obj, AsyncWrap* parent) JSStream::JSStream(Environment* env, Local<Object> obj, AsyncWrap* parent)
: StreamBase(env), : StreamBase(env),
AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent) { AsyncWrap(env, obj, AsyncWrap::PROVIDER_JSSTREAM, parent) {
node::Wrap(obj, this); node::Wrap(obj, this);
@ -201,9 +200,9 @@ void JSStream::EmitEOF(const FunctionCallbackInfo<Value>& args) {
} }
void JSStream::Initialize(Handle<Object> target, void JSStream::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);

8
src/js_stream.h

@ -10,9 +10,9 @@ namespace node {
class JSStream : public StreamBase, public AsyncWrap { class JSStream : public StreamBase, public AsyncWrap {
public: public:
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
~JSStream(); ~JSStream();
@ -31,7 +31,7 @@ class JSStream : public StreamBase, public AsyncWrap {
size_t self_size() const override { return sizeof(*this); } size_t self_size() const override { return sizeof(*this); }
protected: protected:
JSStream(Environment* env, v8::Handle<v8::Object> obj, AsyncWrap* parent); JSStream(Environment* env, v8::Local<v8::Object> obj, AsyncWrap* parent);
AsyncWrap* GetAsyncWrap() override; AsyncWrap* GetAsyncWrap() override;

91
src/node.cc

@ -92,7 +92,6 @@ using v8::Exception;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::HeapStatistics; using v8::HeapStatistics;
using v8::Integer; using v8::Integer;
@ -990,11 +989,11 @@ void SetupPromises(const FunctionCallbackInfo<Value>& args) {
} }
Handle<Value> MakeCallback(Environment* env, Local<Value> MakeCallback(Environment* env,
Handle<Value> recv, Local<Value> recv,
const Handle<Function> callback, const Local<Function> callback,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
// If you hit this assertion, you forgot to enter the v8::Context first. // If you hit this assertion, you forgot to enter the v8::Context first.
CHECK_EQ(env->context(), env->isolate()->GetCurrentContext()); CHECK_EQ(env->context(), env->isolate()->GetCurrentContext());
@ -1071,43 +1070,43 @@ Handle<Value> MakeCallback(Environment* env,
// Internal only. // Internal only.
Handle<Value> MakeCallback(Environment* env, Local<Value> MakeCallback(Environment* env,
Handle<Object> recv, Local<Object> recv,
uint32_t index, uint32_t index,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
Local<Value> cb_v = recv->Get(index); Local<Value> cb_v = recv->Get(index);
CHECK(cb_v->IsFunction()); CHECK(cb_v->IsFunction());
return MakeCallback(env, recv.As<Value>(), cb_v.As<Function>(), argc, argv); return MakeCallback(env, recv.As<Value>(), cb_v.As<Function>(), argc, argv);
} }
Handle<Value> MakeCallback(Environment* env, Local<Value> MakeCallback(Environment* env,
Handle<Object> recv, Local<Object> recv,
Handle<String> symbol, Local<String> symbol,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
Local<Value> cb_v = recv->Get(symbol); Local<Value> cb_v = recv->Get(symbol);
CHECK(cb_v->IsFunction()); CHECK(cb_v->IsFunction());
return MakeCallback(env, recv.As<Value>(), cb_v.As<Function>(), argc, argv); return MakeCallback(env, recv.As<Value>(), cb_v.As<Function>(), argc, argv);
} }
Handle<Value> MakeCallback(Environment* env, Local<Value> MakeCallback(Environment* env,
Handle<Object> recv, Local<Object> recv,
const char* method, const char* method,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
Local<String> method_string = OneByteString(env->isolate(), method); Local<String> method_string = OneByteString(env->isolate(), method);
return MakeCallback(env, recv, method_string, argc, argv); return MakeCallback(env, recv, method_string, argc, argv);
} }
Handle<Value> MakeCallback(Isolate* isolate, Local<Value> MakeCallback(Isolate* isolate,
Handle<Object> recv, Local<Object> recv,
const char* method, const char* method,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
EscapableHandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
Local<Context> context = recv->CreationContext(); Local<Context> context = recv->CreationContext();
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
@ -1117,11 +1116,11 @@ Handle<Value> MakeCallback(Isolate* isolate,
} }
Handle<Value> MakeCallback(Isolate* isolate, Local<Value> MakeCallback(Isolate* isolate,
Handle<Object> recv, Local<Object> recv,
Handle<String> symbol, Local<String> symbol,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
EscapableHandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
Local<Context> context = recv->CreationContext(); Local<Context> context = recv->CreationContext();
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
@ -1131,11 +1130,11 @@ Handle<Value> MakeCallback(Isolate* isolate,
} }
Handle<Value> MakeCallback(Isolate* isolate, Local<Value> MakeCallback(Isolate* isolate,
Handle<Object> recv, Local<Object> recv,
Handle<Function> callback, Local<Function> callback,
int argc, int argc,
Handle<Value> argv[]) { Local<Value> argv[]) {
EscapableHandleScope handle_scope(isolate); EscapableHandleScope handle_scope(isolate);
Local<Context> context = recv->CreationContext(); Local<Context> context = recv->CreationContext();
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
@ -1225,7 +1224,7 @@ enum encoding ParseEncoding(const char* encoding,
enum encoding ParseEncoding(Isolate* isolate, enum encoding ParseEncoding(Isolate* isolate,
Handle<Value> encoding_v, Local<Value> encoding_v,
enum encoding default_encoding) { enum encoding default_encoding) {
if (!encoding_v->IsString()) if (!encoding_v->IsString())
return default_encoding; return default_encoding;
@ -1249,7 +1248,7 @@ Local<Value> Encode(Isolate* isolate, const uint16_t* buf, size_t len) {
// Returns -1 if the handle was not valid for decoding // Returns -1 if the handle was not valid for decoding
ssize_t DecodeBytes(Isolate* isolate, ssize_t DecodeBytes(Isolate* isolate,
Handle<Value> val, Local<Value> val,
enum encoding encoding) { enum encoding encoding) {
HandleScope scope(isolate); HandleScope scope(isolate);
@ -1267,14 +1266,14 @@ ssize_t DecodeBytes(Isolate* isolate,
ssize_t DecodeWrite(Isolate* isolate, ssize_t DecodeWrite(Isolate* isolate,
char* buf, char* buf,
size_t buflen, size_t buflen,
Handle<Value> val, Local<Value> val,
enum encoding encoding) { enum encoding encoding) {
return StringBytes::Write(isolate, buf, buflen, val, encoding, nullptr); return StringBytes::Write(isolate, buf, buflen, val, encoding, nullptr);
} }
void AppendExceptionLine(Environment* env, void AppendExceptionLine(Environment* env,
Handle<Value> er, Local<Value> er,
Handle<Message> message) { Local<Message> message) {
if (message.IsEmpty()) if (message.IsEmpty())
return; return;
@ -1373,8 +1372,8 @@ void AppendExceptionLine(Environment* env,
static void ReportException(Environment* env, static void ReportException(Environment* env,
Handle<Value> er, Local<Value> er,
Handle<Message> message) { Local<Message> message) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
AppendExceptionLine(env, er, message); 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. // Executes a str within the current v8 context.
static Local<Value> ExecuteString(Environment* env, static Local<Value> ExecuteString(Environment* env,
Handle<String> source, Local<String> source,
Handle<String> filename) { Local<String> filename) {
EscapableHandleScope scope(env->isolate()); EscapableHandleScope scope(env->isolate());
TryCatch try_catch; TryCatch try_catch;
@ -1673,7 +1672,7 @@ static const char* name_by_gid(gid_t gid) {
#endif #endif
static uid_t uid_by_name(Isolate* isolate, Handle<Value> value) { static uid_t uid_by_name(Isolate* isolate, Local<Value> value) {
if (value->IsUint32()) { if (value->IsUint32()) {
return static_cast<uid_t>(value->Uint32Value()); return static_cast<uid_t>(value->Uint32Value());
} else { } else {
@ -1683,7 +1682,7 @@ static uid_t uid_by_name(Isolate* isolate, Handle<Value> value) {
} }
static gid_t gid_by_name(Isolate* isolate, Handle<Value> value) { static gid_t gid_by_name(Isolate* isolate, Local<Value> value) {
if (value->IsUint32()) { if (value->IsUint32()) {
return static_cast<gid_t>(value->Uint32Value()); return static_cast<gid_t>(value->Uint32Value());
} else { } else {
@ -2040,7 +2039,7 @@ struct node_module* get_linked_module(const char* name) {
return mp; return mp;
} }
typedef void (UV_DYNAMIC* extInit)(Handle<Object> exports); typedef void (UV_DYNAMIC* extInit)(Local<Object> exports);
// DLOpen is process.dlopen(module, filename). // DLOpen is process.dlopen(module, filename).
// Used to load 'module.node' dynamically shared objects. // 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, void FatalException(Isolate* isolate,
Handle<Value> error, Local<Value> error,
Handle<Message> message) { Local<Message> message) {
HandleScope scope(isolate); HandleScope scope(isolate);
Environment* env = Environment::GetCurrent(isolate); Environment* env = Environment::GetCurrent(isolate);
@ -2189,7 +2188,7 @@ void FatalException(Isolate* isolate, const TryCatch& try_catch) {
} }
void OnMessage(Handle<Message> message, Handle<Value> error) { void OnMessage(Local<Message> message, Local<Value> error) {
// The current version of V8 sends messages for errors only // The current version of V8 sends messages for errors only
// (thus `error` is always set). // (thus `error` is always set).
FatalException(Isolate::GetCurrent(), error, message); FatalException(Isolate::GetCurrent(), error, message);
@ -2458,7 +2457,7 @@ static void EnvEnumerator(const PropertyCallbackInfo<Array>& info) {
} }
static Handle<Object> GetFeatures(Environment* env) { static Local<Object> GetFeatures(Environment* env) {
EscapableHandleScope scope(env->isolate()); EscapableHandleScope scope(env->isolate());
Local<Object> obj = Object::New(env->isolate()); Local<Object> obj = Object::New(env->isolate());
@ -3742,7 +3741,7 @@ int EmitExit(Environment* env) {
Local<Object> process_object = env->process_object(); Local<Object> process_object = env->process_object();
process_object->Set(env->exiting_string(), True(env->isolate())); process_object->Set(env->exiting_string(), True(env->isolate()));
Handle<String> exitCode = env->exit_code_string(); Local<String> exitCode = env->exit_code_string();
int code = process_object->Get(exitCode)->Int32Value(); int code = process_object->Get(exitCode)->Int32Value();
Local<Value> args[] = { Local<Value> args[] = {
@ -3759,7 +3758,7 @@ int EmitExit(Environment* env) {
// Just a convenience method // Just a convenience method
Environment* CreateEnvironment(Isolate* isolate, Environment* CreateEnvironment(Isolate* isolate,
Handle<Context> context, Local<Context> context,
int argc, int argc,
const char* const* argv, const char* const* argv,
int exec_argc, int exec_argc,
@ -3781,7 +3780,7 @@ Environment* CreateEnvironment(Isolate* isolate,
} }
static Environment* CreateEnvironment(Isolate* isolate, static Environment* CreateEnvironment(Isolate* isolate,
Handle<Context> context, Local<Context> context,
NodeInstanceData* instance_data) { NodeInstanceData* instance_data) {
return CreateEnvironment(isolate, return CreateEnvironment(isolate,
instance_data->event_loop(), instance_data->event_loop(),
@ -3809,7 +3808,7 @@ static void HandleCleanup(Environment* env,
Environment* CreateEnvironment(Isolate* isolate, Environment* CreateEnvironment(Isolate* isolate,
uv_loop_t* loop, uv_loop_t* loop,
Handle<Context> context, Local<Context> context,
int argc, int argc,
const char* const* argv, const char* const* argv,
int exec_argc, int exec_argc,

54
src/node.h

@ -131,24 +131,24 @@ inline v8::Local<v8::Value> UVException(int errorno,
* cb, you will appear to leak 4-bytes for every invocation. Take heed. * cb, you will appear to leak 4-bytes for every invocation. Take heed.
*/ */
NODE_EXTERN v8::Handle<v8::Value> MakeCallback( NODE_EXTERN v8::Local<v8::Value> MakeCallback(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::Object> recv, v8::Local<v8::Object> recv,
const char* method, const char* method,
int argc, int argc,
v8::Handle<v8::Value>* argv); v8::Local<v8::Value>* argv);
NODE_EXTERN v8::Handle<v8::Value> MakeCallback( NODE_EXTERN v8::Local<v8::Value> MakeCallback(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::Object> recv, v8::Local<v8::Object> recv,
v8::Handle<v8::String> symbol, v8::Local<v8::String> symbol,
int argc, int argc,
v8::Handle<v8::Value>* argv); v8::Local<v8::Value>* argv);
NODE_EXTERN v8::Handle<v8::Value> MakeCallback( NODE_EXTERN v8::Local<v8::Value> MakeCallback(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::Object> recv, v8::Local<v8::Object> recv,
v8::Handle<v8::Function> callback, v8::Local<v8::Function> callback,
int argc, int argc,
v8::Handle<v8::Value>* argv); v8::Local<v8::Value>* argv);
} // namespace node } // namespace node
@ -190,7 +190,7 @@ class Environment;
NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate, NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate,
struct uv_loop_s* loop, struct uv_loop_s* loop,
v8::Handle<v8::Context> context, v8::Local<v8::Context> context,
int argc, int argc,
const char* const* argv, const char* const* argv,
int exec_argc, int exec_argc,
@ -201,7 +201,7 @@ NODE_EXTERN void LoadEnvironment(Environment* env);
// CreateEnvironment() + LoadEnvironment() from above. // CreateEnvironment() + LoadEnvironment() from above.
// `uv_default_loop()` will be passed as `loop`. // `uv_default_loop()` will be passed as `loop`.
NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate, NODE_EXTERN Environment* CreateEnvironment(v8::Isolate* isolate,
v8::Handle<v8::Context> context, v8::Local<v8::Context> context,
int argc, int argc,
const char* const* argv, const char* const* argv,
int exec_argc, int exec_argc,
@ -249,14 +249,14 @@ inline void NODE_SET_METHOD(const TypeName& recv,
// Used to be a macro, hence the uppercase name. // Used to be a macro, hence the uppercase name.
// Not a template because it only makes sense for FunctionTemplates. // Not a template because it only makes sense for FunctionTemplates.
inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle<v8::FunctionTemplate> recv, inline void NODE_SET_PROTOTYPE_METHOD(v8::Local<v8::FunctionTemplate> recv,
const char* name, const char* name,
v8::FunctionCallback callback) { v8::FunctionCallback callback) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();
v8::HandleScope handle_scope(isolate); v8::HandleScope handle_scope(isolate);
v8::Handle<v8::Signature> s = v8::Signature::New(isolate, recv); v8::Local<v8::Signature> s = v8::Signature::New(isolate, recv);
v8::Local<v8::FunctionTemplate> t = v8::Local<v8::FunctionTemplate> t =
v8::FunctionTemplate::New(isolate, callback, v8::Handle<v8::Value>(), s); v8::FunctionTemplate::New(isolate, callback, v8::Local<v8::Value>(), s);
v8::Local<v8::Function> fn = t->GetFunction(); v8::Local<v8::Function> fn = t->GetFunction();
recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), fn); recv->PrototypeTemplate()->Set(v8::String::NewFromUtf8(isolate, name), fn);
v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name); v8::Local<v8::String> fn_name = v8::String::NewFromUtf8(isolate, name);
@ -267,11 +267,11 @@ inline void NODE_SET_PROTOTYPE_METHOD(v8::Handle<v8::FunctionTemplate> recv,
enum encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER}; enum encoding {ASCII, UTF8, BASE64, UCS2, BINARY, HEX, BUFFER};
NODE_EXTERN enum encoding ParseEncoding( NODE_EXTERN enum encoding ParseEncoding(
v8::Isolate* isolate, v8::Isolate* isolate,
v8::Handle<v8::Value> encoding_v, v8::Local<v8::Value> encoding_v,
enum encoding default_encoding = BINARY); enum encoding default_encoding = BINARY);
NODE_DEPRECATED("Use ParseEncoding(isolate, ...)", NODE_DEPRECATED("Use ParseEncoding(isolate, ...)",
inline enum encoding ParseEncoding( inline enum encoding ParseEncoding(
v8::Handle<v8::Value> encoding_v, v8::Local<v8::Value> encoding_v,
enum encoding default_encoding = BINARY) { enum encoding default_encoding = BINARY) {
return ParseEncoding(v8::Isolate::GetCurrent(), encoding_v, default_encoding); 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 // Returns -1 if the handle was not valid for decoding
NODE_EXTERN ssize_t DecodeBytes(v8::Isolate* isolate, NODE_EXTERN ssize_t DecodeBytes(v8::Isolate* isolate,
v8::Handle<v8::Value>, v8::Local<v8::Value>,
enum encoding encoding = BINARY); enum encoding encoding = BINARY);
NODE_DEPRECATED("Use DecodeBytes(isolate, ...)", NODE_DEPRECATED("Use DecodeBytes(isolate, ...)",
inline ssize_t DecodeBytes( inline ssize_t DecodeBytes(
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
enum encoding encoding = BINARY) { enum encoding encoding = BINARY) {
return DecodeBytes(v8::Isolate::GetCurrent(), val, encoding); return DecodeBytes(v8::Isolate::GetCurrent(), val, encoding);
}) })
@ -325,12 +325,12 @@ NODE_DEPRECATED("Use DecodeBytes(isolate, ...)",
NODE_EXTERN ssize_t DecodeWrite(v8::Isolate* isolate, NODE_EXTERN ssize_t DecodeWrite(v8::Isolate* isolate,
char* buf, char* buf,
size_t buflen, size_t buflen,
v8::Handle<v8::Value>, v8::Local<v8::Value>,
enum encoding encoding = BINARY); enum encoding encoding = BINARY);
NODE_DEPRECATED("Use DecodeWrite(isolate, ...)", NODE_DEPRECATED("Use DecodeWrite(isolate, ...)",
inline ssize_t DecodeWrite(char* buf, inline ssize_t DecodeWrite(char* buf,
size_t buflen, size_t buflen,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
enum encoding encoding = BINARY) { enum encoding encoding = BINARY) {
return DecodeWrite(v8::Isolate::GetCurrent(), buf, buflen, val, encoding); return DecodeWrite(v8::Isolate::GetCurrent(), buf, buflen, val, encoding);
}) })
@ -359,14 +359,14 @@ const char *signo_string(int errorno);
typedef void (*addon_register_func)( typedef void (*addon_register_func)(
v8::Handle<v8::Object> exports, v8::Local<v8::Object> exports,
v8::Handle<v8::Value> module, v8::Local<v8::Value> module,
void* priv); void* priv);
typedef void (*addon_context_register_func)( typedef void (*addon_context_register_func)(
v8::Handle<v8::Object> exports, v8::Local<v8::Object> exports,
v8::Handle<v8::Value> module, v8::Local<v8::Value> module,
v8::Handle<v8::Context> context, v8::Local<v8::Context> context,
void* priv); void* priv);
#define NM_F_BUILTIN 0x01 #define NM_F_BUILTIN 0x01

27
src/node_buffer.cc

@ -57,7 +57,6 @@ using v8::EscapableHandleScope;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;
@ -78,7 +77,7 @@ class CallbackInfo {
public: public:
static inline void Free(char* data, void* hint); static inline void Free(char* data, void* hint);
static inline CallbackInfo* New(Isolate* isolate, static inline CallbackInfo* New(Isolate* isolate,
Handle<Object> object, Local<Object> object,
FreeCallback callback, FreeCallback callback,
void* hint = 0); void* hint = 0);
inline void Dispose(Isolate* isolate); inline void Dispose(Isolate* isolate);
@ -87,7 +86,7 @@ class CallbackInfo {
static void WeakCallback(const WeakCallbackData<Object, CallbackInfo>&); static void WeakCallback(const WeakCallbackData<Object, CallbackInfo>&);
inline void WeakCallback(Isolate* isolate, Local<Object> object); inline void WeakCallback(Isolate* isolate, Local<Object> object);
inline CallbackInfo(Isolate* isolate, inline CallbackInfo(Isolate* isolate,
Handle<Object> object, Local<Object> object,
FreeCallback callback, FreeCallback callback,
void* hint); void* hint);
~CallbackInfo(); ~CallbackInfo();
@ -104,7 +103,7 @@ void CallbackInfo::Free(char* data, void*) {
CallbackInfo* CallbackInfo::New(Isolate* isolate, CallbackInfo* CallbackInfo::New(Isolate* isolate,
Handle<Object> object, Local<Object> object,
FreeCallback callback, FreeCallback callback,
void* hint) { void* hint) {
return new CallbackInfo(isolate, object, callback, hint); return new CallbackInfo(isolate, object, callback, hint);
@ -122,7 +121,7 @@ Persistent<Object>* CallbackInfo::persistent() {
CallbackInfo::CallbackInfo(Isolate* isolate, CallbackInfo::CallbackInfo(Isolate* isolate,
Handle<Object> object, Local<Object> object,
FreeCallback callback, FreeCallback callback,
void* hint) void* hint)
: persistent_(isolate, object), : persistent_(isolate, object),
@ -162,12 +161,12 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local<Object> object) {
// Buffer methods // Buffer methods
bool HasInstance(Handle<Value> val) { bool HasInstance(Local<Value> val) {
return val->IsObject() && HasInstance(val.As<Object>()); return val->IsObject() && HasInstance(val.As<Object>());
} }
bool HasInstance(Handle<Object> obj) { bool HasInstance(Local<Object> obj) {
if (!obj->IsUint8Array()) if (!obj->IsUint8Array())
return false; return false;
Local<Uint8Array> array = obj.As<Uint8Array>(); Local<Uint8Array> array = obj.As<Uint8Array>();
@ -176,7 +175,7 @@ bool HasInstance(Handle<Object> obj) {
} }
char* Data(Handle<Value> val) { char* Data(Local<Value> val) {
CHECK(val->IsObject()); CHECK(val->IsObject());
// Use a fully qualified name here to work around a bug in gcc 4.2. // 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. // It mistakes an unadorned call to Data() for the v8::String::Data type.
@ -184,7 +183,7 @@ char* Data(Handle<Value> val) {
} }
char* Data(Handle<Object> obj) { char* Data(Local<Object> obj) {
CHECK(obj->IsUint8Array()); CHECK(obj->IsUint8Array());
Local<Uint8Array> ui = obj.As<Uint8Array>(); Local<Uint8Array> ui = obj.As<Uint8Array>();
ArrayBuffer::Contents ab_c = ui->Buffer()->GetContents(); ArrayBuffer::Contents ab_c = ui->Buffer()->GetContents();
@ -192,13 +191,13 @@ char* Data(Handle<Object> obj) {
} }
size_t Length(Handle<Value> val) { size_t Length(Local<Value> val) {
CHECK(val->IsObject()); CHECK(val->IsObject());
return Length(val.As<Object>()); return Length(val.As<Object>());
} }
size_t Length(Handle<Object> obj) { size_t Length(Local<Object> obj) {
CHECK(obj->IsUint8Array()); CHECK(obj->IsUint8Array());
Local<Uint8Array> ui = obj.As<Uint8Array>(); Local<Uint8Array> ui = obj.As<Uint8Array>();
return ui->ByteLength(); return ui->ByteLength();
@ -993,9 +992,9 @@ void SetupBufferJS(const FunctionCallbackInfo<Value>& args) {
} }
void Initialize(Handle<Object> target, void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "setupBufferJS", SetupBufferJS); env->SetMethod(target, "setupBufferJS", SetupBufferJS);

14
src/node_buffer.h

@ -12,12 +12,12 @@ static const unsigned int kMaxLength =
NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint); NODE_EXTERN typedef void (*FreeCallback)(char* data, void* hint);
NODE_EXTERN bool HasInstance(v8::Handle<v8::Value> val); NODE_EXTERN bool HasInstance(v8::Local<v8::Value> val);
NODE_EXTERN bool HasInstance(v8::Handle<v8::Object> val); NODE_EXTERN bool HasInstance(v8::Local<v8::Object> val);
NODE_EXTERN char* Data(v8::Handle<v8::Value> val); NODE_EXTERN char* Data(v8::Local<v8::Value> val);
NODE_EXTERN char* Data(v8::Handle<v8::Object> val); NODE_EXTERN char* Data(v8::Local<v8::Object> val);
NODE_EXTERN size_t Length(v8::Handle<v8::Value> val); NODE_EXTERN size_t Length(v8::Local<v8::Value> val);
NODE_EXTERN size_t Length(v8::Handle<v8::Object> val); NODE_EXTERN size_t Length(v8::Local<v8::Object> val);
// public constructor - data is copied // public constructor - data is copied
NODE_EXTERN v8::MaybeLocal<v8::Object> Copy(v8::Isolate* isolate, NODE_EXTERN v8::MaybeLocal<v8::Object> Copy(v8::Isolate* isolate,
@ -29,7 +29,7 @@ NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, size_t length);
// public constructor from string // public constructor from string
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate,
v8::Handle<v8::String> string, v8::Local<v8::String> string,
enum encoding enc = UTF8); enum encoding enc = UTF8);
// public constructor - data is used, callback is passed data on object gc // public constructor - data is used, callback is passed data on object gc

18
src/node_constants.cc

@ -21,14 +21,14 @@
namespace node { namespace node {
using v8::Handle; using v8::Local;
using v8::Object; using v8::Object;
#if HAVE_OPENSSL #if HAVE_OPENSSL
const char* default_cipher_list = DEFAULT_CIPHER_LIST_CORE; const char* default_cipher_list = DEFAULT_CIPHER_LIST_CORE;
#endif #endif
void DefineErrnoConstants(Handle<Object> target) { void DefineErrnoConstants(Local<Object> target) {
#ifdef E2BIG #ifdef E2BIG
NODE_DEFINE_CONSTANT(target, E2BIG); NODE_DEFINE_CONSTANT(target, E2BIG);
#endif #endif
@ -346,7 +346,7 @@ void DefineErrnoConstants(Handle<Object> target) {
#endif #endif
} }
void DefineWindowsErrorConstants(Handle<Object> target) { void DefineWindowsErrorConstants(Local<Object> target) {
#ifdef WSAEINTR #ifdef WSAEINTR
NODE_DEFINE_CONSTANT(target, WSAEINTR); NODE_DEFINE_CONSTANT(target, WSAEINTR);
#endif #endif
@ -580,7 +580,7 @@ void DefineWindowsErrorConstants(Handle<Object> target) {
#endif #endif
} }
void DefineSignalConstants(Handle<Object> target) { void DefineSignalConstants(Local<Object> target) {
#ifdef SIGHUP #ifdef SIGHUP
NODE_DEFINE_CONSTANT(target, SIGHUP); NODE_DEFINE_CONSTANT(target, SIGHUP);
#endif #endif
@ -725,7 +725,7 @@ void DefineSignalConstants(Handle<Object> target) {
#endif #endif
} }
void DefineOpenSSLConstants(Handle<Object> target) { void DefineOpenSSLConstants(Local<Object> target) {
#ifdef SSL_OP_ALL #ifdef SSL_OP_ALL
NODE_DEFINE_CONSTANT(target, SSL_OP_ALL); NODE_DEFINE_CONSTANT(target, SSL_OP_ALL);
#endif #endif
@ -969,7 +969,7 @@ void DefineOpenSSLConstants(Handle<Object> target) {
#endif #endif
} }
void DefineSystemConstants(Handle<Object> target) { void DefineSystemConstants(Local<Object> target) {
// file access modes // file access modes
NODE_DEFINE_CONSTANT(target, O_RDONLY); NODE_DEFINE_CONSTANT(target, O_RDONLY);
NODE_DEFINE_CONSTANT(target, O_WRONLY); NODE_DEFINE_CONSTANT(target, O_WRONLY);
@ -1108,11 +1108,11 @@ void DefineSystemConstants(Handle<Object> target) {
#endif #endif
} }
void DefineUVConstants(Handle<Object> target) { void DefineUVConstants(Local<Object> target) {
NODE_DEFINE_CONSTANT(target, UV_UDP_REUSEADDR); NODE_DEFINE_CONSTANT(target, UV_UDP_REUSEADDR);
} }
void DefineCryptoConstants(Handle<Object> target) { void DefineCryptoConstants(Local<Object> target) {
#if HAVE_OPENSSL #if HAVE_OPENSSL
NODE_DEFINE_STRING_CONSTANT(target, NODE_DEFINE_STRING_CONSTANT(target,
"defaultCoreCipherList", "defaultCoreCipherList",
@ -1123,7 +1123,7 @@ void DefineCryptoConstants(Handle<Object> target) {
#endif #endif
} }
void DefineConstants(Handle<Object> target) { void DefineConstants(Local<Object> target) {
DefineErrnoConstants(target); DefineErrnoConstants(target);
DefineWindowsErrorConstants(target); DefineWindowsErrorConstants(target);
DefineSignalConstants(target); DefineSignalConstants(target);

2
src/node_constants.h

@ -34,7 +34,7 @@ namespace node {
extern const char* default_cipher_list; extern const char* default_cipher_list;
#endif #endif
void DefineConstants(v8::Handle<v8::Object> target); void DefineConstants(v8::Local<v8::Object> target);
} // namespace node } // namespace node
#endif // SRC_NODE_CONSTANTS_H_ #endif // SRC_NODE_CONSTANTS_H_

9
src/node_contextify.cc

@ -21,7 +21,6 @@ using v8::External;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;
@ -189,7 +188,7 @@ class ContextifyContext {
Local<Object> wrapper = Local<Object> wrapper =
env->script_data_constructor_function()->NewInstance(); env->script_data_constructor_function()->NewInstance();
if (wrapper.IsEmpty()) if (wrapper.IsEmpty())
return scope.Escape(Local<Value>::New(env->isolate(), Handle<Value>())); return scope.Escape(Local<Value>::New(env->isolate(), Local<Value>()));
Wrap(wrapper, this); Wrap(wrapper, this);
return scope.Escape(wrapper); return scope.Escape(wrapper);
@ -732,9 +731,9 @@ class ContextifyScript : public BaseObject {
}; };
void InitContextify(Handle<Object> target, void InitContextify(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
ContextifyContext::Init(env, target); ContextifyContext::Init(env, target);
ContextifyScript::Init(env, target); ContextifyScript::Init(env, target);

5
src/node_counters.cc

@ -14,7 +14,6 @@ using v8::GCCallbackFlags;
using v8::GCEpilogueCallback; using v8::GCEpilogueCallback;
using v8::GCPrologueCallback; using v8::GCPrologueCallback;
using v8::GCType; using v8::GCType;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Isolate; using v8::Isolate;
using v8::Local; using v8::Local;
@ -82,7 +81,7 @@ static void counter_gc_done(Isolate* isolate,
} }
void InitPerfCounters(Environment* env, Handle<Object> target) { void InitPerfCounters(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
static struct { static struct {
@ -118,7 +117,7 @@ void InitPerfCounters(Environment* env, Handle<Object> target) {
} }
void TermPerfCounters(Handle<Object> target) { void TermPerfCounters(Local<Object> target) {
// Only Windows performance counters supported // Only Windows performance counters supported
// To enable other OS, use conditional compilation here // To enable other OS, use conditional compilation here
TermPerfCountersWin32(); TermPerfCountersWin32();

4
src/node_counters.h

@ -26,8 +26,8 @@
namespace node { namespace node {
void InitPerfCounters(Environment* env, v8::Handle<v8::Object> target); void InitPerfCounters(Environment* env, v8::Local<v8::Object> target);
void TermPerfCounters(v8::Handle<v8::Object> target); void TermPerfCounters(v8::Local<v8::Object> target);
} // namespace node } // namespace node

37
src/node_crypto.cc

@ -72,7 +72,6 @@ using v8::External;
using v8::False; using v8::False;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;
@ -135,7 +134,7 @@ X509_STORE* root_cert_store;
// Just to generate static methods // Just to generate static methods
template class SSLWrap<TLSWrap>; template class SSLWrap<TLSWrap>;
template void SSLWrap<TLSWrap>::AddMethods(Environment* env, template void SSLWrap<TLSWrap>::AddMethods(Environment* env,
Handle<FunctionTemplate> t); Local<FunctionTemplate> t);
template void SSLWrap<TLSWrap>::InitNPN(SecureContext* sc); template void SSLWrap<TLSWrap>::InitNPN(SecureContext* sc);
template SSL_SESSION* SSLWrap<TLSWrap>::GetSessionCallback( template SSL_SESSION* SSLWrap<TLSWrap>::GetSessionCallback(
SSL* s, SSL* s,
@ -276,7 +275,7 @@ bool EntropySource(unsigned char* buffer, size_t length) {
} }
void SecureContext::Initialize(Environment* env, Handle<Object> target) { void SecureContext::Initialize(Environment* env, Local<Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(SecureContext::New); Local<FunctionTemplate> t = env->NewFunctionTemplate(SecureContext::New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "SecureContext")); t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "SecureContext"));
@ -415,7 +414,7 @@ void SecureContext::Init(const FunctionCallbackInfo<Value>& args) {
// Takes a string or buffer and loads it into a BIO. // Takes a string or buffer and loads it into a BIO.
// Caller responsible for BIO_free_all-ing the returned object. // Caller responsible for BIO_free_all-ing the returned object.
static BIO* LoadBIO(Environment* env, Handle<Value> v) { static BIO* LoadBIO(Environment* env, Local<Value> v) {
BIO* bio = NodeBIO::New(); BIO* bio = NodeBIO::New();
if (!bio) if (!bio)
return nullptr; return nullptr;
@ -444,7 +443,7 @@ static BIO* LoadBIO(Environment* env, Handle<Value> v) {
// Takes a string or buffer and loads it into an X509 // Takes a string or buffer and loads it into an X509
// Caller responsible for X509_free-ing the returned object. // Caller responsible for X509_free-ing the returned object.
static X509* LoadX509(Environment* env, Handle<Value> v) { static X509* LoadX509(Environment* env, Local<Value> v) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
BIO *bio = LoadBIO(env, v); BIO *bio = LoadBIO(env, v);
@ -1122,7 +1121,7 @@ void SecureContext::GetCertificate(const FunctionCallbackInfo<Value>& args) {
template <class Base> template <class Base>
void SSLWrap<Base>::AddMethods(Environment* env, Handle<FunctionTemplate> t) { void SSLWrap<Base>::AddMethods(Environment* env, Local<FunctionTemplate> t) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
env->SetProtoMethod(t, "getPeerCertificate", GetPeerCertificate); env->SetProtoMethod(t, "getPeerCertificate", GetPeerCertificate);
@ -1914,7 +1913,7 @@ int SSLWrap<Base>::SelectNextProtoCallback(SSL* s,
size_t len = Buffer::Length(obj); size_t len = Buffer::Length(obj);
int status = SSL_select_next_proto(out, outlen, in, inlen, npn_protos, len); int status = SSL_select_next_proto(out, outlen, in, inlen, npn_protos, len);
Handle<Value> result; Local<Value> result;
switch (status) { switch (status) {
case OPENSSL_NPN_UNSUPPORTED: case OPENSSL_NPN_UNSUPPORTED:
result = Null(env->isolate()); result = Null(env->isolate());
@ -2326,7 +2325,7 @@ void Connection::NewSessionDoneCb() {
} }
void Connection::Initialize(Environment* env, Handle<Object> target) { void Connection::Initialize(Environment* env, Local<Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(Connection::New); Local<FunctionTemplate> t = env->NewFunctionTemplate(Connection::New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Connection")); t->SetClassName(FIXED_ONE_BYTE_STRING(env->isolate(), "Connection"));
@ -2841,7 +2840,7 @@ void Connection::SetSNICallback(const FunctionCallbackInfo<Value>& args) {
#endif #endif
void CipherBase::Initialize(Environment* env, Handle<Object> target) { void CipherBase::Initialize(Environment* env, Local<Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
@ -3212,7 +3211,7 @@ void CipherBase::Final(const FunctionCallbackInfo<Value>& args) {
} }
void Hmac::Initialize(Environment* env, v8::Handle<v8::Object> target) { void Hmac::Initialize(Environment* env, v8::Local<v8::Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
@ -3341,7 +3340,7 @@ void Hmac::HmacDigest(const FunctionCallbackInfo<Value>& args) {
} }
void Hash::Initialize(Environment* env, v8::Handle<v8::Object> target) { void Hash::Initialize(Environment* env, v8::Local<v8::Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
@ -3486,7 +3485,7 @@ void SignBase::CheckThrow(SignBase::Error error) {
void Sign::Initialize(Environment* env, v8::Handle<v8::Object> target) { void Sign::Initialize(Environment* env, v8::Local<v8::Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
@ -3662,7 +3661,7 @@ void Sign::SignFinal(const FunctionCallbackInfo<Value>& args) {
} }
void Verify::Initialize(Environment* env, v8::Handle<v8::Object> target) { void Verify::Initialize(Environment* env, v8::Local<v8::Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
t->InstanceTemplate()->SetInternalFieldCount(1); t->InstanceTemplate()->SetInternalFieldCount(1);
@ -4006,7 +4005,7 @@ void PublicKeyCipher::Cipher(const FunctionCallbackInfo<Value>& args) {
} }
void DiffieHellman::Initialize(Environment* env, Handle<Object> target) { void DiffieHellman::Initialize(Environment* env, Local<Object> target) {
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
const PropertyAttribute attributes = const PropertyAttribute attributes =
@ -4392,7 +4391,7 @@ bool DiffieHellman::VerifyContext() {
} }
void ECDH::Initialize(Environment* env, Handle<Object> target) { void ECDH::Initialize(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
@ -5133,7 +5132,7 @@ void GetCurves(const FunctionCallbackInfo<Value>& args) {
} }
void Certificate::Initialize(Environment* env, Handle<Object> target) { void Certificate::Initialize(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
@ -5399,9 +5398,9 @@ void SetEngine(const FunctionCallbackInfo<Value>& args) {
// FIXME(bnoordhuis) Handle global init correctly. // FIXME(bnoordhuis) Handle global init correctly.
void InitCrypto(Handle<Object> target, void InitCrypto(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context, Local<Context> context,
void* priv) { void* priv) {
static uv_once_t init_once = UV_ONCE_INIT; static uv_once_t init_once = UV_ONCE_INIT;
uv_once(&init_once, InitCryptoOnce); uv_once(&init_once, InitCryptoOnce);

26
src/node_crypto.h

@ -59,7 +59,7 @@ class SecureContext : public BaseObject {
FreeCTXMem(); FreeCTXMem();
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
X509_STORE* ca_store_; X509_STORE* ca_store_;
SSL_CTX* ctx_; SSL_CTX* ctx_;
@ -209,7 +209,7 @@ class SSLWrap {
sizeof(SSL) + sizeof(SSL3_STATE) + 42 * 1024; sizeof(SSL) + sizeof(SSL3_STATE) + 42 * 1024;
static void InitNPN(SecureContext* sc); static void InitNPN(SecureContext* sc);
static void AddMethods(Environment* env, v8::Handle<v8::FunctionTemplate> t); static void AddMethods(Environment* env, v8::Local<v8::FunctionTemplate> t);
static SSL_SESSION* GetSessionCallback(SSL* s, static SSL_SESSION* GetSessionCallback(SSL* s,
unsigned char* key, unsigned char* key,
@ -311,7 +311,7 @@ class Connection : public SSLWrap<Connection>, public AsyncWrap {
#endif #endif
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
void NewSessionDoneCb(); void NewSessionDoneCb();
#ifdef OPENSSL_NPN_NEGOTIATED #ifdef OPENSSL_NPN_NEGOTIATED
@ -401,7 +401,7 @@ class CipherBase : public BaseObject {
EVP_CIPHER_CTX_cleanup(&ctx_); EVP_CIPHER_CTX_cleanup(&ctx_);
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
protected: protected:
enum CipherKind { enum CipherKind {
@ -464,7 +464,7 @@ class Hmac : public BaseObject {
HMAC_CTX_cleanup(&ctx_); HMAC_CTX_cleanup(&ctx_);
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
protected: protected:
void HmacInit(const char* hash_type, const char* key, int key_len); 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_); EVP_MD_CTX_cleanup(&mdctx_);
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
bool HashInit(const char* hash_type); bool HashInit(const char* hash_type);
bool HashUpdate(const char* data, int len); bool HashUpdate(const char* data, int len);
@ -555,7 +555,7 @@ class SignBase : public BaseObject {
class Sign : public SignBase { class Sign : public SignBase {
public: public:
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
Error SignInit(const char* sign_type); Error SignInit(const char* sign_type);
Error SignUpdate(const char* data, int len); Error SignUpdate(const char* data, int len);
@ -578,7 +578,7 @@ class Sign : public SignBase {
class Verify : public SignBase { class Verify : public SignBase {
public: public:
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
Error VerifyInit(const char* verify_type); Error VerifyInit(const char* verify_type);
Error VerifyUpdate(const char* data, int len); Error VerifyUpdate(const char* data, int len);
@ -637,7 +637,7 @@ class DiffieHellman : public BaseObject {
} }
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
bool Init(int primeLength, int g); bool Init(int primeLength, int g);
bool Init(const char* p, int p_len, int g); bool Init(const char* p, int p_len, int g);
@ -684,7 +684,7 @@ class ECDH : public BaseObject {
group_ = nullptr; group_ = nullptr;
} }
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
protected: protected:
ECDH(Environment* env, v8::Local<v8::Object> wrap, EC_KEY* key) ECDH(Environment* env, v8::Local<v8::Object> wrap, EC_KEY* key)
@ -713,9 +713,9 @@ class ECDH : public BaseObject {
class Certificate : public AsyncWrap { class Certificate : public AsyncWrap {
public: public:
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
v8::Handle<v8::Value> CertificateInit(const char* sign_type); v8::Local<v8::Value> CertificateInit(const char* sign_type);
bool VerifySpkac(const char* data, unsigned int len); bool VerifySpkac(const char* data, unsigned int len);
const char* ExportPublicKey(const char* data, int len); const char* ExportPublicKey(const char* data, int len);
const char* ExportChallenge(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 #ifndef OPENSSL_NO_ENGINE
void SetEngine(const v8::FunctionCallbackInfo<v8::Value>& args); void SetEngine(const v8::FunctionCallbackInfo<v8::Value>& args);
#endif // !OPENSSL_NO_ENGINE #endif // !OPENSSL_NO_ENGINE
void InitCrypto(v8::Handle<v8::Object> target); void InitCrypto(v8::Local<v8::Object> target);
} // namespace crypto } // namespace crypto
} // namespace node } // namespace node

3
src/node_dtrace.cc

@ -37,7 +37,6 @@ using v8::GCCallbackFlags;
using v8::GCEpilogueCallback; using v8::GCEpilogueCallback;
using v8::GCPrologueCallback; using v8::GCPrologueCallback;
using v8::GCType; using v8::GCType;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Isolate; using v8::Isolate;
using v8::Local; using v8::Local;
@ -241,7 +240,7 @@ void dtrace_gc_done(Isolate* isolate, GCType type, GCCallbackFlags flags) {
} }
void InitDTrace(Environment* env, Handle<Object> target) { void InitDTrace(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
static struct { static struct {

2
src/node_dtrace.h

@ -54,7 +54,7 @@ typedef struct {
namespace node { namespace node {
void InitDTrace(Environment* env, v8::Handle<v8::Object> target); void InitDTrace(Environment* env, v8::Local<v8::Object> target);
} // namespace node } // namespace node

7
src/node_file.cc

@ -32,7 +32,6 @@ using v8::EscapableHandleScope;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -1218,9 +1217,9 @@ void FSInitialize(const FunctionCallbackInfo<Value>& args) {
env->set_fs_stats_constructor_function(stats_constructor); env->set_fs_stats_constructor_function(stats_constructor);
} }
void InitFs(Handle<Object> target, void InitFs(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context, Local<Context> context,
void* priv) { void* priv) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);

2
src/node_file.h

@ -6,7 +6,7 @@
namespace node { namespace node {
void InitFs(v8::Handle<v8::Object> target); void InitFs(v8::Local<v8::Object> target);
} // namespace node } // namespace node

7
src/node_http_parser.cc

@ -43,7 +43,6 @@ using v8::Exception;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -687,9 +686,9 @@ const struct http_parser_settings Parser::settings = {
}; };
void InitHttpParser(Handle<Object> target, void InitHttpParser(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context, Local<Context> context,
void* priv) { void* priv) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(Parser::New); Local<FunctionTemplate> t = env->NewFunctionTemplate(Parser::New);

2
src/node_http_parser.h

@ -7,7 +7,7 @@
namespace node { namespace node {
void InitHttpParser(v8::Handle<v8::Object> target); void InitHttpParser(v8::Local<v8::Object> target);
} // namespace node } // namespace node

36
src/node_internals.h

@ -42,32 +42,32 @@ inline v8::Local<TypeName> PersistentToLocal(
const v8::Persistent<TypeName>& persistent); const v8::Persistent<TypeName>& persistent);
// Call with valid HandleScope and while inside Context scope. // Call with valid HandleScope and while inside Context scope.
v8::Handle<v8::Value> MakeCallback(Environment* env, v8::Local<v8::Value> MakeCallback(Environment* env,
v8::Handle<v8::Object> recv, v8::Local<v8::Object> recv,
const char* method, const char* method,
int argc = 0, int argc = 0,
v8::Handle<v8::Value>* argv = nullptr); v8::Local<v8::Value>* argv = nullptr);
// Call with valid HandleScope and while inside Context scope. // Call with valid HandleScope and while inside Context scope.
v8::Handle<v8::Value> MakeCallback(Environment* env, v8::Local<v8::Value> MakeCallback(Environment* env,
v8::Handle<v8::Object> recv, v8::Local<v8::Object> recv,
uint32_t index, uint32_t index,
int argc = 0, int argc = 0,
v8::Handle<v8::Value>* argv = nullptr); v8::Local<v8::Value>* argv = nullptr);
// Call with valid HandleScope and while inside Context scope. // Call with valid HandleScope and while inside Context scope.
v8::Handle<v8::Value> MakeCallback(Environment* env, v8::Local<v8::Value> MakeCallback(Environment* env,
v8::Handle<v8::Object> recv, v8::Local<v8::Object> recv,
v8::Handle<v8::String> symbol, v8::Local<v8::String> symbol,
int argc = 0, int argc = 0,
v8::Handle<v8::Value>* argv = nullptr); v8::Local<v8::Value>* argv = nullptr);
// Call with valid HandleScope and while inside Context scope. // Call with valid HandleScope and while inside Context scope.
v8::Handle<v8::Value> MakeCallback(Environment* env, v8::Local<v8::Value> MakeCallback(Environment* env,
v8::Handle<v8::Value> recv, v8::Local<v8::Value> recv,
v8::Handle<v8::Function> callback, v8::Local<v8::Function> callback,
int argc = 0, int argc = 0,
v8::Handle<v8::Value>* argv = nullptr); v8::Local<v8::Value>* argv = nullptr);
bool KickNextTick(); bool KickNextTick();
@ -77,7 +77,7 @@ bool KickNextTick();
v8::Local<v8::Object> AddressToJS( v8::Local<v8::Object> AddressToJS(
Environment* env, Environment* env,
const sockaddr* addr, const sockaddr* addr,
v8::Local<v8::Object> info = v8::Handle<v8::Object>()); v8::Local<v8::Object> info = v8::Local<v8::Object>());
template <typename T, int (*F)(const typename T::HandleType*, sockaddr*, int*)> template <typename T, int (*F)(const typename T::HandleType*, sockaddr*, int*)>
void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) { void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>& args) {
@ -130,8 +130,8 @@ inline static int snprintf(char* buf, unsigned int len, const char* fmt, ...) {
#endif #endif
void AppendExceptionLine(Environment* env, void AppendExceptionLine(Environment* env,
v8::Handle<v8::Value> er, v8::Local<v8::Value> er,
v8::Handle<v8::Message> message); v8::Local<v8::Message> message);
NO_RETURN void FatalError(const char* location, const char* message); NO_RETURN void FatalError(const char* location, const char* message);
@ -162,7 +162,7 @@ inline bool IsBigEndian() {
} }
// parse index for external array data // parse index for external array data
inline MUST_USE_RESULT bool ParseArrayIndex(v8::Handle<v8::Value> arg, inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local<v8::Value> arg,
size_t def, size_t def,
size_t* ret) { size_t* ret) {
if (arg->IsUndefined()) { if (arg->IsUndefined()) {

7
src/node_javascript.cc

@ -11,23 +11,22 @@
namespace node { namespace node {
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
using v8::String; using v8::String;
Handle<String> MainSource(Environment* env) { Local<String> MainSource(Environment* env) {
return OneByteString(env->isolate(), node_native, sizeof(node_native) - 1); return OneByteString(env->isolate(), node_native, sizeof(node_native) - 1);
} }
void DefineJavaScript(Environment* env, Handle<Object> target) { void DefineJavaScript(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
for (int i = 0; natives[i].name; i++) { for (int i = 0; natives[i].name; i++) {
if (natives[i].source != node_native) { if (natives[i].source != node_native) {
Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name); Local<String> name = String::NewFromUtf8(env->isolate(), natives[i].name);
Handle<String> source = String::NewFromUtf8(env->isolate(), Local<String> source = String::NewFromUtf8(env->isolate(),
natives[i].source, natives[i].source,
String::kNormalString, String::kNormalString,
natives[i].source_len); natives[i].source_len);

4
src/node_javascript.h

@ -6,8 +6,8 @@
namespace node { namespace node {
void DefineJavaScript(Environment* env, v8::Handle<v8::Object> target); void DefineJavaScript(Environment* env, v8::Local<v8::Object> target);
v8::Handle<v8::String> MainSource(Environment* env); v8::Local<v8::String> MainSource(Environment* env);
} // namespace node } // namespace node

3
src/node_lttng.cc

@ -32,7 +32,6 @@ using v8::GCCallbackFlags;
using v8::GCEpilogueCallback; using v8::GCEpilogueCallback;
using v8::GCPrologueCallback; using v8::GCPrologueCallback;
using v8::GCType; using v8::GCType;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Isolate; using v8::Isolate;
using v8::Local; using v8::Local;
@ -234,7 +233,7 @@ void lttng_gc_done(Isolate* isolate, GCType type, GCCallbackFlags flags) {
NODE_GC_DONE(type, flags, isolate); NODE_GC_DONE(type, flags, isolate);
} }
void InitLTTNG(Environment* env, Handle<Object> target) { void InitLTTNG(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
static struct { static struct {

2
src/node_lttng.h

@ -33,7 +33,7 @@ typedef struct {
namespace node { namespace node {
void InitLTTNG(Environment* env, v8::Handle<v8::Object> target); void InitLTTNG(Environment* env, v8::Local<v8::Object> target);
} // namespace node } // namespace node

4
src/node_object_wrap.h

@ -24,7 +24,7 @@ class ObjectWrap {
template <class T> template <class T>
static inline T* Unwrap(v8::Handle<v8::Object> handle) { static inline T* Unwrap(v8::Local<v8::Object> handle) {
assert(!handle.IsEmpty()); assert(!handle.IsEmpty());
assert(handle->InternalFieldCount() > 0); assert(handle->InternalFieldCount() > 0);
// Cast to ObjectWrap before casting to T. A direct cast from void // Cast to ObjectWrap before casting to T. A direct cast from void
@ -51,7 +51,7 @@ class ObjectWrap {
protected: protected:
inline void Wrap(v8::Handle<v8::Object> handle) { inline void Wrap(v8::Local<v8::Object> handle) {
assert(persistent().IsEmpty()); assert(persistent().IsEmpty());
assert(handle->InternalFieldCount() > 0); assert(handle->InternalFieldCount() > 0);
handle->SetAlignedPointerInInternalField(0, this); handle->SetAlignedPointerInInternalField(0, this);

7
src/node_os.cc

@ -30,7 +30,6 @@ using v8::Array;
using v8::Boolean; using v8::Boolean;
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
using v8::Number; using v8::Number;
@ -291,9 +290,9 @@ static void GetHomeDirectory(const FunctionCallbackInfo<Value>& args) {
} }
void Initialize(Handle<Object> target, void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "getHostname", GetHostname); env->SetMethod(target, "getHostname", GetHostname);
env->SetMethod(target, "getLoadAvg", GetLoadAvg); env->SetMethod(target, "getLoadAvg", GetLoadAvg);

3
src/node_stat_watcher.cc

@ -14,7 +14,6 @@ namespace node {
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -22,7 +21,7 @@ using v8::Object;
using v8::Value; using v8::Value;
void StatWatcher::Initialize(Environment* env, Handle<Object> target) { void StatWatcher::Initialize(Environment* env, Local<Object> target) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());
Local<FunctionTemplate> t = env->NewFunctionTemplate(StatWatcher::New); Local<FunctionTemplate> t = env->NewFunctionTemplate(StatWatcher::New);

2
src/node_stat_watcher.h

@ -13,7 +13,7 @@ class StatWatcher : public AsyncWrap {
public: public:
virtual ~StatWatcher() override; virtual ~StatWatcher() override;
static void Initialize(Environment* env, v8::Handle<v8::Object> target); static void Initialize(Environment* env, v8::Local<v8::Object> target);
protected: protected:
StatWatcher(Environment* env, v8::Local<v8::Object> wrap); StatWatcher(Environment* env, v8::Local<v8::Object> wrap);

7
src/node_v8.cc

@ -11,7 +11,6 @@ using v8::ArrayBuffer;
using v8::Context; using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HeapStatistics; using v8::HeapStatistics;
using v8::Isolate; using v8::Isolate;
using v8::Local; using v8::Local;
@ -59,9 +58,9 @@ void SetFlagsFromString(const FunctionCallbackInfo<Value>& args) {
} }
void InitializeV8Bindings(Handle<Object> target, void InitializeV8Bindings(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, env->SetMethod(target,
"updateHeapStatisticsArrayBuffer", "updateHeapStatisticsArrayBuffer",

9
src/node_zlib.cc

@ -22,7 +22,6 @@ using v8::Array;
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -43,7 +42,7 @@ enum node_zlib_mode {
}; };
void InitZlib(v8::Handle<v8::Object> target); void InitZlib(v8::Local<v8::Object> target);
/** /**
@ -573,9 +572,9 @@ class ZCtx : public AsyncWrap {
}; };
void InitZlib(Handle<Object> target, void InitZlib(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context, Local<Context> context,
void* priv) { void* priv) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> z = env->NewFunctionTemplate(ZCtx::New); Local<FunctionTemplate> z = env->NewFunctionTemplate(ZCtx::New);

9
src/pipe_wrap.cc

@ -22,7 +22,6 @@ using v8::External;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -70,9 +69,9 @@ Local<Object> PipeWrap::Instantiate(Environment* env, AsyncWrap* parent) {
} }
void PipeWrap::Initialize(Handle<Object> target, void PipeWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
@ -123,7 +122,7 @@ void PipeWrap::New(const FunctionCallbackInfo<Value>& args) {
PipeWrap::PipeWrap(Environment* env, PipeWrap::PipeWrap(Environment* env,
Handle<Object> object, Local<Object> object,
bool ipc, bool ipc,
AsyncWrap* parent) AsyncWrap* parent)
: StreamWrap(env, : StreamWrap(env,

8
src/pipe_wrap.h

@ -12,15 +12,15 @@ class PipeWrap : public StreamWrap {
uv_pipe_t* UVHandle(); uv_pipe_t* UVHandle();
static v8::Local<v8::Object> Instantiate(Environment* env, AsyncWrap* parent); static v8::Local<v8::Object> Instantiate(Environment* env, AsyncWrap* parent);
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
size_t self_size() const override { return sizeof(*this); } size_t self_size() const override { return sizeof(*this); }
private: private:
PipeWrap(Environment* env, PipeWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
bool ipc, bool ipc,
AsyncWrap* parent); AsyncWrap* parent);

9
src/process_wrap.cc

@ -15,7 +15,6 @@ using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -26,9 +25,9 @@ using v8::Value;
class ProcessWrap : public HandleWrap { class ProcessWrap : public HandleWrap {
public: public:
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New); Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->InstanceTemplate()->SetInternalFieldCount(1);
@ -58,7 +57,7 @@ class ProcessWrap : public HandleWrap {
new ProcessWrap(env, args.This()); new ProcessWrap(env, args.This());
} }
ProcessWrap(Environment* env, Handle<Object> object) ProcessWrap(Environment* env, Local<Object> object)
: HandleWrap(env, : HandleWrap(env,
object, object,
reinterpret_cast<uv_handle_t*>(&process_), reinterpret_cast<uv_handle_t*>(&process_),

2
src/req-wrap-inl.h

@ -13,7 +13,7 @@ namespace node {
template <typename T> template <typename T>
ReqWrap<T>::ReqWrap(Environment* env, ReqWrap<T>::ReqWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
AsyncWrap::ProviderType provider) AsyncWrap::ProviderType provider)
: AsyncWrap(env, object, provider) { : AsyncWrap(env, object, provider) {
if (env->in_domain()) if (env->in_domain())

2
src/req-wrap.h

@ -12,7 +12,7 @@ template <typename T>
class ReqWrap : public AsyncWrap { class ReqWrap : public AsyncWrap {
public: public:
inline ReqWrap(Environment* env, inline ReqWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
AsyncWrap::ProviderType provider); AsyncWrap::ProviderType provider);
inline ~ReqWrap() override; inline ~ReqWrap() override;
inline void Dispatched(); // Call this after the req has been dispatched. inline void Dispatched(); // Call this after the req has been dispatched.

9
src/signal_wrap.cc

@ -13,7 +13,6 @@ using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -22,9 +21,9 @@ using v8::Value;
class SignalWrap : public HandleWrap { class SignalWrap : public HandleWrap {
public: public:
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New); Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->InstanceTemplate()->SetInternalFieldCount(1);
@ -52,7 +51,7 @@ class SignalWrap : public HandleWrap {
new SignalWrap(env, args.This()); new SignalWrap(env, args.This());
} }
SignalWrap(Environment* env, Handle<Object> object) SignalWrap(Environment* env, Local<Object> object)
: HandleWrap(env, : HandleWrap(env,
object, object,
reinterpret_cast<uv_handle_t*>(&handle_), reinterpret_cast<uv_handle_t*>(&handle_),

7
src/spawn_sync.cc

@ -13,7 +13,6 @@ using v8::Array;
using v8::Context; using v8::Context;
using v8::EscapableHandleScope; using v8::EscapableHandleScope;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;
@ -340,9 +339,9 @@ void SyncProcessStdioPipe::CloseCallback(uv_handle_t* handle) {
} }
void SyncProcessRunner::Initialize(Handle<Object> target, void SyncProcessRunner::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "spawn", Spawn); env->SetMethod(target, "spawn", Spawn);
} }

7
src/spawn_sync.h

@ -9,7 +9,6 @@ namespace node {
using v8::Array; using v8::Array;
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;
@ -129,9 +128,9 @@ class SyncProcessRunner {
}; };
public: public:
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context); Local<Context> context);
static void Spawn(const FunctionCallbackInfo<Value>& args); static void Spawn(const FunctionCallbackInfo<Value>& args);
private: private:

3
src/stream_base-inl.h

@ -13,7 +13,6 @@ namespace node {
using v8::External; using v8::External;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
@ -24,7 +23,7 @@ using v8::Value;
template <class Base> template <class Base>
void StreamBase::AddMethods(Environment* env, void StreamBase::AddMethods(Environment* env,
Handle<FunctionTemplate> t, Local<FunctionTemplate> t,
int flags) { int flags) {
HandleScope scope(env->isolate()); HandleScope scope(env->isolate());

9
src/stream_base.cc

@ -19,7 +19,6 @@ namespace node {
using v8::Array; using v8::Array;
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -109,14 +108,14 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) {
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
storage_size = ROUND_UP(storage_size, WriteWrap::kAlignSize); storage_size = ROUND_UP(storage_size, WriteWrap::kAlignSize);
Handle<Value> chunk = chunks->Get(i * 2); Local<Value> chunk = chunks->Get(i * 2);
if (Buffer::HasInstance(chunk)) if (Buffer::HasInstance(chunk))
continue; continue;
// Buffer chunk, no additional storage required // Buffer chunk, no additional storage required
// String chunk // String chunk
Handle<String> string = chunk->ToString(env->isolate()); Local<String> string = chunk->ToString(env->isolate());
enum encoding encoding = ParseEncoding(env->isolate(), enum encoding encoding = ParseEncoding(env->isolate(),
chunks->Get(i * 2 + 1)); chunks->Get(i * 2 + 1));
size_t chunk_size; size_t chunk_size;
@ -143,7 +142,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) {
uint32_t bytes = 0; uint32_t bytes = 0;
size_t offset = 0; size_t offset = 0;
for (size_t i = 0; i < count; i++) { for (size_t i = 0; i < count; i++) {
Handle<Value> chunk = chunks->Get(i * 2); Local<Value> chunk = chunks->Get(i * 2);
// Write buffer // Write buffer
if (Buffer::HasInstance(chunk)) { if (Buffer::HasInstance(chunk)) {
@ -159,7 +158,7 @@ int StreamBase::Writev(const FunctionCallbackInfo<Value>& args) {
char* str_storage = req_wrap->Extra(offset); char* str_storage = req_wrap->Extra(offset);
size_t str_size = storage_size - offset; size_t str_size = storage_size - offset;
Handle<String> string = chunk->ToString(env->isolate()); Local<String> string = chunk->ToString(env->isolate());
enum encoding encoding = ParseEncoding(env->isolate(), enum encoding encoding = ParseEncoding(env->isolate(),
chunks->Get(i * 2 + 1)); chunks->Get(i * 2 + 1));
str_size = StringBytes::Write(env->isolate(), str_size = StringBytes::Write(env->isolate(),

2
src/stream_base.h

@ -187,7 +187,7 @@ class StreamBase : public StreamResource {
template <class Base> template <class Base>
static inline void AddMethods(Environment* env, static inline void AddMethods(Environment* env,
v8::Handle<v8::FunctionTemplate> target, v8::Local<v8::FunctionTemplate> target,
int flags = kFlagNone); int flags = kFlagNone);
virtual void* Cast() = 0; virtual void* Cast() = 0;

9
src/stream_wrap.cc

@ -27,7 +27,6 @@ using v8::Context;
using v8::EscapableHandleScope; using v8::EscapableHandleScope;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -40,9 +39,9 @@ using v8::Undefined;
using v8::Value; using v8::Value;
void StreamWrap::Initialize(Handle<Object> target, void StreamWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> sw = Local<FunctionTemplate> sw =
@ -81,7 +80,7 @@ StreamWrap::StreamWrap(Environment* env,
void StreamWrap::AddMethods(Environment* env, void StreamWrap::AddMethods(Environment* env,
v8::Handle<v8::FunctionTemplate> target, v8::Local<v8::FunctionTemplate> target,
int flags) { int flags) {
env->SetProtoMethod(target, "setBlocking", SetBlocking); env->SetProtoMethod(target, "setBlocking", SetBlocking);
StreamBase::AddMethods<StreamWrap>(env, target, flags); StreamBase::AddMethods<StreamWrap>(env, target, flags);

8
src/stream_wrap.h

@ -15,9 +15,9 @@ class StreamWrap;
class StreamWrap : public HandleWrap, public StreamBase { class StreamWrap : public HandleWrap, public StreamBase {
public: public:
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
int GetFD() override; int GetFD() override;
void* Cast() override; void* Cast() override;
@ -68,7 +68,7 @@ class StreamWrap : public HandleWrap, public StreamBase {
void UpdateWriteQueueSize(); void UpdateWriteQueueSize();
static void AddMethods(Environment* env, static void AddMethods(Environment* env,
v8::Handle<v8::FunctionTemplate> target, v8::Local<v8::FunctionTemplate> target,
int flags = StreamBase::kFlagNone); int flags = StreamBase::kFlagNone);
private: private:

11
src/string_bytes.cc

@ -15,7 +15,6 @@
namespace node { namespace node {
using v8::EscapableHandleScope; using v8::EscapableHandleScope;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Isolate; using v8::Isolate;
using v8::Local; using v8::Local;
@ -270,7 +269,7 @@ size_t hex_decode(char* buf,
bool StringBytes::GetExternalParts(Isolate* isolate, bool StringBytes::GetExternalParts(Isolate* isolate,
Handle<Value> val, Local<Value> val,
const char** data, const char** data,
size_t* len) { size_t* len) {
if (Buffer::HasInstance(val)) { if (Buffer::HasInstance(val)) {
@ -346,7 +345,7 @@ size_t StringBytes::WriteUCS2(char* buf,
size_t StringBytes::Write(Isolate* isolate, size_t StringBytes::Write(Isolate* isolate,
char* buf, char* buf,
size_t buflen, size_t buflen,
Handle<Value> val, Local<Value> val,
enum encoding encoding, enum encoding encoding,
int* chars_written) { int* chars_written) {
HandleScope scope(isolate); HandleScope scope(isolate);
@ -455,7 +454,7 @@ size_t StringBytes::Write(Isolate* isolate,
bool StringBytes::IsValidString(Isolate* isolate, bool StringBytes::IsValidString(Isolate* isolate,
Handle<String> string, Local<String> string,
enum encoding enc) { enum encoding enc) {
if (enc == HEX && string->Length() % 2 != 0) if (enc == HEX && string->Length() % 2 != 0)
return false; return false;
@ -468,7 +467,7 @@ bool StringBytes::IsValidString(Isolate* isolate,
// Will always be at least big enough, but may have some extra // 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 // UTF8 can be as much as 3x the size, Base64 can have 1-2 extra bytes
size_t StringBytes::StorageSize(Isolate* isolate, size_t StringBytes::StorageSize(Isolate* isolate,
Handle<Value> val, Local<Value> val,
enum encoding encoding) { enum encoding encoding) {
HandleScope scope(isolate); HandleScope scope(isolate);
size_t data_size = 0; size_t data_size = 0;
@ -517,7 +516,7 @@ size_t StringBytes::StorageSize(Isolate* isolate,
size_t StringBytes::Size(Isolate* isolate, size_t StringBytes::Size(Isolate* isolate,
Handle<Value> val, Local<Value> val,
enum encoding encoding) { enum encoding encoding) {
HandleScope scope(isolate); HandleScope scope(isolate);
size_t data_size = 0; size_t data_size = 0;

26
src/string_bytes.h

@ -1,7 +1,7 @@
#ifndef SRC_STRING_BYTES_H_ #ifndef SRC_STRING_BYTES_H_
#define SRC_STRING_BYTES_H_ #define SRC_STRING_BYTES_H_
// Decodes a v8::Handle<v8::String> or Buffer to a raw char* // Decodes a v8::Local<v8::String> or Buffer to a raw char*
#include "v8.h" #include "v8.h"
#include "node.h" #include "node.h"
@ -24,8 +24,8 @@ class StringBytes {
} }
inline bool Decode(Environment* env, inline bool Decode(Environment* env,
v8::Handle<v8::String> string, v8::Local<v8::String> string,
v8::Handle<v8::Value> encoding, v8::Local<v8::Value> encoding,
enum encoding _default) { enum encoding _default) {
enum encoding enc = ParseEncoding(env->isolate(), encoding, _default); enum encoding enc = ParseEncoding(env->isolate(), encoding, _default);
if (!StringBytes::IsValidString(env->isolate(), string, enc)) { 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. // Example: a HEX string must have a length that's a multiple of two.
// FIXME(bnoordhuis) IsMaybeValidString()? Naming things is hard... // FIXME(bnoordhuis) IsMaybeValidString()? Naming things is hard...
static bool IsValidString(v8::Isolate* isolate, static bool IsValidString(v8::Isolate* isolate,
v8::Handle<v8::String> string, v8::Local<v8::String> string,
enum encoding enc); enum encoding enc);
// Fast, but can be 2 bytes oversized for Base64, and // Fast, but can be 2 bytes oversized for Base64, and
// as much as triple UTF-8 strings <= 65536 chars in length // as much as triple UTF-8 strings <= 65536 chars in length
static size_t StorageSize(v8::Isolate* isolate, static size_t StorageSize(v8::Isolate* isolate,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
enum encoding enc); enum encoding enc);
// Precise byte count, but slightly slower for Base64 and // Precise byte count, but slightly slower for Base64 and
// very much slower for UTF-8 // very much slower for UTF-8
static size_t Size(v8::Isolate* isolate, static size_t Size(v8::Isolate* isolate,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
enum encoding enc); enum encoding enc);
// If the string is external then assign external properties to data and len, // If the string is external then assign external properties to data and len,
// then return true. If not return false. // then return true. If not return false.
static bool GetExternalParts(v8::Isolate* isolate, static bool GetExternalParts(v8::Isolate* isolate,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
const char** data, const char** data,
size_t* len); size_t* len);
@ -90,7 +90,7 @@ class StringBytes {
static size_t Write(v8::Isolate* isolate, static size_t Write(v8::Isolate* isolate,
char* buf, char* buf,
size_t buflen, size_t buflen,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
enum encoding enc, enum encoding enc,
int* chars_written = nullptr); int* chars_written = nullptr);
@ -110,25 +110,25 @@ class StringBytes {
NODE_DEPRECATED("Use IsValidString(isolate, ...)", NODE_DEPRECATED("Use IsValidString(isolate, ...)",
static inline bool IsValidString( static inline bool IsValidString(
v8::Handle<v8::String> string, v8::Local<v8::String> string,
enum encoding enc) { enum encoding enc) {
return IsValidString(v8::Isolate::GetCurrent(), string, enc); return IsValidString(v8::Isolate::GetCurrent(), string, enc);
}) })
NODE_DEPRECATED("Use StorageSize(isolate, ...)", NODE_DEPRECATED("Use StorageSize(isolate, ...)",
static inline size_t StorageSize(v8::Handle<v8::Value> val, static inline size_t StorageSize(v8::Local<v8::Value> val,
enum encoding enc) { enum encoding enc) {
return StorageSize(v8::Isolate::GetCurrent(), val, enc); return StorageSize(v8::Isolate::GetCurrent(), val, enc);
}) })
NODE_DEPRECATED("Use Size(isolate, ...)", NODE_DEPRECATED("Use Size(isolate, ...)",
static inline size_t Size(v8::Handle<v8::Value> val, static inline size_t Size(v8::Local<v8::Value> val,
enum encoding enc) { enum encoding enc) {
return Size(v8::Isolate::GetCurrent(), val, enc); return Size(v8::Isolate::GetCurrent(), val, enc);
}) })
NODE_DEPRECATED("Use GetExternalParts(isolate, ...)", NODE_DEPRECATED("Use GetExternalParts(isolate, ...)",
static inline bool GetExternalParts(v8::Handle<v8::Value> val, static inline bool GetExternalParts(v8::Local<v8::Value> val,
const char** data, const char** data,
size_t* len) { size_t* len) {
return GetExternalParts(v8::Isolate::GetCurrent(), val, data, len); return GetExternalParts(v8::Isolate::GetCurrent(), val, data, len);
@ -137,7 +137,7 @@ class StringBytes {
NODE_DEPRECATED("Use Write(isolate, ...)", NODE_DEPRECATED("Use Write(isolate, ...)",
static inline size_t Write(char* buf, static inline size_t Write(char* buf,
size_t buflen, size_t buflen,
v8::Handle<v8::Value> val, v8::Local<v8::Value> val,
enum encoding enc, enum encoding enc,
int* chars_written = nullptr) { int* chars_written = nullptr) {
v8::Isolate* isolate = v8::Isolate::GetCurrent(); v8::Isolate* isolate = v8::Isolate::GetCurrent();

9
src/tcp_wrap.cc

@ -23,7 +23,6 @@ using v8::External;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -64,9 +63,9 @@ Local<Object> TCPWrap::Instantiate(Environment* env, AsyncWrap* parent) {
} }
void TCPWrap::Initialize(Handle<Object> target, void TCPWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
@ -146,7 +145,7 @@ void TCPWrap::New(const FunctionCallbackInfo<Value>& args) {
} }
TCPWrap::TCPWrap(Environment* env, Handle<Object> object, AsyncWrap* parent) TCPWrap::TCPWrap(Environment* env, Local<Object> object, AsyncWrap* parent)
: StreamWrap(env, : StreamWrap(env,
object, object,
reinterpret_cast<uv_stream_t*>(&handle_), reinterpret_cast<uv_stream_t*>(&handle_),

8
src/tcp_wrap.h

@ -10,9 +10,9 @@ namespace node {
class TCPWrap : public StreamWrap { class TCPWrap : public StreamWrap {
public: public:
static v8::Local<v8::Object> Instantiate(Environment* env, AsyncWrap* parent); static v8::Local<v8::Object> Instantiate(Environment* env, AsyncWrap* parent);
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
uv_tcp_t* UVHandle(); uv_tcp_t* UVHandle();
@ -25,7 +25,7 @@ class TCPWrap : public StreamWrap {
int (*F)(const typename T::HandleType*, sockaddr*, int*)> int (*F)(const typename T::HandleType*, sockaddr*, int*)>
friend void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&); friend void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&);
TCPWrap(Environment* env, v8::Handle<v8::Object> object, AsyncWrap* parent); TCPWrap(Environment* env, v8::Local<v8::Object> object, AsyncWrap* parent);
~TCPWrap(); ~TCPWrap();
static void New(const v8::FunctionCallbackInfo<v8::Value>& args); static void New(const v8::FunctionCallbackInfo<v8::Value>& args);

9
src/timer_wrap.cc

@ -14,7 +14,6 @@ using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -25,9 +24,9 @@ const uint32_t kOnTimeout = 0;
class TimerWrap : public HandleWrap { class TimerWrap : public HandleWrap {
public: public:
static void Initialize(Handle<Object> target, static void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New); Local<FunctionTemplate> constructor = env->NewFunctionTemplate(New);
constructor->InstanceTemplate()->SetInternalFieldCount(1); constructor->InstanceTemplate()->SetInternalFieldCount(1);
@ -60,7 +59,7 @@ class TimerWrap : public HandleWrap {
new TimerWrap(env, args.This()); new TimerWrap(env, args.This());
} }
TimerWrap(Environment* env, Handle<Object> object) TimerWrap(Environment* env, Local<Object> object)
: HandleWrap(env, : HandleWrap(env,
object, object,
reinterpret_cast<uv_handle_t*>(&handle_), reinterpret_cast<uv_handle_t*>(&handle_),

7
src/tls_wrap.cc

@ -24,7 +24,6 @@ using v8::Exception;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
using v8::Null; using v8::Null;
@ -865,9 +864,9 @@ int TLSWrap::SelectSNIContextCallback(SSL* s, int* ad, void* arg) {
#endif // SSL_CTRL_SET_TLSEXT_SERVERNAME_CB #endif // SSL_CTRL_SET_TLSEXT_SERVERNAME_CB
void TLSWrap::Initialize(Handle<Object> target, void TLSWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
env->SetMethod(target, "wrap", TLSWrap::Wrap); env->SetMethod(target, "wrap", TLSWrap::Wrap);

6
src/tls_wrap.h

@ -27,9 +27,9 @@ class TLSWrap : public crypto::SSLWrap<TLSWrap>,
public: public:
~TLSWrap() override; ~TLSWrap() override;
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
void* Cast() override; void* Cast() override;
int GetFD() override; int GetFD() override;

9
src/tty_wrap.cc

@ -18,7 +18,6 @@ using v8::Context;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
using v8::Object; using v8::Object;
@ -27,9 +26,9 @@ using v8::String;
using v8::Value; using v8::Value;
void TTYWrap::Initialize(Handle<Object> target, void TTYWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);
@ -130,7 +129,7 @@ void TTYWrap::New(const FunctionCallbackInfo<Value>& args) {
} }
TTYWrap::TTYWrap(Environment* env, Handle<Object> object, int fd, bool readable) TTYWrap::TTYWrap(Environment* env, Local<Object> object, int fd, bool readable)
: StreamWrap(env, : StreamWrap(env,
object, object,
reinterpret_cast<uv_stream_t*>(&handle_), reinterpret_cast<uv_stream_t*>(&handle_),

8
src/tty_wrap.h

@ -9,9 +9,9 @@ namespace node {
class TTYWrap : public StreamWrap { class TTYWrap : public StreamWrap {
public: public:
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
uv_tty_t* UVHandle(); uv_tty_t* UVHandle();
@ -19,7 +19,7 @@ class TTYWrap : public StreamWrap {
private: private:
TTYWrap(Environment* env, TTYWrap(Environment* env,
v8::Handle<v8::Object> object, v8::Local<v8::Object> object,
int fd, int fd,
bool readable); bool readable);

9
src/udp_wrap.cc

@ -19,7 +19,6 @@ using v8::External;
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Local; using v8::Local;
@ -61,7 +60,7 @@ static void NewSendWrap(const FunctionCallbackInfo<Value>& args) {
} }
UDPWrap::UDPWrap(Environment* env, Handle<Object> object, AsyncWrap* parent) UDPWrap::UDPWrap(Environment* env, Local<Object> object, AsyncWrap* parent)
: HandleWrap(env, : HandleWrap(env,
object, object,
reinterpret_cast<uv_handle_t*>(&handle_), reinterpret_cast<uv_handle_t*>(&handle_),
@ -71,9 +70,9 @@ UDPWrap::UDPWrap(Environment* env, Handle<Object> object, AsyncWrap* parent)
} }
void UDPWrap::Initialize(Handle<Object> target, void UDPWrap::Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
Local<FunctionTemplate> t = env->NewFunctionTemplate(New); Local<FunctionTemplate> t = env->NewFunctionTemplate(New);

8
src/udp_wrap.h

@ -13,9 +13,9 @@ namespace node {
class UDPWrap: public HandleWrap { class UDPWrap: public HandleWrap {
public: public:
static void Initialize(v8::Handle<v8::Object> target, static void Initialize(v8::Local<v8::Object> target,
v8::Handle<v8::Value> unused, v8::Local<v8::Value> unused,
v8::Handle<v8::Context> context); v8::Local<v8::Context> context);
static void GetFD(v8::Local<v8::String>, static void GetFD(v8::Local<v8::String>,
const v8::PropertyCallbackInfo<v8::Value>&); const v8::PropertyCallbackInfo<v8::Value>&);
static void New(const v8::FunctionCallbackInfo<v8::Value>& args); static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
@ -46,7 +46,7 @@ class UDPWrap: public HandleWrap {
int (*F)(const typename T::HandleType*, sockaddr*, int*)> int (*F)(const typename T::HandleType*, sockaddr*, int*)>
friend void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&); friend void GetSockOrPeerName(const v8::FunctionCallbackInfo<v8::Value>&);
UDPWrap(Environment* env, v8::Handle<v8::Object> object, AsyncWrap* parent); UDPWrap(Environment* env, v8::Local<v8::Object> object, AsyncWrap* parent);
static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args, static void DoBind(const v8::FunctionCallbackInfo<v8::Value>& args,
int family); int family);

2
src/util.cc

@ -3,7 +3,7 @@
namespace node { namespace node {
Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value) Utf8Value::Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> value)
: length_(0), str_(str_st_) { : length_(0), str_(str_st_) {
if (value.IsEmpty()) if (value.IsEmpty())
return; return;

2
src/util.h

@ -170,7 +170,7 @@ inline TypeName* Unwrap(v8::Local<v8::Object> object);
class Utf8Value { class Utf8Value {
public: public:
explicit Utf8Value(v8::Isolate* isolate, v8::Handle<v8::Value> value); explicit Utf8Value(v8::Isolate* isolate, v8::Local<v8::Value> value);
~Utf8Value() { ~Utf8Value() {
if (str_ != str_st_) if (str_ != str_st_)

8
src/uv.cc

@ -9,7 +9,7 @@ namespace uv {
using v8::Context; using v8::Context;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::Handle; using v8::Local;
using v8::Integer; using v8::Integer;
using v8::Object; using v8::Object;
using v8::String; using v8::String;
@ -26,9 +26,9 @@ void ErrName(const FunctionCallbackInfo<Value>& args) {
} }
void Initialize(Handle<Object> target, void Initialize(Local<Object> target,
Handle<Value> unused, Local<Value> unused,
Handle<Context> context) { Local<Context> context) {
Environment* env = Environment::GetCurrent(context); Environment* env = Environment::GetCurrent(context);
target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "errname"), target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "errname"),
env->NewFunctionTemplate(ErrName)->GetFunction()); env->NewFunctionTemplate(ErrName)->GetFunction());

4
test/addons/async-hello-world/binding.cc

@ -22,7 +22,7 @@ void AfterAsync(uv_work_t* r) {
v8::Isolate* isolate = req->isolate; v8::Isolate* isolate = req->isolate;
v8::HandleScope scope(isolate); v8::HandleScope scope(isolate);
v8::Handle<v8::Value> argv[2] = { v8::Local<v8::Value> argv[2] = {
v8::Null(isolate), v8::Null(isolate),
v8::Integer::New(isolate, req->output) v8::Integer::New(isolate, req->output)
}; };
@ -62,7 +62,7 @@ void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
(uv_after_work_cb)AfterAsync); (uv_after_work_cb)AfterAsync);
} }
void init(v8::Handle<v8::Object> exports, v8::Handle<v8::Object> module) { void init(v8::Local<v8::Object> exports, v8::Local<v8::Object> module) {
NODE_SET_METHOD(module, "exports", Method); NODE_SET_METHOD(module, "exports", Method);
} }

3
test/addons/at-exit/binding.cc

@ -5,7 +5,6 @@
#include <v8.h> #include <v8.h>
using node::AtExit; using node::AtExit;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Isolate; using v8::Isolate;
using v8::Local; using v8::Local;
@ -34,7 +33,7 @@ static void sanity_check(void) {
assert(at_exit_cb2_called == 2); assert(at_exit_cb2_called == 2);
} }
void init(Handle<Object> target) { void init(Local<Object> target) {
AtExit(at_exit_cb1, target->CreationContext()->GetIsolate()); AtExit(at_exit_cb1, target->CreationContext()->GetIsolate());
AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb2, cookie);
AtExit(at_exit_cb2, cookie); AtExit(at_exit_cb2, cookie);

2
test/addons/hello-world-function-export/binding.cc

@ -7,7 +7,7 @@ void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
} }
void init(v8::Handle<v8::Object> exports, v8::Handle<v8::Object> module) { void init(v8::Local<v8::Object> exports, v8::Local<v8::Object> module) {
NODE_SET_METHOD(module, "exports", Method); NODE_SET_METHOD(module, "exports", Method);
} }

2
test/addons/hello-world/binding.cc

@ -7,7 +7,7 @@ void Method(const v8::FunctionCallbackInfo<v8::Value>& args) {
args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world")); args.GetReturnValue().Set(v8::String::NewFromUtf8(isolate, "world"));
} }
void init(v8::Handle<v8::Object> target) { void init(v8::Local<v8::Object> target) {
NODE_SET_METHOD(target, "hello", Method); NODE_SET_METHOD(target, "hello", Method);
} }

4
test/addons/repl-domain-abort/binding.cc

@ -3,7 +3,7 @@
using v8::Function; using v8::Function;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle; using v8::Local;
using v8::HandleScope; using v8::HandleScope;
using v8::Isolate; using v8::Isolate;
using v8::Object; using v8::Object;
@ -19,7 +19,7 @@ void Method(const FunctionCallbackInfo<Value>& args) {
NULL); NULL);
} }
void init(Handle<Object> target) { void init(Local<Object> target) {
NODE_SET_METHOD(target, "method", Method); NODE_SET_METHOD(target, "method", Method);
} }

27
test/gc/node_modules/weak/src/weakref.cc

@ -27,7 +27,6 @@ using v8::Exception;
using v8::Function; using v8::Function;
using v8::FunctionTemplate; using v8::FunctionTemplate;
using v8::FunctionCallbackInfo; using v8::FunctionCallbackInfo;
using v8::Handle;
using v8::HandleScope; using v8::HandleScope;
using v8::Integer; using v8::Integer;
using v8::Isolate; using v8::Isolate;
@ -51,7 +50,7 @@ typedef struct proxy_container {
Persistent<ObjectTemplate> proxyClass; Persistent<ObjectTemplate> proxyClass;
bool IsDead(Handle<Object> proxy) { bool IsDead(Local<Object> proxy) {
assert(proxy->InternalFieldCount() == 1); assert(proxy->InternalFieldCount() == 1);
proxy_container *cont = reinterpret_cast<proxy_container*>( proxy_container *cont = reinterpret_cast<proxy_container*>(
proxy->GetAlignedPointerFromInternalField(0)); proxy->GetAlignedPointerFromInternalField(0));
@ -59,7 +58,7 @@ bool IsDead(Handle<Object> proxy) {
} }
Handle<Object> Unwrap(Handle<Object> proxy) { Local<Object> Unwrap(Local<Object> proxy) {
assert(!IsDead(proxy)); assert(!IsDead(proxy));
proxy_container *cont = reinterpret_cast<proxy_container*>( proxy_container *cont = reinterpret_cast<proxy_container*>(
proxy->GetAlignedPointerFromInternalField(0)); proxy->GetAlignedPointerFromInternalField(0));
@ -67,7 +66,7 @@ Handle<Object> Unwrap(Handle<Object> proxy) {
return Local<Object>::New(isolate, cont->target); return Local<Object>::New(isolate, cont->target);
} }
Handle<Array> GetCallbacks(Handle<Object> proxy) { Local<Array> GetCallbacks(Local<Object> proxy) {
proxy_container *cont = reinterpret_cast<proxy_container*>( proxy_container *cont = reinterpret_cast<proxy_container*>(
proxy->GetAlignedPointerFromInternalField(0)); proxy->GetAlignedPointerFromInternalField(0));
assert(cont != NULL); assert(cont != NULL);
@ -78,7 +77,7 @@ Handle<Array> GetCallbacks(Handle<Object> proxy) {
#define UNWRAP \ #define UNWRAP \
HandleScope scope(info.GetIsolate()); \ HandleScope scope(info.GetIsolate()); \
Handle<Object> obj; \ Local<Object> obj; \
const bool dead = IsDead(info.This()); \ const bool dead = IsDead(info.This()); \
if (!dead) obj = Unwrap(info.This()); \ if (!dead) obj = Unwrap(info.This()); \
@ -152,8 +151,8 @@ void WeakPropertyEnumerator(const PropertyCallbackInfo<Array>& info) {
} }
void AddCallback(Isolate* isolate, Handle<Object> proxy, Handle<Function> callback) { void AddCallback(Isolate* isolate, Local<Object> proxy, Local<Function> callback) {
Handle<Array> callbacks = GetCallbacks(proxy); Local<Array> callbacks = GetCallbacks(proxy);
callbacks->Set(Integer::New(isolate, callbacks->Length()), callback); callbacks->Set(Integer::New(isolate, callbacks->Length()), callback);
} }
@ -168,11 +167,11 @@ static void TargetCallback(const v8::WeakCallbackData<v8::Object, proxy_containe
// invoke any listening callbacks // invoke any listening callbacks
Local<Array> callbacks = Local<Array>::New(isolate, cont->callbacks); Local<Array> callbacks = Local<Array>::New(isolate, cont->callbacks);
uint32_t len = callbacks->Length(); uint32_t len = callbacks->Length();
Handle<Value> argv[1]; Local<Value> argv[1];
argv[0] = target; argv[0] = target;
for (uint32_t i=0; i<len; i++) { for (uint32_t i=0; i<len; i++) {
Handle<Function> cb = Handle<Function>::Cast( Local<Function> cb = Local<Function>::Cast(
callbacks->Get(Integer::New(isolate, i))); callbacks->Get(Integer::New(isolate, i)));
TryCatch try_catch; TryCatch try_catch;
@ -212,7 +211,7 @@ void Create(const FunctionCallbackInfo<Value>& args) {
cont->target.SetWeak(cont, TargetCallback); cont->target.SetWeak(cont, TargetCallback);
if (args.Length() >= 2) { if (args.Length() >= 2) {
AddCallback(args.GetIsolate(), proxy, Handle<Function>::Cast(args[1])); AddCallback(args.GetIsolate(), proxy, Local<Function>::Cast(args[1]));
} }
args.GetReturnValue().Set(proxy); args.GetReturnValue().Set(proxy);
@ -222,7 +221,7 @@ void Create(const FunctionCallbackInfo<Value>& args) {
* TODO: Make this better. * TODO: Make this better.
*/ */
bool isWeakRef (Handle<Value> val) { bool isWeakRef (Local<Value> val) {
return val->IsObject() && val->ToObject()->InternalFieldCount() == 1; return val->IsObject() && val->ToObject()->InternalFieldCount() == 1;
} }
@ -241,7 +240,7 @@ void Get(const FunctionCallbackInfo<Value>& args) {
Local<Object> proxy = args[0]->ToObject(); Local<Object> proxy = args[0]->ToObject();
if (IsDead(proxy)) return; if (IsDead(proxy)) return;
Handle<Object> obj = Unwrap(proxy); Local<Object> obj = Unwrap(proxy);
args.GetReturnValue().Set(obj); args.GetReturnValue().Set(obj);
} }
@ -283,7 +282,7 @@ void AddCallback(const FunctionCallbackInfo<Value>& args) {
} }
Local<Object> proxy = args[0]->ToObject(); Local<Object> proxy = args[0]->ToObject();
AddCallback(args.GetIsolate(), proxy, Handle<Function>::Cast(args[1])); AddCallback(args.GetIsolate(), proxy, Local<Function>::Cast(args[1]));
} }
void Callbacks(const FunctionCallbackInfo<Value>& args) { void Callbacks(const FunctionCallbackInfo<Value>& args) {
@ -299,7 +298,7 @@ void Callbacks(const FunctionCallbackInfo<Value>& args) {
} }
void Initialize(Handle<Object> target) { void Initialize(Local<Object> target) {
HandleScope scope(target->CreationContext()->GetIsolate()); HandleScope scope(target->CreationContext()->GetIsolate());
Local<ObjectTemplate> tmpl = ObjectTemplate::New(); Local<ObjectTemplate> tmpl = ObjectTemplate::New();

Loading…
Cancel
Save