src: fix indentation for AsyncResource

This un-breaks the linter, which currently does not seem to
run on this part of the file.

PR-URL: https://github.com/nodejs/node/pull/23177
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Denys Otrishko <shishugi@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Anna Henningsen 2018-09-30 12:27:48 -04:00
parent 640172d24d
commit 69f1a2bb85
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9

View File

@ -755,84 +755,84 @@ v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
* `AsyncResource::MakeCallback()` is used, then all four callbacks will be * `AsyncResource::MakeCallback()` is used, then all four callbacks will be
* called automatically. */ * called automatically. */
class AsyncResource { class AsyncResource {
public: public:
AsyncResource(v8::Isolate* isolate, AsyncResource(v8::Isolate* isolate,
v8::Local<v8::Object> resource, v8::Local<v8::Object> resource,
const char* name, const char* name,
async_id trigger_async_id = -1) async_id trigger_async_id = -1)
: isolate_(isolate), : isolate_(isolate),
resource_(isolate, resource) { resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name, async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id); trigger_async_id);
} }
AsyncResource(v8::Isolate* isolate, AsyncResource(v8::Isolate* isolate,
v8::Local<v8::Object> resource, v8::Local<v8::Object> resource,
v8::Local<v8::String> name, v8::Local<v8::String> name,
async_id trigger_async_id = -1) async_id trigger_async_id = -1)
: isolate_(isolate), : isolate_(isolate),
resource_(isolate, resource) { resource_(isolate, resource) {
async_context_ = EmitAsyncInit(isolate, resource, name, async_context_ = EmitAsyncInit(isolate, resource, name,
trigger_async_id); trigger_async_id);
} }
virtual ~AsyncResource() { virtual ~AsyncResource() {
EmitAsyncDestroy(isolate_, async_context_); EmitAsyncDestroy(isolate_, async_context_);
resource_.Reset(); resource_.Reset();
} }
v8::MaybeLocal<v8::Value> MakeCallback( v8::MaybeLocal<v8::Value> MakeCallback(
v8::Local<v8::Function> callback, v8::Local<v8::Function> callback,
int argc, int argc,
v8::Local<v8::Value>* argv) { v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(), return node::MakeCallback(isolate_, get_resource(),
callback, argc, argv, callback, argc, argv,
async_context_); async_context_);
} }
v8::MaybeLocal<v8::Value> MakeCallback( v8::MaybeLocal<v8::Value> MakeCallback(
const char* method, const char* method,
int argc, int argc,
v8::Local<v8::Value>* argv) { v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(), return node::MakeCallback(isolate_, get_resource(),
method, argc, argv, method, argc, argv,
async_context_); async_context_);
} }
v8::MaybeLocal<v8::Value> MakeCallback( v8::MaybeLocal<v8::Value> MakeCallback(
v8::Local<v8::String> symbol, v8::Local<v8::String> symbol,
int argc, int argc,
v8::Local<v8::Value>* argv) { v8::Local<v8::Value>* argv) {
return node::MakeCallback(isolate_, get_resource(), return node::MakeCallback(isolate_, get_resource(),
symbol, argc, argv, symbol, argc, argv,
async_context_); async_context_);
} }
v8::Local<v8::Object> get_resource() { v8::Local<v8::Object> get_resource() {
return resource_.Get(isolate_); return resource_.Get(isolate_);
} }
async_id get_async_id() const { async_id get_async_id() const {
return async_context_.async_id; return async_context_.async_id;
} }
async_id get_trigger_async_id() const { async_id get_trigger_async_id() const {
return async_context_.trigger_async_id; return async_context_.trigger_async_id;
} }
protected: protected:
class CallbackScope : public node::CallbackScope { class CallbackScope : public node::CallbackScope {
public: public:
explicit CallbackScope(AsyncResource* res) explicit CallbackScope(AsyncResource* res)
: node::CallbackScope(res->isolate_, : node::CallbackScope(res->isolate_,
res->resource_.Get(res->isolate_), res->resource_.Get(res->isolate_),
res->async_context_) {} res->async_context_) {}
}; };
private: private:
v8::Isolate* isolate_; v8::Isolate* isolate_;
v8::Persistent<v8::Object> resource_; v8::Persistent<v8::Object> resource_;
async_context async_context_; async_context async_context_;
}; };
} // namespace node } // namespace node