Skip to content

Commit

Permalink
src: remove redundant v8 namespaces in env.cc
Browse files Browse the repository at this point in the history
  • Loading branch information
juanarbol committed May 24, 2021
1 parent dc43066 commit 641cf9b
Showing 1 changed file with 14 additions and 12 deletions.
26 changes: 14 additions & 12 deletions src/env.cc
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,14 @@
namespace node {

using errors::TryCatchScope;
using v8::Array;
using v8::Boolean;
using v8::Context;
using v8::EmbedderGraph;
using v8::Function;
using v8::FunctionTemplate;
using v8::HandleScope;
using v8::HeapSpaceStatistics;
using v8::Integer;
using v8::Isolate;
using v8::Local;
Expand Down Expand Up @@ -1013,11 +1015,11 @@ void Environment::CollectUVExceptionInfo(Local<Value> object,
syscall, message, path, dest);
}

ImmediateInfo::ImmediateInfo(v8::Isolate* isolate, const SerializeInfo* info)
ImmediateInfo::ImmediateInfo(Isolate* isolate, const SerializeInfo* info)
: fields_(isolate, kFieldsCount, MAYBE_FIELD_PTR(info, fields)) {}

ImmediateInfo::SerializeInfo ImmediateInfo::Serialize(
v8::Local<v8::Context> context, v8::SnapshotCreator* creator) {
Local<Context> context, SnapshotCreator* creator) {
return {fields_.Serialize(context, creator)};
}

Expand All @@ -1035,8 +1037,8 @@ void ImmediateInfo::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("fields", fields_);
}

TickInfo::SerializeInfo TickInfo::Serialize(v8::Local<v8::Context> context,
v8::SnapshotCreator* creator) {
TickInfo::SerializeInfo TickInfo::Serialize(Local<Context> context,
SnapshotCreator* creator) {
return {fields_.Serialize(context, creator)};
}

Expand All @@ -1054,17 +1056,17 @@ void TickInfo::MemoryInfo(MemoryTracker* tracker) const {
tracker->TrackField("fields", fields_);
}

TickInfo::TickInfo(v8::Isolate* isolate, const SerializeInfo* info)
TickInfo::TickInfo(Isolate* isolate, const SerializeInfo* info)
: fields_(
isolate, kFieldsCount, info == nullptr ? nullptr : &(info->fields)) {}

AsyncHooks::AsyncHooks(v8::Isolate* isolate, const SerializeInfo* info)
AsyncHooks::AsyncHooks(Isolate* isolate, const SerializeInfo* info)
: async_ids_stack_(isolate, 16 * 2, MAYBE_FIELD_PTR(info, async_ids_stack)),
fields_(isolate, kFieldsCount, MAYBE_FIELD_PTR(info, fields)),
async_id_fields_(
isolate, kUidFieldsCount, MAYBE_FIELD_PTR(info, async_id_fields)),
info_(info) {
v8::HandleScope handle_scope(isolate);
HandleScope handle_scope(isolate);
if (info == nullptr) {
clear_async_id_stack();

Expand Down Expand Up @@ -1092,8 +1094,8 @@ void AsyncHooks::Deserialize(Local<Context> context) {
fields_.Deserialize(context);
async_id_fields_.Deserialize(context);
if (info_->js_execution_async_resources != 0) {
v8::Local<v8::Array> arr = context
->GetDataFromSnapshotOnce<v8::Array>(
Local<Array> arr = context
->GetDataFromSnapshotOnce<Array>(
info_->js_execution_async_resources)
.ToLocalChecked();
js_execution_async_resources_.Reset(context->GetIsolate(), arr);
Expand All @@ -1102,9 +1104,9 @@ void AsyncHooks::Deserialize(Local<Context> context) {
native_execution_async_resources_.resize(
info_->native_execution_async_resources.size());
for (size_t i = 0; i < info_->native_execution_async_resources.size(); ++i) {
v8::Local<v8::Object> obj =
Local<Object> obj =
context
->GetDataFromSnapshotOnce<v8::Object>(
->GetDataFromSnapshotOnce<Object>(
info_->native_execution_async_resources[i])
.ToLocalChecked();
native_execution_async_resources_[i].Reset(context->GetIsolate(), obj);
Expand Down Expand Up @@ -1523,7 +1525,7 @@ size_t Environment::NearHeapLimitCallback(void* data,
size_t young_gen_size = 0;
size_t old_gen_size = 0;

v8::HeapSpaceStatistics stats;
HeapSpaceStatistics stats;
size_t num_heap_spaces = env->isolate()->NumberOfHeapSpaces();
for (size_t i = 0; i < num_heap_spaces; ++i) {
env->isolate()->GetHeapSpaceStatistics(&stats, i);
Expand Down

0 comments on commit 641cf9b

Please sign in to comment.