Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: fix indentation for AsyncResource #23177

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
156 changes: 78 additions & 78 deletions src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -755,84 +755,84 @@ v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
* `AsyncResource::MakeCallback()` is used, then all four callbacks will be
* called automatically. */
class AsyncResource {
public:
AsyncResource(v8::Isolate* isolate,
v8::Local<v8::Object> resource,
const char* name,
async_id trigger_async_id = -1)
: isolate_(isolate),
resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id);
}

AsyncResource(v8::Isolate* isolate,
v8::Local<v8::Object> resource,
v8::Local<v8::String> name,
async_id trigger_async_id = -1)
: isolate_(isolate),
resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id);
}

virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_);
resource_.Reset();
}

v8::MaybeLocal<v8::Value> MakeCallback(
v8::Local<v8::Function> callback,
int argc,
v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(),
callback, argc, argv,
async_context_);
}

v8::MaybeLocal<v8::Value> MakeCallback(
const char* method,
int argc,
v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(),
method, argc, argv,
async_context_);
}

v8::MaybeLocal<v8::Value> MakeCallback(
v8::Local<v8::String> symbol,
int argc,
v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(),
symbol, argc, argv,
async_context_);
}

v8::Local<v8::Object> get_resource() {
return resource_.Get(isolate_);
}

async_id get_async_id() const {
return async_context_.async_id;
}

async_id get_trigger_async_id() const {
return async_context_.trigger_async_id;
}

protected:
class CallbackScope : public node::CallbackScope {
public:
explicit CallbackScope(AsyncResource* res)
: node::CallbackScope(res->isolate_,
res->resource_.Get(res->isolate_),
res->async_context_) {}
};

private:
v8::Isolate* isolate_;
v8::Persistent<v8::Object> resource_;
async_context async_context_;
public:
AsyncResource(v8::Isolate* isolate,
v8::Local<v8::Object> resource,
const char* name,
async_id trigger_async_id = -1)
: isolate_(isolate),
resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id);
}

AsyncResource(v8::Isolate* isolate,
v8::Local<v8::Object> resource,
v8::Local<v8::String> name,
async_id trigger_async_id = -1)
: isolate_(isolate),
resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id);
}

virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_);
resource_.Reset();
}

v8::MaybeLocal<v8::Value> MakeCallback(
v8::Local<v8::Function> callback,
int argc,
v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(),
callback, argc, argv,
async_context_);
}

v8::MaybeLocal<v8::Value> MakeCallback(
const char* method,
int argc,
v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(),
method, argc, argv,
async_context_);
}

v8::MaybeLocal<v8::Value> MakeCallback(
v8::Local<v8::String> symbol,
int argc,
v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(),
symbol, argc, argv,
async_context_);
}

v8::Local<v8::Object> get_resource() {
return resource_.Get(isolate_);
}

async_id get_async_id() const {
return async_context_.async_id;
}

async_id get_trigger_async_id() const {
return async_context_.trigger_async_id;
}

protected:
class CallbackScope : public node::CallbackScope {
public:
explicit CallbackScope(AsyncResource* res)
: node::CallbackScope(res->isolate_,
res->resource_.Get(res->isolate_),
res->async_context_) {}
};

private:
v8::Isolate* isolate_;
v8::Persistent<v8::Object> resource_;
async_context async_context_;
};

} // namespace node
Expand Down