@@ -761,84 +761,84 @@ v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
761761 * `AsyncResource::MakeCallback()` is used, then all four callbacks will be
762762 * called automatically. */
763763class AsyncResource {
764- public:
765- AsyncResource (v8::Isolate* isolate,
766- v8::Local<v8::Object> resource,
767- const char * name,
768- async_id trigger_async_id = -1 )
769- : isolate_(isolate),
770- resource_ (isolate, resource) {
771- async_context_ = EmitAsyncInit (isolate, resource, name,
772- trigger_async_id);
773- }
774-
775- AsyncResource (v8::Isolate* isolate,
776- v8::Local<v8::Object> resource,
777- v8::Local<v8::String> name,
778- async_id trigger_async_id = -1 )
779- : isolate_(isolate),
780- resource_(isolate, resource) {
781- async_context_ = EmitAsyncInit (isolate, resource, name,
782- trigger_async_id);
783- }
784-
785- virtual ~AsyncResource () {
786- EmitAsyncDestroy (isolate_, async_context_);
787- resource_.Reset ();
788- }
789-
790- v8::MaybeLocal<v8::Value> MakeCallback (
791- v8::Local<v8::Function> callback,
792- int argc,
793- v8::Local<v8::Value>* argv) {
794- return node::MakeCallback (isolate_, get_resource (),
795- callback, argc, argv,
796- async_context_);
797- }
798-
799- v8::MaybeLocal<v8::Value> MakeCallback (
800- const char * method,
801- int argc,
802- v8::Local<v8::Value>* argv) {
803- return node::MakeCallback (isolate_, get_resource (),
804- method, argc, argv,
805- async_context_);
806- }
807-
808- v8::MaybeLocal<v8::Value> MakeCallback (
809- v8::Local<v8::String> symbol,
810- int argc,
811- v8::Local<v8::Value>* argv) {
812- return node::MakeCallback (isolate_, get_resource (),
813- symbol, argc, argv,
814- async_context_);
815- }
816-
817- v8::Local<v8::Object> get_resource () {
818- return resource_.Get (isolate_);
819- }
820-
821- async_id get_async_id () const {
822- return async_context_.async_id ;
823- }
824-
825- async_id get_trigger_async_id () const {
826- return async_context_.trigger_async_id ;
827- }
828-
829- protected:
830- class CallbackScope : public node ::CallbackScope {
831- public:
832- explicit CallbackScope (AsyncResource* res)
833- : node::CallbackScope(res->isolate_,
834- res->resource_.Get(res->isolate_),
835- res->async_context_) {}
836- };
837-
838- private:
839- v8::Isolate* isolate_;
840- v8::Persistent<v8::Object> resource_;
841- async_context async_context_;
764+ public:
765+ AsyncResource (v8::Isolate* isolate,
766+ v8::Local<v8::Object> resource,
767+ const char * name,
768+ async_id trigger_async_id = -1 )
769+ : isolate_(isolate),
770+ resource_ (isolate, resource) {
771+ async_context_ = EmitAsyncInit (isolate, resource, name,
772+ trigger_async_id);
773+ }
774+
775+ AsyncResource (v8::Isolate* isolate,
776+ v8::Local<v8::Object> resource,
777+ v8::Local<v8::String> name,
778+ async_id trigger_async_id = -1 )
779+ : isolate_(isolate),
780+ resource_(isolate, resource) {
781+ async_context_ = EmitAsyncInit (isolate, resource, name,
782+ trigger_async_id);
783+ }
784+
785+ virtual ~AsyncResource () {
786+ EmitAsyncDestroy (isolate_, async_context_);
787+ resource_.Reset ();
788+ }
789+
790+ v8::MaybeLocal<v8::Value> MakeCallback (
791+ v8::Local<v8::Function> callback,
792+ int argc,
793+ v8::Local<v8::Value>* argv) {
794+ return node::MakeCallback (isolate_, get_resource (),
795+ callback, argc, argv,
796+ async_context_);
797+ }
798+
799+ v8::MaybeLocal<v8::Value> MakeCallback (
800+ const char * method,
801+ int argc,
802+ v8::Local<v8::Value>* argv) {
803+ return node::MakeCallback (isolate_, get_resource (),
804+ method, argc, argv,
805+ async_context_);
806+ }
807+
808+ v8::MaybeLocal<v8::Value> MakeCallback (
809+ v8::Local<v8::String> symbol,
810+ int argc,
811+ v8::Local<v8::Value>* argv) {
812+ return node::MakeCallback (isolate_, get_resource (),
813+ symbol, argc, argv,
814+ async_context_);
815+ }
816+
817+ v8::Local<v8::Object> get_resource () {
818+ return resource_.Get (isolate_);
819+ }
820+
821+ async_id get_async_id () const {
822+ return async_context_.async_id ;
823+ }
824+
825+ async_id get_trigger_async_id () const {
826+ return async_context_.trigger_async_id ;
827+ }
828+
829+ protected:
830+ class CallbackScope : public node ::CallbackScope {
831+ public:
832+ explicit CallbackScope (AsyncResource* res)
833+ : node::CallbackScope(res->isolate_,
834+ res->resource_.Get(res->isolate_),
835+ res->async_context_) {}
836+ };
837+
838+ private:
839+ v8::Isolate* isolate_;
840+ v8::Persistent<v8::Object> resource_;
841+ async_context async_context_;
842842};
843843
844844} // namespace node
0 commit comments