GeezerVison is showing github.com — src: replace SetAccessor w/ SetAccessorProperty · nodejs/node@f3e082c
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: src/node_crypto.cc +45-36Lines changed: 45 additions & 36 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -79,7 +79,6 @@ static const int X509_NAME_FLAGS = ASN1_STRFLGS_ESC_CTRL | 79 | 79 | namespace node { | 80 | 80 | namespace crypto { | 81 | 81 |
| 82 | | -using v8::AccessorSignature; | 83 | 82 | using v8::Array; | 84 | 83 | using v8::Boolean; | 85 | 84 | using v8::Context; | @@ -102,8 +101,8 @@ using v8::Object; | 102 | 101 | using v8::ObjectTemplate; | 103 | 102 | using v8::Persistent; | 104 | 103 | using v8::PropertyAttribute; | 105 | | -using v8::PropertyCallbackInfo; | 106 | 104 | using v8::ReadOnly; | | 105 | +using v8::Signature; | 107 | 106 | using v8::String; | 108 | 107 | using v8::Value; | 109 | 108 |
| @@ -481,14 +480,18 @@ void SecureContext::Initialize(Environment* env, Local<Object> target) { | 481 | 480 | t->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "kTicketKeyIVIndex"), | 482 | 481 | Integer::NewFromUnsigned(env->isolate(), kTicketKeyIVIndex)); | 483 | 482 |
| 484 | | - t->PrototypeTemplate()->SetAccessor( | | 483 | + Local<FunctionTemplate> ctx_getter_templ = | | 484 | + FunctionTemplate::New(env->isolate(), | | 485 | + CtxGetter, | | 486 | + env->as_external(), | | 487 | + Signature::New(env->isolate(), t)); | | 488 | + | | 489 | + | | 490 | + t->PrototypeTemplate()->SetAccessorProperty( | 485 | 491 | FIXED_ONE_BYTE_STRING(env->isolate(), "_external"), | 486 | | - CtxGetter, | 487 | | - nullptr, | 488 | | - env->as_external(), | 489 | | - DEFAULT, | 490 | | - static_cast<PropertyAttribute>(ReadOnly | DontDelete), | 491 | | - AccessorSignature::New(env->isolate(), t)); | | 492 | + ctx_getter_templ, | | 493 | + Local<FunctionTemplate>(), | | 494 | + static_cast<PropertyAttribute>(ReadOnly | DontDelete)); | 492 | 495 |
| 493 | 496 | target->Set(secureContextString, t->GetFunction()); | 494 | 497 | env->set_secure_context_constructor_template(t); | @@ -1457,8 +1460,7 @@ int SecureContext::TicketCompatibilityCallback(SSL* ssl, | 1457 | 1460 | #endif | 1458 | 1461 |
| 1459 | 1462 |
| 1460 | | -void SecureContext::CtxGetter(Local<String> property, | 1461 | | - const PropertyCallbackInfo<Value>& info) { | | 1463 | +void SecureContext::CtxGetter(const FunctionCallbackInfo<Value>& info) { | 1462 | 1464 | SecureContext* sc; | 1463 | 1465 | ASSIGN_OR_RETURN_UNWRAP(&sc, info.This()); | 1464 | 1466 | Local<External> ext = External::New(info.GetIsolate(), sc->ctx_); | @@ -1528,14 +1530,17 @@ void SSLWrap<Base>::AddMethods(Environment* env, Local<FunctionTemplate> t) { | 1528 | 1530 | env->SetProtoMethod(t, "getALPNNegotiatedProtocol", GetALPNNegotiatedProto); | 1529 | 1531 | env->SetProtoMethod(t, "setALPNProtocols", SetALPNProtocols); | 1530 | 1532 |
| 1531 | | - t->PrototypeTemplate()->SetAccessor( | | 1533 | + Local<FunctionTemplate> ssl_getter_templ = | | 1534 | + FunctionTemplate::New(env->isolate(), | | 1535 | + SSLGetter, | | 1536 | + env->as_external(), | | 1537 | + Signature::New(env->isolate(), t)); | | 1538 | + | | 1539 | + t->PrototypeTemplate()->SetAccessorProperty( | 1532 | 1540 | FIXED_ONE_BYTE_STRING(env->isolate(), "_external"), | 1533 | | - SSLGetter, | 1534 | | - nullptr, | 1535 | | - env->as_external(), | 1536 | | - DEFAULT, | 1537 | | - static_cast<PropertyAttribute>(ReadOnly | DontDelete), | 1538 | | - AccessorSignature::New(env->isolate(), t)); | | 1541 | + ssl_getter_templ, | | 1542 | + Local<FunctionTemplate>(), | | 1543 | + static_cast<PropertyAttribute>(ReadOnly | DontDelete)); | 1539 | 1544 | } | 1540 | 1545 |
| 1541 | 1546 |
| @@ -2696,8 +2701,7 @@ void SSLWrap<Base>::CertCbDone(const FunctionCallbackInfo<Value>& args) { | 2696 | 2701 |
| 2697 | 2702 |
| 2698 | 2703 | template <class Base> | 2699 | | -void SSLWrap<Base>::SSLGetter(Local<String> property, | 2700 | | - const PropertyCallbackInfo<Value>& info) { | | 2704 | +void SSLWrap<Base>::SSLGetter(const FunctionCallbackInfo<Value>& info) { | 2701 | 2705 | Base* base; | 2702 | 2706 | ASSIGN_OR_RETURN_UNWRAP(&base, info.This()); | 2703 | 2707 | SSL* ssl = base->ssl_; | @@ -4694,14 +4698,17 @@ void DiffieHellman::Initialize(Environment* env, Local<Object> target) { | 4694 | 4698 | env->SetProtoMethod(t, "setPublicKey", SetPublicKey); | 4695 | 4699 | env->SetProtoMethod(t, "setPrivateKey", SetPrivateKey); | 4696 | 4700 |
| 4697 | | - t->InstanceTemplate()->SetAccessor( | | 4701 | + Local<FunctionTemplate> verify_error_getter_templ = | | 4702 | + FunctionTemplate::New(env->isolate(), | | 4703 | + DiffieHellman::VerifyErrorGetter, | | 4704 | + env->as_external(), | | 4705 | + Signature::New(env->isolate(), t)); | | 4706 | + | | 4707 | + t->InstanceTemplate()->SetAccessorProperty( | 4698 | 4708 | env->verify_error_string(), | 4699 | | - DiffieHellman::VerifyErrorGetter, | 4700 | | - nullptr, | 4701 | | - env->as_external(), | 4702 | | - DEFAULT, | 4703 | | - attributes, | 4704 | | - AccessorSignature::New(env->isolate(), t)); | | 4709 | + verify_error_getter_templ, | | 4710 | + Local<FunctionTemplate>(), | | 4711 | + attributes); | 4705 | 4712 |
| 4706 | 4713 | target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "DiffieHellman"), | 4707 | 4714 | t->GetFunction()); | @@ -4716,14 +4723,17 @@ void DiffieHellman::Initialize(Environment* env, Local<Object> target) { | 4716 | 4723 | env->SetProtoMethod(t2, "getPublicKey", GetPublicKey); | 4717 | 4724 | env->SetProtoMethod(t2, "getPrivateKey", GetPrivateKey); | 4718 | 4725 |
| 4719 | | - t2->InstanceTemplate()->SetAccessor( | | 4726 | + Local<FunctionTemplate> verify_error_getter_templ2 = | | 4727 | + FunctionTemplate::New(env->isolate(), | | 4728 | + DiffieHellman::VerifyErrorGetter, | | 4729 | + env->as_external(), | | 4730 | + Signature::New(env->isolate(), t2)); | | 4731 | + | | 4732 | + t2->InstanceTemplate()->SetAccessorProperty( | 4720 | 4733 | env->verify_error_string(), | 4721 | | - DiffieHellman::VerifyErrorGetter, | 4722 | | - nullptr, | 4723 | | - env->as_external(), | 4724 | | - DEFAULT, | 4725 | | - attributes, | 4726 | | - AccessorSignature::New(env->isolate(), t2)); | | 4734 | + verify_error_getter_templ2, | | 4735 | + Local<FunctionTemplate>(), | | 4736 | + attributes); | 4727 | 4737 |
| 4728 | 4738 | target->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "DiffieHellmanGroup"), | 4729 | 4739 | t2->GetFunction()); | @@ -5037,8 +5047,7 @@ void DiffieHellman::SetPrivateKey(const FunctionCallbackInfo<Value>& args) { | 5037 | 5047 | } | 5038 | 5048 |
| 5039 | 5049 |
| 5040 | | -void DiffieHellman::VerifyErrorGetter(Local<String> property, | 5041 | | - const PropertyCallbackInfo<Value>& args) { | | 5050 | +void DiffieHellman::VerifyErrorGetter(const FunctionCallbackInfo<Value>& args) { | 5042 | 5051 | HandleScope scope(args.GetIsolate()); | 5043 | 5052 |
| 5044 | 5053 | DiffieHellman* diffieHellman; | |
Collapse file Copy file name to clipboardExpand all lines: src/node_crypto.h +3-6Lines changed: 3 additions & 6 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -141,8 +141,7 @@ class SecureContext : public BaseObject { | 141 | 141 | const v8::FunctionCallbackInfo<v8::Value>& args); | 142 | 142 | static void EnableTicketKeyCallback( | 143 | 143 | const v8::FunctionCallbackInfo<v8::Value>& args); | 144 | | - static void CtxGetter(v8::Local<v8::String> property, | 145 | | - const v8::PropertyCallbackInfo<v8::Value>& info); | | 144 | + static void CtxGetter(const v8::FunctionCallbackInfo<v8::Value>& info); | 146 | 145 |
| 147 | 146 | template <bool primary> | 148 | 147 | static void GetCertificate(const v8::FunctionCallbackInfo<v8::Value>& args); | @@ -322,8 +321,7 @@ class SSLWrap { | 322 | 321 | void* arg); | 323 | 322 | static int TLSExtStatusCallback(SSL* s, void* arg); | 324 | 323 | static int SSLCertCallback(SSL* s, void* arg); | 325 | | - static void SSLGetter(v8::Local<v8::String> property, | 326 | | - const v8::PropertyCallbackInfo<v8::Value>& info); | | 324 | + static void SSLGetter(const v8::FunctionCallbackInfo<v8::Value>& info); | 327 | 325 |
| 328 | 326 | void DestroySSL(); | 329 | 327 | void WaitForCertCb(CertCb cb, void* arg); | @@ -689,8 +687,7 @@ class DiffieHellman : public BaseObject { | 689 | 687 | static void SetPublicKey(const v8::FunctionCallbackInfo<v8::Value>& args); | 690 | 688 | static void SetPrivateKey(const v8::FunctionCallbackInfo<v8::Value>& args); | 691 | 689 | static void VerifyErrorGetter( | 692 | | - v8::Local<v8::String> property, | 693 | | - const v8::PropertyCallbackInfo<v8::Value>& args); | | 690 | + const v8::FunctionCallbackInfo<v8::Value>& args); | 694 | 691 |
| 695 | 692 | DiffieHellman(Environment* env, v8::Local<v8::Object> wrap) | 696 | 693 | : BaseObject(env, wrap), | |
Collapse file Copy file name to clipboardExpand all lines: src/node_perf.cc +48-16Lines changed: 48 additions & 16 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -19,7 +19,7 @@ using v8::Local; | 19 | 19 | using v8::Name; | 20 | 20 | using v8::Object; | 21 | 21 | using v8::ObjectTemplate; | 22 | | -using v8::PropertyCallbackInfo; | | 22 | +using v8::Signature; | 23 | 23 | using v8::String; | 24 | 24 | using v8::Value; | 25 | 25 |
| @@ -121,33 +121,29 @@ void Measure(const FunctionCallbackInfo<Value>& args) { | 121 | 121 | args.GetReturnValue().Set(obj); | 122 | 122 | } | 123 | 123 |
| 124 | | -void GetPerformanceEntryName(const Local<String> prop, | 125 | | - const PropertyCallbackInfo<Value>& info) { | | 124 | +void GetPerformanceEntryName(const FunctionCallbackInfo<Value>& info) { | 126 | 125 | Isolate* isolate = info.GetIsolate(); | 127 | 126 | PerformanceEntry* entry; | 128 | 127 | ASSIGN_OR_RETURN_UNWRAP(&entry, info.Holder()); | 129 | 128 | info.GetReturnValue().Set( | 130 | 129 | String::NewFromUtf8(isolate, entry->name().c_str(), String::kNormalString)); | 131 | 130 | } | 132 | 131 |
| 133 | | -void GetPerformanceEntryType(const Local<String> prop, | 134 | | - const PropertyCallbackInfo<Value>& info) { | | 132 | +void GetPerformanceEntryType(const FunctionCallbackInfo<Value>& info) { | 135 | 133 | Isolate* isolate = info.GetIsolate(); | 136 | 134 | PerformanceEntry* entry; | 137 | 135 | ASSIGN_OR_RETURN_UNWRAP(&entry, info.Holder()); | 138 | 136 | info.GetReturnValue().Set( | 139 | 137 | String::NewFromUtf8(isolate, entry->type().c_str(), String::kNormalString)); | 140 | 138 | } | 141 | 139 |
| 142 | | -void GetPerformanceEntryStartTime(const Local<String> prop, | 143 | | - const PropertyCallbackInfo<Value>& info) { | | 140 | +void GetPerformanceEntryStartTime(const FunctionCallbackInfo<Value>& info) { | 144 | 141 | PerformanceEntry* entry; | 145 | 142 | ASSIGN_OR_RETURN_UNWRAP(&entry, info.Holder()); | 146 | 143 | info.GetReturnValue().Set(entry->startTime()); | 147 | 144 | } | 148 | 145 |
| 149 | | -void GetPerformanceEntryDuration(const Local<String> prop, | 150 | | - const PropertyCallbackInfo<Value>& info) { | | 146 | +void GetPerformanceEntryDuration(const FunctionCallbackInfo<Value>& info) { | 151 | 147 | PerformanceEntry* entry; | 152 | 148 | ASSIGN_OR_RETURN_UNWRAP(&entry, info.Holder()); | 153 | 149 | info.GetReturnValue().Set(entry->duration()); | @@ -335,14 +331,50 @@ void Init(Local<Object> target, | 335 | 331 | Local<FunctionTemplate> pe = env->NewFunctionTemplate(PerformanceEntry::New); | 336 | 332 | pe->InstanceTemplate()->SetInternalFieldCount(1); | 337 | 333 | pe->SetClassName(performanceEntryString); | | 334 | + | | 335 | + Local<Signature> signature = Signature::New(env->isolate(), pe); | | 336 | + | | 337 | + Local<FunctionTemplate> get_performance_entry_name_templ = | | 338 | + FunctionTemplate::New(env->isolate(), | | 339 | + GetPerformanceEntryName, | | 340 | + env->as_external(), | | 341 | + signature); | | 342 | + | | 343 | + Local<FunctionTemplate> get_performance_entry_type_templ = | | 344 | + FunctionTemplate::New(env->isolate(), | | 345 | + GetPerformanceEntryType, | | 346 | + env->as_external(), | | 347 | + signature); | | 348 | + | | 349 | + Local<FunctionTemplate> get_performance_entry_start_time_templ = | | 350 | + FunctionTemplate::New(env->isolate(), | | 351 | + GetPerformanceEntryStartTime, | | 352 | + env->as_external(), | | 353 | + signature); | | 354 | + | | 355 | + Local<FunctionTemplate> get_performance_entry_duration_templ = | | 356 | + FunctionTemplate::New(env->isolate(), | | 357 | + GetPerformanceEntryDuration, | | 358 | + env->as_external(), | | 359 | + signature); | | 360 | + | 338 | 361 | Local<ObjectTemplate> ot = pe->InstanceTemplate(); | 339 | | - ot->SetAccessor(env->name_string(), GetPerformanceEntryName); | 340 | | - ot->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "entryType"), | 341 | | - GetPerformanceEntryType); | 342 | | - ot->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "startTime"), | 343 | | - GetPerformanceEntryStartTime); | 344 | | - ot->SetAccessor(FIXED_ONE_BYTE_STRING(isolate, "duration"), | 345 | | - GetPerformanceEntryDuration); | | 362 | + ot->SetAccessorProperty(env->name_string(), | | 363 | + get_performance_entry_name_templ, | | 364 | + Local<FunctionTemplate>()); | | 365 | + | | 366 | + ot->SetAccessorProperty(FIXED_ONE_BYTE_STRING(isolate, "entryType"), | | 367 | + get_performance_entry_type_templ, | | 368 | + Local<FunctionTemplate>()); | | 369 | + | | 370 | + ot->SetAccessorProperty(FIXED_ONE_BYTE_STRING(isolate, "startTime"), | | 371 | + get_performance_entry_start_time_templ, | | 372 | + Local<FunctionTemplate>()); | | 373 | + | | 374 | + ot->SetAccessorProperty(FIXED_ONE_BYTE_STRING(isolate, "duration"), | | 375 | + get_performance_entry_duration_templ, | | 376 | + Local<FunctionTemplate>()); | | 377 | + | 346 | 378 | Local<Function> fn = pe->GetFunction(); | 347 | 379 | target->Set(performanceEntryString, fn); | 348 | 380 | env->set_performance_entry_template(fn); | |
Collapse file Copy file name to clipboardExpand all lines: src/stream_base-inl.h +39-34Lines changed: 39 additions & 34 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 11 | 11 |
| 12 | 12 | namespace node { | 13 | 13 |
| 14 | | -using v8::AccessorSignature; | | 14 | +using v8::Signature; | 15 | 15 | using v8::External; | 16 | 16 | using v8::FunctionCallbackInfo; | 17 | 17 | using v8::FunctionTemplate; | @@ -34,31 +34,41 @@ void StreamBase::AddMethods(Environment* env, | 34 | 34 | enum PropertyAttribute attributes = | 35 | 35 | static_cast<PropertyAttribute>( | 36 | 36 | v8::ReadOnly | v8::DontDelete | v8::DontEnum); | 37 | | - Local<AccessorSignature> signature = | 38 | | - AccessorSignature::New(env->isolate(), t); | 39 | | - t->PrototypeTemplate()->SetAccessor(env->fd_string(), | 40 | | - GetFD<Base>, | 41 | | - nullptr, | 42 | | - env->as_external(), | 43 | | - v8::DEFAULT, | 44 | | - attributes, | 45 | | - signature); | 46 | | - | 47 | | - t->PrototypeTemplate()->SetAccessor(env->external_stream_string(), | 48 | | - GetExternal<Base>, | 49 | | - nullptr, | 50 | | - env->as_external(), | 51 | | - v8::DEFAULT, | 52 | | - attributes, | 53 | | - signature); | 54 | | - | 55 | | - t->PrototypeTemplate()->SetAccessor(env->bytes_read_string(), | 56 | | - GetBytesRead<Base>, | 57 | | - nullptr, | 58 | | - env->as_external(), | 59 | | - v8::DEFAULT, | 60 | | - attributes, | 61 | | - signature); | | 37 | + | | 38 | + Local<Signature> signature = Signature::New(env->isolate(), t); | | 39 | + | | 40 | + Local<FunctionTemplate> get_fd_templ = | | 41 | + FunctionTemplate::New(env->isolate(), | | 42 | + GetFD<Base>, | | 43 | + env->as_external(), | | 44 | + signature); | | 45 | + | | 46 | + Local<FunctionTemplate> get_external_templ = | | 47 | + FunctionTemplate::New(env->isolate(), | | 48 | + GetExternal<Base>, | | 49 | + env->as_external(), | | 50 | + signature); | | 51 | + | | 52 | + Local<FunctionTemplate> get_bytes_read_templ = | | 53 | + FunctionTemplate::New(env->isolate(), | | 54 | + GetBytesRead<Base>, | | 55 | + env->as_external(), | | 56 | + signature); | | 57 | + | | 58 | + t->PrototypeTemplate()->SetAccessorProperty(env->fd_string(), | | 59 | + get_fd_templ, | | 60 | + Local<FunctionTemplate>(), | | 61 | + attributes); | | 62 | + | | 63 | + t->PrototypeTemplate()->SetAccessorProperty(env->external_stream_string(), | | 64 | + get_external_templ, | | 65 | + Local<FunctionTemplate>(), | | 66 | + attributes); | | 67 | + | | 68 | + t->PrototypeTemplate()->SetAccessorProperty(env->bytes_read_string(), | | 69 | + get_bytes_read_templ, | | 70 | + Local<FunctionTemplate>(), | | 71 | + attributes); | 62 | 72 |
| 63 | 73 | env->SetProtoMethod(t, "readStart", JSMethod<Base, &StreamBase::ReadStart>); | 64 | 74 | env->SetProtoMethod(t, "readStop", JSMethod<Base, &StreamBase::ReadStop>); | @@ -85,8 +95,7 @@ void StreamBase::AddMethods(Environment* env, | 85 | 95 |
| 86 | 96 |
| 87 | 97 | template <class Base> | 88 | | -void StreamBase::GetFD(Local<String> key, | 89 | | - const PropertyCallbackInfo<Value>& args) { | | 98 | +void StreamBase::GetFD(const FunctionCallbackInfo<Value>& args) { | 90 | 99 | // Mimic implementation of StreamBase::GetFD() and UDPWrap::GetFD(). | 91 | 100 | Base* handle; | 92 | 101 | ASSIGN_OR_RETURN_UNWRAP(&handle, | @@ -100,10 +109,8 @@ void StreamBase::GetFD(Local<String> key, | 100 | 109 | args.GetReturnValue().Set(wrap->GetFD()); | 101 | 110 | } | 102 | 111 |
| 103 | | - | 104 | 112 | template <class Base> | 105 | | -void StreamBase::GetBytesRead(Local<String> key, | 106 | | - const PropertyCallbackInfo<Value>& args) { | | 113 | +void StreamBase::GetBytesRead(const FunctionCallbackInfo<Value>& args) { | 107 | 114 | // The handle instance hasn't been set. So no bytes could have been read. | 108 | 115 | Base* handle; | 109 | 116 | ASSIGN_OR_RETURN_UNWRAP(&handle, | @@ -115,10 +122,8 @@ void StreamBase::GetBytesRead(Local<String> key, | 115 | 122 | args.GetReturnValue().Set(static_cast<double>(wrap->bytes_read_)); | 116 | 123 | } | 117 | 124 |
| 118 | | - | 119 | 125 | template <class Base> | 120 | | -void StreamBase::GetExternal(Local<String> key, | 121 | | - const PropertyCallbackInfo<Value>& args) { | | 126 | +void StreamBase::GetExternal(const FunctionCallbackInfo<Value>& args) { | 122 | 127 | Base* handle; | 123 | 128 | ASSIGN_OR_RETURN_UNWRAP(&handle, args.This()); | 124 | 129 |
| |
|