src: make minor cleanups in encoding_binding.cc
PR-URL: https://github.com/nodejs/node/pull/57448 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
This commit is contained in:
parent
387b8cbb8b
commit
fb07807e9a
@ -18,10 +18,12 @@ using v8::BackingStore;
|
|||||||
using v8::BackingStoreInitializationMode;
|
using v8::BackingStoreInitializationMode;
|
||||||
using v8::Context;
|
using v8::Context;
|
||||||
using v8::FunctionCallbackInfo;
|
using v8::FunctionCallbackInfo;
|
||||||
|
using v8::HandleScope;
|
||||||
using v8::Isolate;
|
using v8::Isolate;
|
||||||
using v8::Local;
|
using v8::Local;
|
||||||
using v8::Object;
|
using v8::Object;
|
||||||
using v8::ObjectTemplate;
|
using v8::ObjectTemplate;
|
||||||
|
using v8::SnapshotCreator;
|
||||||
using v8::String;
|
using v8::String;
|
||||||
using v8::Uint8Array;
|
using v8::Uint8Array;
|
||||||
using v8::Value;
|
using v8::Value;
|
||||||
@ -32,7 +34,7 @@ void BindingData::MemoryInfo(MemoryTracker* tracker) const {
|
|||||||
}
|
}
|
||||||
|
|
||||||
BindingData::BindingData(Realm* realm,
|
BindingData::BindingData(Realm* realm,
|
||||||
v8::Local<v8::Object> object,
|
Local<Object> object,
|
||||||
InternalFieldInfo* info)
|
InternalFieldInfo* info)
|
||||||
: SnapshotableObject(realm, object, type_int),
|
: SnapshotableObject(realm, object, type_int),
|
||||||
encode_into_results_buffer_(
|
encode_into_results_buffer_(
|
||||||
@ -52,7 +54,7 @@ BindingData::BindingData(Realm* realm,
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool BindingData::PrepareForSerialization(Local<Context> context,
|
bool BindingData::PrepareForSerialization(Local<Context> context,
|
||||||
v8::SnapshotCreator* creator) {
|
SnapshotCreator* creator) {
|
||||||
DCHECK_NULL(internal_field_info_);
|
DCHECK_NULL(internal_field_info_);
|
||||||
internal_field_info_ = InternalFieldInfoBase::New<InternalFieldInfo>(type());
|
internal_field_info_ = InternalFieldInfoBase::New<InternalFieldInfo>(type());
|
||||||
internal_field_info_->encode_into_results_buffer =
|
internal_field_info_->encode_into_results_buffer =
|
||||||
@ -74,7 +76,7 @@ void BindingData::Deserialize(Local<Context> context,
|
|||||||
int index,
|
int index,
|
||||||
InternalFieldInfoBase* info) {
|
InternalFieldInfoBase* info) {
|
||||||
DCHECK_IS_SNAPSHOT_SLOT(index);
|
DCHECK_IS_SNAPSHOT_SLOT(index);
|
||||||
v8::HandleScope scope(context->GetIsolate());
|
HandleScope scope(context->GetIsolate());
|
||||||
Realm* realm = Realm::GetCurrent(context);
|
Realm* realm = Realm::GetCurrent(context);
|
||||||
// Recreate the buffer in the constructor.
|
// Recreate the buffer in the constructor.
|
||||||
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
InternalFieldInfo* casted_info = static_cast<InternalFieldInfo*>(info);
|
||||||
@ -194,7 +196,7 @@ void BindingData::DecodeUTF8(const FunctionCallbackInfo<Value>& args) {
|
|||||||
args.GetReturnValue().Set(ret);
|
args.GetReturnValue().Set(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BindingData::ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
void BindingData::ToASCII(const FunctionCallbackInfo<Value>& args) {
|
||||||
Environment* env = Environment::GetCurrent(args);
|
Environment* env = Environment::GetCurrent(args);
|
||||||
CHECK_GE(args.Length(), 1);
|
CHECK_GE(args.Length(), 1);
|
||||||
CHECK(args[0]->IsString());
|
CHECK(args[0]->IsString());
|
||||||
@ -207,7 +209,7 @@ void BindingData::ToASCII(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void BindingData::ToUnicode(const v8::FunctionCallbackInfo<v8::Value>& args) {
|
void BindingData::ToUnicode(const FunctionCallbackInfo<Value>& args) {
|
||||||
Environment* env = Environment::GetCurrent(args);
|
Environment* env = Environment::GetCurrent(args);
|
||||||
CHECK_GE(args.Length(), 1);
|
CHECK_GE(args.Length(), 1);
|
||||||
CHECK(args[0]->IsString());
|
CHECK(args[0]->IsString());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user