http2: elevate v8 namespaces of repeated references
PR-URL: https://github.com/nodejs/node/pull/24453 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
parent
a19a2689ea
commit
38e59466a2
@ -12,11 +12,13 @@
|
|||||||
namespace node {
|
namespace node {
|
||||||
|
|
||||||
using v8::ArrayBuffer;
|
using v8::ArrayBuffer;
|
||||||
|
using v8::ArrayBufferCreationMode;
|
||||||
using v8::Boolean;
|
using v8::Boolean;
|
||||||
using v8::Context;
|
using v8::Context;
|
||||||
using v8::Float64Array;
|
using v8::Float64Array;
|
||||||
using v8::Function;
|
using v8::Function;
|
||||||
using v8::Integer;
|
using v8::Integer;
|
||||||
|
using v8::NewStringType;
|
||||||
using v8::Number;
|
using v8::Number;
|
||||||
using v8::ObjectTemplate;
|
using v8::ObjectTemplate;
|
||||||
using v8::String;
|
using v8::String;
|
||||||
@ -1401,11 +1403,11 @@ void Http2Session::HandleAltSvcFrame(const nghttp2_frame* frame) {
|
|||||||
Integer::New(isolate, id),
|
Integer::New(isolate, id),
|
||||||
String::NewFromOneByte(isolate,
|
String::NewFromOneByte(isolate,
|
||||||
altsvc->origin,
|
altsvc->origin,
|
||||||
v8::NewStringType::kNormal,
|
NewStringType::kNormal,
|
||||||
altsvc->origin_len).ToLocalChecked(),
|
altsvc->origin_len).ToLocalChecked(),
|
||||||
String::NewFromOneByte(isolate,
|
String::NewFromOneByte(isolate,
|
||||||
altsvc->field_value,
|
altsvc->field_value,
|
||||||
v8::NewStringType::kNormal,
|
NewStringType::kNormal,
|
||||||
altsvc->field_value_len).ToLocalChecked(),
|
altsvc->field_value_len).ToLocalChecked(),
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1430,7 +1432,7 @@ void Http2Session::HandleOriginFrame(const nghttp2_frame* frame) {
|
|||||||
const nghttp2_origin_entry& entry = origin->ov[i];
|
const nghttp2_origin_entry& entry = origin->ov[i];
|
||||||
origin_v[i] =
|
origin_v[i] =
|
||||||
String::NewFromOneByte(
|
String::NewFromOneByte(
|
||||||
isolate, entry.origin, v8::NewStringType::kNormal, entry.origin_len)
|
isolate, entry.origin, NewStringType::kNormal, entry.origin_len)
|
||||||
.ToLocalChecked();
|
.ToLocalChecked();
|
||||||
}
|
}
|
||||||
Local<Value> holder = Array::New(isolate, origin_v.data(), origin_v.size());
|
Local<Value> holder = Array::New(isolate, origin_v.data(), origin_v.size());
|
||||||
@ -1813,7 +1815,7 @@ void Http2Session::OnStreamRead(ssize_t nread, const uv_buf_t& buf) {
|
|||||||
ArrayBuffer::New(isolate,
|
ArrayBuffer::New(isolate,
|
||||||
buf.base,
|
buf.base,
|
||||||
nread,
|
nread,
|
||||||
v8::ArrayBufferCreationMode::kInternalized);
|
ArrayBufferCreationMode::kInternalized);
|
||||||
|
|
||||||
statistics_.data_received += nread;
|
statistics_.data_received += nread;
|
||||||
ssize_t ret = Write(&stream_buf_, 1);
|
ssize_t ret = Write(&stream_buf_, 1);
|
||||||
@ -2316,7 +2318,7 @@ void HttpErrorString(const FunctionCallbackInfo<Value>& args) {
|
|||||||
String::NewFromOneByte(
|
String::NewFromOneByte(
|
||||||
env->isolate(),
|
env->isolate(),
|
||||||
reinterpret_cast<const uint8_t*>(nghttp2_strerror(val)),
|
reinterpret_cast<const uint8_t*>(nghttp2_strerror(val)),
|
||||||
v8::NewStringType::kInternalized).ToLocalChecked());
|
NewStringType::kInternalized).ToLocalChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user