Skip to content

Commit

Permalink
src: use using declarations consistently
Browse files Browse the repository at this point in the history
PR-URL: #36365
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Richard Lau <rlau@redhat.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
  • Loading branch information
danbev committed Dec 9, 2020
1 parent a2a2ff3 commit 068e0fe
Showing 1 changed file with 24 additions and 17 deletions.
41 changes: 24 additions & 17 deletions src/node_process_methods.cc
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,27 @@ typedef int mode_t;

namespace node {

using v8::ApiObject;
using v8::Array;
using v8::ArrayBuffer;
using v8::BackingStore;
using v8::CFunction;
using v8::ConstructorBehavior;
using v8::Context;
using v8::Float64Array;
using v8::FunctionCallbackInfo;
using v8::FunctionTemplate;
using v8::Global;
using v8::HeapStatistics;
using v8::Integer;
using v8::Isolate;
using v8::Local;
using v8::NewStringType;
using v8::Number;
using v8::Object;
using v8::ObjectTemplate;
using v8::SideEffectType;
using v8::Signature;
using v8::String;
using v8::Uint32;
using v8::Value;
Expand Down Expand Up @@ -406,22 +414,21 @@ static void ReallyExit(const FunctionCallbackInfo<Value>& args) {
class FastHrtime : public BaseObject {
public:
static Local<Object> New(Environment* env) {
Local<v8::FunctionTemplate> ctor =
v8::FunctionTemplate::New(env->isolate());
Local<FunctionTemplate> ctor = FunctionTemplate::New(env->isolate());
ctor->Inherit(BaseObject::GetConstructorTemplate(env));
Local<v8::ObjectTemplate> otmpl = ctor->InstanceTemplate();
Local<ObjectTemplate> otmpl = ctor->InstanceTemplate();
otmpl->SetInternalFieldCount(FastHrtime::kInternalFieldCount);

auto create_func = [env](auto fast_func, auto slow_func) {
auto cfunc = v8::CFunction::Make(fast_func);
return v8::FunctionTemplate::New(env->isolate(),
slow_func,
Local<Value>(),
Local<v8::Signature>(),
0,
v8::ConstructorBehavior::kThrow,
v8::SideEffectType::kHasNoSideEffect,
&cfunc);
auto cfunc = CFunction::Make(fast_func);
return FunctionTemplate::New(env->isolate(),
slow_func,
Local<Value>(),
Local<Signature>(),
0,
ConstructorBehavior::kThrow,
SideEffectType::kHasNoSideEffect,
&cfunc);
};

otmpl->Set(FIXED_ONE_BYTE_STRING(env->isolate(), "hrtime"),
Expand Down Expand Up @@ -458,8 +465,8 @@ class FastHrtime : public BaseObject {
SET_MEMORY_INFO_NAME(FastHrtime)
SET_SELF_SIZE(FastHrtime)

static FastHrtime* FromV8ApiObject(v8::ApiObject api_object) {
v8::Object* v8_object = reinterpret_cast<v8::Object*>(&api_object);
static FastHrtime* FromV8ApiObject(ApiObject api_object) {
Object* v8_object = reinterpret_cast<Object*>(&api_object);
return static_cast<FastHrtime*>(
v8_object->GetAlignedPointerFromInternalField(BaseObject::kSlot));
}
Expand All @@ -481,7 +488,7 @@ class FastHrtime : public BaseObject {
fields[2] = t % NANOS_PER_SEC;
}

static void FastNumber(v8::ApiObject receiver) {
static void FastNumber(ApiObject receiver) {
NumberImpl(FromV8ApiObject(receiver));
}

Expand All @@ -495,15 +502,15 @@ class FastHrtime : public BaseObject {
fields[0] = t;
}

static void FastBigInt(v8::ApiObject receiver) {
static void FastBigInt(ApiObject receiver) {
BigIntImpl(FromV8ApiObject(receiver));
}

static void SlowBigInt(const FunctionCallbackInfo<Value>& args) {
BigIntImpl(FromJSObject<FastHrtime>(args.Holder()));
}

v8::Global<ArrayBuffer> array_buffer_;
Global<ArrayBuffer> array_buffer_;
std::shared_ptr<BackingStore> backing_store_;
};

Expand Down

0 comments on commit 068e0fe

Please sign in to comment.