summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBen Noordhuis <info@bnoordhuis.nl>2017-03-20 20:10:23 +0100
committerJames M Snell <jasnell@gmail.com>2017-03-22 09:19:48 -0700
commitf35e80d9af98a140825b4597f6b1560ac3f53096 (patch)
tree86cca4496cdc27da252dac0fa3efe2282539d98a /src
parent64d0a735741558e8c715b86531b51e6f57dc3bd7 (diff)
downloadandroid-node-v8-f35e80d9af98a140825b4597f6b1560ac3f53096.tar.gz
android-node-v8-f35e80d9af98a140825b4597f6b1560ac3f53096.tar.bz2
android-node-v8-f35e80d9af98a140825b4597f6b1560ac3f53096.zip
src: use persistent strings from node::Environment
Replace a few calls to FIXED_ONE_BYTE_STRING() with their persistent counterparts from `node::Environment`. None of the calls are in hot code paths but why create a new string when one already exists? PR-URL: https://github.com/nodejs/node/pull/11945 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Jeremiah Senkpiel <fishrock123@rocketmail.com> Reviewed-By: Brian White <mscdex@mscdex.net>
Diffstat (limited to 'src')
-rw-r--r--src/node_contextify.cc3
-rw-r--r--src/node_crypto.cc7
2 files changed, 4 insertions, 6 deletions
diff --git a/src/node_contextify.cc b/src/node_contextify.cc
index 2e7c577cec..a6e3d93aa8 100644
--- a/src/node_contextify.cc
+++ b/src/node_contextify.cc
@@ -743,8 +743,7 @@ class ContextifyScript : public BaseObject {
return -1;
}
- Local<String> key = FIXED_ONE_BYTE_STRING(env->isolate(), "timeout");
- Local<Value> value = options.As<Object>()->Get(key);
+ Local<Value> value = options.As<Object>()->Get(env->timeout_string());
if (value->IsUndefined()) {
return -1;
}
diff --git a/src/node_crypto.cc b/src/node_crypto.cc
index 7005080677..9cf79a93fa 100644
--- a/src/node_crypto.cc
+++ b/src/node_crypto.cc
@@ -2076,8 +2076,7 @@ void SSLWrap<Base>::VerifyError(const FunctionCallbackInfo<Value>& args) {
Local<String> reason_string = OneByteString(isolate, reason);
Local<Value> exception_value = Exception::Error(reason_string);
Local<Object> exception_object = exception_value->ToObject(isolate);
- exception_object->Set(FIXED_ONE_BYTE_STRING(isolate, "code"),
- OneByteString(isolate, code));
+ exception_object->Set(w->env()->code_string(), OneByteString(isolate, code));
args.GetReturnValue().Set(exception_object);
}
@@ -3276,7 +3275,7 @@ void Connection::SetSNICallback(const FunctionCallbackInfo<Value>& args) {
}
Local<Object> obj = Object::New(env->isolate());
- obj->Set(FIXED_ONE_BYTE_STRING(args.GetIsolate(), "onselect"), args[0]);
+ obj->Set(env->onselect_string(), args[0]);
conn->sniObject_.Reset(args.GetIsolate(), obj);
}
#endif
@@ -5605,7 +5604,7 @@ void RandomBytes(const FunctionCallbackInfo<Value>& args) {
RandomBytesRequest* req = new RandomBytesRequest(env, obj, size);
if (args[1]->IsFunction()) {
- obj->Set(FIXED_ONE_BYTE_STRING(args.GetIsolate(), "ondone"), args[1]);
+ obj->Set(env->ondone_string(), args[1]);
if (env->in_domain())
obj->Set(env->domain_string(), env->domain_array()->Get(0));