#include #include #include namespace node { using v8::Context; using v8::Script; using v8::Value; using v8::Handle; using v8::HandleScope; using v8::Object; using v8::Arguments; using v8::ThrowException; using v8::TryCatch; using v8::String; using v8::Exception; using v8::Local; using v8::Array; using v8::Persistent; using v8::Integer; using v8::FunctionTemplate; class WrappedContext : ObjectWrap { public: static void Initialize(Handle target); static Handle New(const Arguments& args); Persistent GetV8Context(); static Local NewInstance(); protected: static Persistent constructor_template; WrappedContext(); ~WrappedContext(); Persistent context_; }; Persistent WrappedContext::constructor_template; class WrappedScript : ObjectWrap { public: static void Initialize(Handle target); enum EvalInputFlags { compileCode, unwrapExternal }; enum EvalContextFlags { thisContext, newContext, userContext }; enum EvalOutputFlags { returnResult, wrapExternal }; template static Handle EvalMachine(const Arguments& args); protected: static Persistent constructor_template; WrappedScript() : ObjectWrap() {} ~WrappedScript(); static Handle New(const Arguments& args); static Handle CreateContext(const Arguments& arg); static Handle RunInContext(const Arguments& args); static Handle RunInThisContext(const Arguments& args); static Handle RunInNewContext(const Arguments& args); static Handle CompileRunInContext(const Arguments& args); static Handle CompileRunInThisContext(const Arguments& args); static Handle CompileRunInNewContext(const Arguments& args); Persistent