@@ -756,69 +756,41 @@ v8::MaybeLocal<v8::Value> MakeCallback(v8::Isolate* isolate,
756756/* Helper class users can optionally inherit from. If
757757 * `AsyncResource::MakeCallback()` is used, then all four callbacks will be
758758 * called automatically. */
759- class AsyncResource {
759+ class NODE_EXTERN AsyncResource {
760760 public:
761761 AsyncResource (v8::Isolate* isolate,
762762 v8::Local<v8::Object> resource,
763763 const char * name,
764- async_id trigger_async_id = -1 )
765- : isolate_(isolate),
766- resource_ (isolate, resource) {
767- async_context_ = EmitAsyncInit (isolate, resource, name,
768- trigger_async_id);
769- }
764+ async_id trigger_async_id = -1 );
770765
771- virtual ~AsyncResource () {
772- EmitAsyncDestroy (isolate_, async_context_);
773- resource_. Reset () ;
774- }
766+ virtual ~AsyncResource ();
767+
768+ AsyncResource ( const AsyncResource&) = delete ;
769+ void operator =( const AsyncResource&) = delete ;
775770
776771 v8::MaybeLocal<v8::Value> MakeCallback (
777772 v8::Local<v8::Function> callback,
778773 int argc,
779- v8::Local<v8::Value>* argv) {
780- return node::MakeCallback (isolate_, get_resource (),
781- callback, argc, argv,
782- async_context_);
783- }
774+ v8::Local<v8::Value>* argv);
784775
785776 v8::MaybeLocal<v8::Value> MakeCallback (
786777 const char * method,
787778 int argc,
788- v8::Local<v8::Value>* argv) {
789- return node::MakeCallback (isolate_, get_resource (),
790- method, argc, argv,
791- async_context_);
792- }
779+ v8::Local<v8::Value>* argv);
793780
794781 v8::MaybeLocal<v8::Value> MakeCallback (
795782 v8::Local<v8::String> symbol,
796783 int argc,
797- v8::Local<v8::Value>* argv) {
798- return node::MakeCallback (isolate_, get_resource (),
799- symbol, argc, argv,
800- async_context_);
801- }
784+ v8::Local<v8::Value>* argv);
802785
803- v8::Local<v8::Object> get_resource () {
804- return resource_.Get (isolate_);
805- }
806-
807- async_id get_async_id () const {
808- return async_context_.async_id ;
809- }
810-
811- async_id get_trigger_async_id () const {
812- return async_context_.trigger_async_id ;
813- }
786+ v8::Local<v8::Object> get_resource ();
787+ async_id get_async_id () const ;
788+ async_id get_trigger_async_id () const ;
814789
815790 protected:
816- class CallbackScope : public node ::CallbackScope {
791+ class NODE_EXTERN CallbackScope : public node::CallbackScope {
817792 public:
818- explicit CallbackScope (AsyncResource* res)
819- : node::CallbackScope(res->isolate_,
820- res->resource_.Get(res->isolate_),
821- res->async_context_) {}
793+ explicit CallbackScope (AsyncResource* res);
822794 };
823795
824796 private:
0 commit comments