#ifndef INCLUDED_TaskStub #define INCLUDED_TaskStub #include "PacketStream.h" #include class Task; typedef int taskid_t; class TaskStub { public: void ref(); void release(); static void create(const v8::FunctionCallbackInfo& args); static TaskStub* createParent(Task* task, uv_file file); static void initialize(); taskid_t getId() { return _id; } Task* getOwner() { return _owner; } v8::Handle getTaskObject(); PacketStream& getStream() { return _stream; } private: v8::Persistent _taskObject; int _refCount = 1; Task* _owner = 0; PacketStream _stream; taskid_t _id = -1; uv_process_t _process; v8::Persistent > _onExit; static bool _determinedExecutable; static char _executable[1024]; TaskStub(); static TaskStub* get(v8::Handle object); static void getExports(const v8::FunctionCallbackInfo& args); static void setImports(const v8::FunctionCallbackInfo& args); static void setRequires(const v8::FunctionCallbackInfo& args); static void getOnExit(v8::Local property, const v8::PropertyCallbackInfo& args); static void setOnExit(v8::Local property, v8::Local value, const v8::PropertyCallbackInfo& args); static void activate(const v8::FunctionCallbackInfo& args); static void execute(const v8::FunctionCallbackInfo& args); static void kill(const v8::FunctionCallbackInfo& args); static void statistics(const v8::FunctionCallbackInfo& args); static void onRelease(const v8::WeakCallbackInfo& data); static void onProcessExit(uv_process_t* process, int64_t status, int terminationSignal); }; #endif