Browse Source

src: replace usage of deprecated SetAccessor

PR-URL: https://github.com/nodejs/node/pull/5204
Reviewed-By: bnoordhuis - Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: indutny - Fedor Indutny <fedor.indutny@gmail.com>
process-exit-stdio-flushing
Ali Ijaz Sheikh 9 years ago
committed by Ali Sheikh
parent
commit
c1649a7e4e
  1. 44
      src/node.cc

44
src/node.cc

@ -117,6 +117,7 @@ using v8::Local;
using v8::Locker; using v8::Locker;
using v8::MaybeLocal; using v8::MaybeLocal;
using v8::Message; using v8::Message;
using v8::Name;
using v8::Number; using v8::Number;
using v8::Object; using v8::Object;
using v8::ObjectTemplate; using v8::ObjectTemplate;
@ -2470,7 +2471,7 @@ static void LinkedBinding(const FunctionCallbackInfo<Value>& args) {
args.GetReturnValue().Set(effective_exports); args.GetReturnValue().Set(effective_exports);
} }
static void ProcessTitleGetter(Local<String> property, static void ProcessTitleGetter(Local<Name> property,
const PropertyCallbackInfo<Value>& info) { const PropertyCallbackInfo<Value>& info) {
char buffer[512]; char buffer[512];
uv_get_process_title(buffer, sizeof(buffer)); uv_get_process_title(buffer, sizeof(buffer));
@ -2478,7 +2479,7 @@ static void ProcessTitleGetter(Local<String> property,
} }
static void ProcessTitleSetter(Local<String> property, static void ProcessTitleSetter(Local<Name> property,
Local<Value> value, Local<Value> value,
const PropertyCallbackInfo<void>& info) { const PropertyCallbackInfo<void>& info) {
node::Utf8Value title(info.GetIsolate(), value); node::Utf8Value title(info.GetIsolate(), value);
@ -2707,13 +2708,13 @@ static Local<Object> GetFeatures(Environment* env) {
} }
static void DebugPortGetter(Local<String> property, static void DebugPortGetter(Local<Name> property,
const PropertyCallbackInfo<Value>& info) { const PropertyCallbackInfo<Value>& info) {
info.GetReturnValue().Set(debug_port); info.GetReturnValue().Set(debug_port);
} }
static void DebugPortSetter(Local<String> property, static void DebugPortSetter(Local<Name> property,
Local<Value> value, Local<Value> value,
const PropertyCallbackInfo<void>& info) { const PropertyCallbackInfo<void>& info) {
debug_port = value->Int32Value(); debug_port = value->Int32Value();
@ -2725,7 +2726,7 @@ static void DebugPause(const FunctionCallbackInfo<Value>& args);
static void DebugEnd(const FunctionCallbackInfo<Value>& args); static void DebugEnd(const FunctionCallbackInfo<Value>& args);
void NeedImmediateCallbackGetter(Local<String> property, void NeedImmediateCallbackGetter(Local<Name> property,
const PropertyCallbackInfo<Value>& info) { const PropertyCallbackInfo<Value>& info) {
Environment* env = Environment::GetCurrent(info); Environment* env = Environment::GetCurrent(info);
const uv_check_t* immediate_check_handle = env->immediate_check_handle(); const uv_check_t* immediate_check_handle = env->immediate_check_handle();
@ -2736,7 +2737,7 @@ void NeedImmediateCallbackGetter(Local<String> property,
static void NeedImmediateCallbackSetter( static void NeedImmediateCallbackSetter(
Local<String> property, Local<Name> property,
Local<Value> value, Local<Value> value,
const PropertyCallbackInfo<void>& info) { const PropertyCallbackInfo<void>& info) {
Environment* env = Environment::GetCurrent(info); Environment* env = Environment::GetCurrent(info);
@ -2820,10 +2821,12 @@ void SetupProcessObject(Environment* env,
Local<Object> process = env->process_object(); Local<Object> process = env->process_object();
process->SetAccessor(env->title_string(), auto maybe = process->SetAccessor(env->context(),
ProcessTitleGetter, env->title_string(),
ProcessTitleSetter, ProcessTitleGetter,
env->as_external()); ProcessTitleSetter,
env->as_external());
CHECK(maybe.FromJust());
// process.version // process.version
READONLY_PROPERTY(process, READONLY_PROPERTY(process,
@ -2986,10 +2989,12 @@ void SetupProcessObject(Environment* env,
READONLY_PROPERTY(process, "pid", Integer::New(env->isolate(), getpid())); READONLY_PROPERTY(process, "pid", Integer::New(env->isolate(), getpid()));
READONLY_PROPERTY(process, "features", GetFeatures(env)); READONLY_PROPERTY(process, "features", GetFeatures(env));
process->SetAccessor(env->need_imm_cb_string(), maybe = process->SetAccessor(env->context(),
NeedImmediateCallbackGetter, env->need_imm_cb_string(),
NeedImmediateCallbackSetter, NeedImmediateCallbackGetter,
env->as_external()); NeedImmediateCallbackSetter,
env->as_external());
CHECK(maybe.FromJust());
// -e, --eval // -e, --eval
if (eval_string) { if (eval_string) {
@ -3074,10 +3079,13 @@ void SetupProcessObject(Environment* env,
process->Set(env->exec_path_string(), exec_path_value); process->Set(env->exec_path_string(), exec_path_value);
delete[] exec_path; delete[] exec_path;
process->SetAccessor(env->debug_port_string(), maybe = process->SetAccessor(env->context(),
DebugPortGetter, env->debug_port_string(),
DebugPortSetter, DebugPortGetter,
env->as_external()); DebugPortSetter,
env->as_external());
CHECK(maybe.FromJust());
// define various internal methods // define various internal methods
env->SetMethod(process, env->SetMethod(process,

Loading…
Cancel
Save