Sirikata
|
00001 #ifndef __SIRIKATA_JSCTX_HPP__ 00002 #define __SIRIKATA_JSCTX_HPP__ 00003 00004 #include <sirikata/core/service/Context.hpp> 00005 #include <sirikata/core/util/SerializationCheck.hpp> 00006 #include <v8.h> 00007 00008 00009 namespace Sirikata 00010 { 00011 namespace JS 00012 { 00013 00018 class JSCtx 00019 { 00020 public: 00021 JSCtx( 00022 Context* ctx,Network::IOStrandPtr oStrand, 00023 Network::IOStrandPtr vmStrand,v8::Isolate* is); 00024 00025 ~JSCtx(); 00026 00027 Network::IOStrandPtr objStrand; 00028 Network::IOStrandPtr visManStrand; 00029 Network::IOStrand* mainStrand; 00030 00031 v8::Isolate* mIsolate; 00032 bool stopped(); 00033 void stop(); 00034 void initialize(); 00035 bool initialized(); 00036 00037 Sirikata::SerializationCheck* serializationCheck(); 00038 Network::IOService* getIOService(); 00039 00040 v8::Persistent<v8::FunctionTemplate> mVisibleTemplate; 00041 v8::Persistent<v8::FunctionTemplate> mPresenceTemplate; 00042 v8::Persistent<v8::ObjectTemplate> mContextTemplate; 00043 v8::Persistent<v8::ObjectTemplate> mUtilTemplate; 00044 v8::Persistent<v8::ObjectTemplate> mInvokableObjectTemplate; 00045 v8::Persistent<v8::ObjectTemplate> mSystemTemplate; 00046 v8::Persistent<v8::ObjectTemplate> mTimerTemplate; 00047 v8::Persistent<v8::ObjectTemplate> mContextGlobalTemplate; 00048 00049 // The manager tracks the templates so they can be reused by all the 00050 // individual scripts. 00051 v8::Persistent<v8::FunctionTemplate> mVec3Template; 00052 v8::Persistent<v8::FunctionTemplate> mQuaternionTemplate; 00053 v8::Persistent<v8::FunctionTemplate> mPatternTemplate; 00054 00055 00056 private: 00057 Context* internalContext; 00058 bool isStopped; 00059 bool isInitialized; 00060 Sirikata::SerializationCheck mCheck; 00061 }; 00062 00063 00064 }//end namespace Sirikata 00065 }//end namespace JS 00066 00067 00068 #endif