Sirikata
Classes | Public Member Functions | Public Attributes | Protected Types | Protected Member Functions | Protected Attributes | Private Member Functions | Friends
Sirikata::JS::JSObjectScript Class Reference

#include <JSObjectScript.hpp>

Inheritance diagram for Sirikata::JS::JSObjectScript:
Collaboration diagram for Sirikata::JS::JSObjectScript:

List of all members.

Classes

struct  EvalContext
struct  ScopedEvalContext

Public Member Functions

 JSObjectScript (JSObjectScriptManager *jMan, OH::Storage *storage, OH::PersistedObjectSet *persisted_set, const UUID &internal_id, JSCtx *ctx)
virtual ~JSObjectScript ()
v8::Handle< v8::Value > debug_fileWrite (String &strToWrite, String &filename)
v8::Handle< v8::Value > debug_fileRead (String &filename)
v8::Handle< v8::Value > executeInSandbox (JSContextStruct *jscont, v8::Handle< v8::Function > funcToCall, int argc, v8::Handle< v8::Value > *argv)
v8::Local< v8::Object > createContext (JSPresenceStruct *jspres, const SpaceObjectReference &canSendTo, uint32 capNum, JSContextStruct *&internalContextField, JSContextStruct *creator)
void initialize (const String &args, const String &script, int32 maxResThresh)
virtual void start ()
virtual void stop ()
void print (const String &str)
 Print the given string to the current output.
v8::Handle< v8::Value > import (const String &filename, bool isJS)
 Import a file, executing its contents in scope of most recent evaluation stack frame.
void shimImportAndEvalScript (JSContextStruct *jscont, const String &toEval)
 Adds jscont to evalStack.
v8::Handle< v8::Value > require (const String &filename, bool isJS)
 Require a file, executing its contents in the root object's scope iff it has not yet been imported.
virtual void registerContextForClear (JSContextStruct *jscont)
v8::Handle< v8::Value > storageBeginTransaction (JSContextStruct *jscont)
 FIXME: instead of posting jscont through, instead post its id through.
v8::Handle< v8::Value > storageCommit (JSContextStruct *jscont, v8::Handle< v8::Function > cb)
v8::Handle< v8::Value > storageWrite (const OH::Storage::Key &key, const String &toWrite, v8::Handle< v8::Function > cb, JSContextStruct *jscont)
v8::Handle< v8::Value > storageRead (const OH::Storage::Key &key, v8::Handle< v8::Function > cb, JSContextStruct *jscont)
v8::Handle< v8::Value > storageErase (const OH::Storage::Key &key, v8::Handle< v8::Function > cb, JSContextStruct *jscont)
v8::Handle< v8::Value > storageRangeRead (const OH::Storage::Key &start, const OH::Storage::Key &finish, v8::Handle< v8::Function > cb, JSContextStruct *jscont)
v8::Handle< v8::Value > storageRangeErase (const OH::Storage::Key &start, const OH::Storage::Key &finish, v8::Handle< v8::Function > cb, JSContextStruct *jscont)
v8::Handle< v8::Value > storageCount (const OH::Storage::Key &start, const OH::Storage::Key &finish, v8::Handle< v8::Function > cb, JSContextStruct *jscont)
v8::Handle< v8::Value > setRestoreScript (JSContextStruct *jscont, const String &script, v8::Handle< v8::Function > cb)
v8::Handle< v8::Value > pushEvalContextScopeDirectory (const String &newDir)
v8::Handle< v8::Value > popEvalContextScopeDirectory ()
bool checkCurCtxtHasCapability (JSPresenceStruct *jspres, Capabilities::Caps whatCap)
 Returns true if context eval stack is not empty and if the top context on the stack allows operation associated with whatCap on jspres.
v8::Handle< v8::Value > checkResources ()
 We want to ensure that no sandboxes have while(1) loops.
bool checkResourcesCPP ()
Handle< v8::Context > context ()
bool isRootContext (JSContextStruct *jscont)
JSObjectScriptManagermanager () const
v8::Local< v8::Function > functionValue (const String &em_script_str)
v8::Handle< v8::Value > invokeCallback (JSContextStruct *ctx, v8::Handle< v8::Object > *target, v8::Handle< v8::Function > &cb, int argc, v8::Handle< v8::Value > argv[])
v8::Handle< v8::Value > invokeCallback (JSContextStruct *ctx, v8::Handle< v8::Function > &cb, int argc, v8::Handle< v8::Value > argv[])
v8::Handle< v8::Value > invokeCallback (JSContextStruct *ctx, v8::Handle< v8::Function > &cb)
virtual void postCallbackChecks ()
JSContextStructrootContext () const
bool isStopped ()
 Returns true if stop has ever been called on JSObjectScript.
v8::Handle< v8::Value > emersonCompileString (const String &toCompile)
 Runs the string toCompile through the emerson parser.
v8::Handle< v8::Value > evalInGlobal (const String &contents, v8::ScriptOrigin *em_script_name, JSContextStruct *jscs)
 Eval a string, executing its contents in the root object's scope.

Public Attributes

JSCtxmCtx

Protected Types

typedef std::map< uint32,
std::set< String > > 
ImportedFileMap
typedef ImportedFileMap::iterator ImportedFileMapIter
typedef std::map< uint32,
SuspendableVec
ContIDToSuspMap

Protected Member Functions

void preEvalOps ()
 Each time before we call an eval function into v8, we first call preEvalOps.
void postEvalOps ()
 Decrements mNestedEvalCounter.
bool resolveImport (const String &filename, bool isJS, boost::filesystem::path *full_file_out, boost::filesystem::path *base_path_out)
bool resolveImport (const String &filename, boost::filesystem::path *full_file_out, boost::filesystem::path *base_path_out)
v8::Handle< v8::Value > absoluteImport (const boost::filesystem::path &full_filename, const boost::filesystem::path &full_base_dir, bool isJS)
void printStackFrame (std::stringstream &, v8::Local< v8::StackFrame >)
void storageCommitCallback (JSContextStruct *jscont, v8::Persistent< v8::Function > cb, OH::Storage::Result result, OH::Storage::ReadSet *rs, Liveness::Token objAlive, Liveness::Token ctxAlive)
void storageCountCallback (JSContextStruct *jscont, v8::Persistent< v8::Function > cb, OH::Storage::Result result, int32 count, Liveness::Token objAlive, Liveness::Token ctxAlive)
void iSetRestoreScriptCallback (JSContextStruct *jscont, v8::Persistent< v8::Function > cb, bool success, Liveness::Token, Liveness::Token ctxAlive)
void iStop (Liveness::Token alive, bool letDie)

Protected Attributes

UUID mInternalID
int32 mResourceCounter
int32 mNestedEvalCounter
 We want to keep track of whether we're in an eval loop or not.
uint32 contIDTracker
std::map< uint32,
JSContextStruct * > 
mContStructMap
std::stack< EvalContextmEvalContextStack
ImportedFileMap mImportedFiles
JSContextStructmContext
ContIDToSuspMap toFixup
JSObjectScriptManagermManager
OH::StoragemStorage
OH::PersistedObjectSetmPersistedObjectSet
int32 maxResourceThresh
 If we execute this number of cycles in one pass of event loop, throw a resource error.
bool stopCalled
 Will be true after stop method is called.

Private Member Functions

v8::Handle< v8::Value > compileFunctionInContext (v8::Handle< v8::Function > &cb)
void printExceptionToScript (const String &exc)
v8::Handle< v8::Value > protectedEval (const String &em_script_str, v8::ScriptOrigin *em_script_name, const EvalContext &new_ctx, bool return_exc=false, const String &cache_path="", bool isJS=false)
v8::Handle< v8::Value > internalEval (const String &em_script_str, v8::ScriptOrigin *em_script_name, bool is_emerson, bool return_exc=false, const String &cache_path="")
v8::Handle< v8::Context > getCurrentV8Context ()
void eStorageBeginTransaction (JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageCommit (JSContextStruct *jscont, v8::Persistent< v8::Function > cb, Liveness::Token objAlive, Liveness::Token ctxAlive)
void iStorageCommitCallback (JSContextStruct *jscont, v8::Persistent< v8::Function > cb, OH::Storage::Result result, OH::Storage::ReadSet *rs, Liveness::Token objAlive, Liveness::Token ctxAlive)
void iStorageCountCallback (JSContextStruct *jscont, v8::Persistent< v8::Function > cb, OH::Storage::Result result, int32 count, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageErase (const OH::Storage::Key &key, v8::Persistent< v8::Function > cb, JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageWrite (const OH::Storage::Key &key, const String &toWrite, v8::Persistent< v8::Function > cb, JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageRead (const OH::Storage::Key &key, v8::Persistent< v8::Function > cb, JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageRangeRead (const OH::Storage::Key &start, const OH::Storage::Key &finish, v8::Persistent< v8::Function > cb, JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageRangeErase (const OH::Storage::Key &start, const OH::Storage::Key &finish, v8::Persistent< v8::Function > cb, JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eStorageCount (const OH::Storage::Key &start, const OH::Storage::Key &finish, v8::Persistent< v8::Function > cb, JSContextStruct *jscont, Liveness::Token objAlive, Liveness::Token ctxAlive)
void eSetRestoreScript (JSContextStruct *jscont, const String &script, v8::Persistent< v8::Function > cb, Liveness::Token objAlive, Liveness::Token ctxAlive)
void iDelContext (JSContextStruct *toDel, Liveness::Token ctxLT)

Friends

class ScopedEvalContext

Member Typedef Documentation

typedef std::map<uint32, SuspendableVec> Sirikata::JS::JSObjectScript::ContIDToSuspMap [protected]
typedef std::map<uint32,std::set<String> > Sirikata::JS::JSObjectScript::ImportedFileMap [protected]
typedef ImportedFileMap::iterator Sirikata::JS::JSObjectScript::ImportedFileMapIter [protected]

Constructor & Destructor Documentation

Sirikata::JS::JSObjectScript::JSObjectScript ( JSObjectScriptManager jMan,
OH::Storage storage,
OH::PersistedObjectSet persisted_set,
const UUID internal_id,
JSCtx ctx 
)
Sirikata::JS::JSObjectScript::~JSObjectScript ( ) [virtual]

Member Function Documentation

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::absoluteImport ( const boost::filesystem::path &  full_filename,
const boost::filesystem::path &  full_base_dir,
bool  isJS 
) [protected]
bool Sirikata::JS::JSObjectScript::checkCurCtxtHasCapability ( JSPresenceStruct jspres,
Capabilities::Caps  whatCap 
)

Returns true if context eval stack is not empty and if the top context on the stack allows operation associated with whatCap on jspres.

Returns false otherwise.

References Sirikata::JS::JSContextStruct::getAssociatedPresenceStruct(), Sirikata::JS::JSContextStruct::getCapNum(), Sirikata::JS::Capabilities::givesCap(), JSSCRIPT_SERIAL_CHECK, and mEvalContextStack.

Referenced by Sirikata::JS::JSSystemStruct::checkCurCtxtHasCapability().

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::checkResources ( )

We want to ensure that no sandboxes have while(1) loops.

Roughly, the way we do this is that our compiler inserts a lot of calls to checkResources. If checkResources returns false, then we throw an uncatch-able error.

Using a stupid implementation for checkResources. Every time that we call eval, and are not currently executing code/handling an event, then we set mResourceCounter to zero. Every interleaving call to checkResources increments mResourceCounter. If mResourceCounter ever gets above a threshold value, the next checkResources call returns false, causing the script to throw an uncatchable error.

Returns:
{v8::Boolean} Returns true if still have adequate resources to continue computation. Returns false otherwise.

References checkResourcesCPP(), and JSSCRIPT_SERIAL_CHECK.

Referenced by Sirikata::JS::JSGlobal::checkResources().

bool Sirikata::JS::JSObjectScript::checkResourcesCPP ( )
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::compileFunctionInContext ( v8::Handle< v8::Function > &  cb) [private]
Handle<v8::Context> Sirikata::JS::JSObjectScript::context ( ) [inline]
v8::Local< v8::Object > Sirikata::JS::JSObjectScript::createContext ( JSPresenceStruct jspres,
const SpaceObjectReference canSendTo,
uint32  capNum,
JSContextStruct *&  internalContextField,
JSContextStruct creator 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::debug_fileRead ( String &  filename)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::debug_fileWrite ( String &  strToWrite,
String &  filename 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::emersonCompileString ( const String &  toCompile)

Runs the string toCompile through the emerson parser.

If fails to compile, then returns syntax error.

References EmersonUtil::emerson_compile(), emerson_init(), Sirikata::Logging::error, Sirikata::Logging::insane, JSLOG, and JSSCRIPT_SERIAL_CHECK.

Referenced by Sirikata::JS::JSContextStruct::emersonCompileString().

void Sirikata::JS::JSObjectScript::eSetRestoreScript ( JSContextStruct jscont,
const String &  script,
v8::Persistent< v8::Function >  cb,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageBeginTransaction ( JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageCommit ( JSContextStruct jscont,
v8::Persistent< v8::Function >  cb,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageCount ( const OH::Storage::Key start,
const OH::Storage::Key finish,
v8::Persistent< v8::Function >  cb,
JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageErase ( const OH::Storage::Key key,
v8::Persistent< v8::Function >  cb,
JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageRangeErase ( const OH::Storage::Key start,
const OH::Storage::Key finish,
v8::Persistent< v8::Function >  cb,
JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageRangeRead ( const OH::Storage::Key start,
const OH::Storage::Key finish,
v8::Persistent< v8::Function >  cb,
JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageRead ( const OH::Storage::Key key,
v8::Persistent< v8::Function >  cb,
JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::eStorageWrite ( const OH::Storage::Key key,
const String &  toWrite,
v8::Persistent< v8::Function >  cb,
JSContextStruct jscont,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::evalInGlobal ( const String &  contents,
v8::ScriptOrigin *  em_script_name,
JSContextStruct jscs 
)

Eval a string, executing its contents in the root object's scope.

References JSSCRIPT_SERIAL_CHECK, mEvalContextStack, and protectedEval().

Referenced by Sirikata::JS::JSContextStruct::struct_evalInGlobal().

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::executeInSandbox ( JSContextStruct jscont,
v8::Handle< v8::Function >  funcToCall,
int  argc,
v8::Handle< v8::Value > *  argv 
)
v8::Local< v8::Function > Sirikata::JS::JSObjectScript::functionValue ( const String &  em_script_str)
v8::Handle< v8::Context > Sirikata::JS::JSObjectScript::getCurrentV8Context ( ) [private]
void Sirikata::JS::JSObjectScript::iDelContext ( JSContextStruct toDel,
Liveness::Token  ctxLT 
) [private]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::import ( const String &  filename,
bool  isJS 
)

Import a file, executing its contents in scope of most recent evaluation stack frame.

Should not call import directly unless we are positive that we are inside a valid mEvalContext.

References absoluteImport(), Sirikata::Logging::detailed, JSLOG, JSSCRIPT_SERIAL_CHECK, and resolveImport().

Referenced by Sirikata::JS::JSContextStruct::struct_import().

void Sirikata::JS::JSObjectScript::initialize ( const String &  args,
const String &  script,
int32  maxResThresh 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::internalEval ( const String &  em_script_str,
v8::ScriptOrigin *  em_script_name,
bool  is_emerson,
bool  return_exc = false,
const String &  cache_path = "" 
) [private]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::invokeCallback ( JSContextStruct ctx,
v8::Handle< v8::Function > &  cb,
int  argc,
v8::Handle< v8::Value >  argv[] 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::invokeCallback ( JSContextStruct ctx,
v8::Handle< v8::Function > &  cb 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::invokeCallback ( JSContextStruct ctx,
v8::Handle< v8::Object > *  target,
v8::Handle< v8::Function > &  cb,
int  argc,
v8::Handle< v8::Value >  argv[] 
)
void Sirikata::JS::JSObjectScript::iSetRestoreScriptCallback ( JSContextStruct jscont,
v8::Persistent< v8::Function >  cb,
bool  success,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [protected]
bool Sirikata::JS::JSObjectScript::isRootContext ( JSContextStruct jscont)
bool Sirikata::JS::JSObjectScript::isStopped ( )
void Sirikata::JS::JSObjectScript::iStop ( Liveness::Token  alive,
bool  letDie 
) [protected]
void Sirikata::JS::JSObjectScript::iStorageCommitCallback ( JSContextStruct jscont,
v8::Persistent< v8::Function >  cb,
OH::Storage::Result  result,
OH::Storage::ReadSet rs,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
void Sirikata::JS::JSObjectScript::iStorageCountCallback ( JSContextStruct jscont,
v8::Persistent< v8::Function >  cb,
OH::Storage::Result  result,
int32  count,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [private]
JSObjectScriptManager* Sirikata::JS::JSObjectScript::manager ( ) const [inline]

Reimplemented in Sirikata::JS::EmersonScript.

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::popEvalContextScopeDirectory ( )
virtual void Sirikata::JS::JSObjectScript::postCallbackChecks ( ) [inline, virtual]
void Sirikata::JS::JSObjectScript::postEvalOps ( ) [protected]

Decrements mNestedEvalCounter.

Used for bookkeeping so that we can keep track of what level of eval nesting we're in.

References JSSCRIPT_SERIAL_CHECK, and mNestedEvalCounter.

Referenced by executeInSandbox(), internalEval(), invokeCallback(), and printExceptionToScript().

void Sirikata::JS::JSObjectScript::preEvalOps ( ) [protected]

Each time before we call an eval function into v8, we first call preEvalOps.

preEvalOps sets up mResourceCounter and mNestedEvalCounter before calling eval/run/call. (It increments mNestedEvalCounter and if this eval isn't called from inside another eval, then we set mResourceCounter to zero.)

References Sirikata::Logging::error, JSLOG, JSSCRIPT_SERIAL_CHECK, mNestedEvalCounter, and mResourceCounter.

Referenced by executeInSandbox(), internalEval(), invokeCallback(), and printExceptionToScript().

void Sirikata::JS::JSObjectScript::print ( const String &  str)

Print the given string to the current output.

References JSSCRIPT_SERIAL_CHECK, and mEvalContextStack.

Referenced by Sirikata::JS::JSContextStruct::jsscript_print().

void Sirikata::JS::JSObjectScript::printExceptionToScript ( const String &  exc) [private]
void Sirikata::JS::JSObjectScript::printStackFrame ( std::stringstream &  ,
v8::Local< v8::StackFrame >   
) [protected]

Reimplemented in Sirikata::JS::EmersonScript.

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::protectedEval ( const String &  em_script_str,
v8::ScriptOrigin *  em_script_name,
const EvalContext new_ctx,
bool  return_exc = false,
const String &  cache_path = "",
bool  isJS = false 
) [private]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::pushEvalContextScopeDirectory ( const String &  newDir)
void Sirikata::JS::JSObjectScript::registerContextForClear ( JSContextStruct jscont) [virtual]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::require ( const String &  filename,
bool  isJS 
)
bool Sirikata::JS::JSObjectScript::resolveImport ( const String &  filename,
boost::filesystem::path *  full_file_out,
boost::filesystem::path *  base_path_out 
) [protected]
bool Sirikata::JS::JSObjectScript::resolveImport ( const String &  filename,
bool  isJS,
boost::filesystem::path *  full_file_out,
boost::filesystem::path *  base_path_out 
) [protected]

Referenced by import(), and require().

JSContextStruct* Sirikata::JS::JSObjectScript::rootContext ( ) const [inline]

Reimplemented in Sirikata::JS::EmersonScript.

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::setRestoreScript ( JSContextStruct jscont,
const String &  script,
v8::Handle< v8::Function >  cb 
)
void Sirikata::JS::JSObjectScript::shimImportAndEvalScript ( JSContextStruct jscont,
const String &  toEval 
)

Adds jscont to evalStack.

Imports shim files and evals toEval. Pops jscont after this.

References internalEval(), JSSCRIPT_SERIAL_CHECK, and mEvalContextStack.

Referenced by Sirikata::JS::JSContextStruct::createContextObjects().

void Sirikata::JS::JSObjectScript::start ( ) [virtual]

Reimplemented from Sirikata::ObjectScript.

Reimplemented in Sirikata::JS::EmersonScript.

void Sirikata::JS::JSObjectScript::stop ( ) [virtual]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageBeginTransaction ( JSContextStruct jscont)

FIXME: instead of posting jscont through, instead post its id through.

That way, it can't get deleted out from under us.

References eStorageBeginTransaction(), JSSCRIPT_SERIAL_CHECK, Sirikata::Liveness::livenessToken(), Sirikata::JS::JSCtx::mainStrand, mCtx, mStorage, and Sirikata::Network::IOStrand::post().

Referenced by Sirikata::JS::JSContextStruct::storageBeginTransaction().

v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageCommit ( JSContextStruct jscont,
v8::Handle< v8::Function >  cb 
)
void Sirikata::JS::JSObjectScript::storageCommitCallback ( JSContextStruct jscont,
v8::Persistent< v8::Function >  cb,
OH::Storage::Result  result,
OH::Storage::ReadSet rs,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [protected]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageCount ( const OH::Storage::Key start,
const OH::Storage::Key finish,
v8::Handle< v8::Function >  cb,
JSContextStruct jscont 
)
void Sirikata::JS::JSObjectScript::storageCountCallback ( JSContextStruct jscont,
v8::Persistent< v8::Function >  cb,
OH::Storage::Result  result,
int32  count,
Liveness::Token  objAlive,
Liveness::Token  ctxAlive 
) [protected]
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageErase ( const OH::Storage::Key key,
v8::Handle< v8::Function >  cb,
JSContextStruct jscont 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageRangeErase ( const OH::Storage::Key start,
const OH::Storage::Key finish,
v8::Handle< v8::Function >  cb,
JSContextStruct jscont 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageRangeRead ( const OH::Storage::Key start,
const OH::Storage::Key finish,
v8::Handle< v8::Function >  cb,
JSContextStruct jscont 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageRead ( const OH::Storage::Key key,
v8::Handle< v8::Function >  cb,
JSContextStruct jscont 
)
v8::Handle< v8::Value > Sirikata::JS::JSObjectScript::storageWrite ( const OH::Storage::Key key,
const String &  toWrite,
v8::Handle< v8::Function >  cb,
JSContextStruct jscont 
)

Friends And Related Function Documentation

friend class ScopedEvalContext [friend]

Member Data Documentation

Referenced by createContext(), and initialize().

If we execute this number of cycles in one pass of event loop, throw a resource error.

Referenced by checkResourcesCPP(), and initialize().

Referenced by Sirikata::JS::EmersonScript::addConnectedPresence(), Sirikata::JS::EmersonScript::create_entity(), Sirikata::JS::EmersonScript::create_event(), Sirikata::JS::EmersonScript::create_timeout(), createContext(), Sirikata::JS::EmersonScript::createVisibleWeakPersistent(), Sirikata::JS::EmersonScript::EmersonScript(), eSetRestoreScript(), Sirikata::JS::EmersonScript::handleScriptCommUnreliable(), Sirikata::JS::EmersonScript::iHandleScriptCommRead(), Sirikata::JS::EmersonScript::iHandleScriptCommUnreliable(), Sirikata::JS::EmersonScript::iInvokeInvokable(), initialize(), Sirikata::JS::EmersonScript::iNotifyProximate(), Sirikata::JS::EmersonScript::iNotifyProximateGone(), invokeCallback(), Sirikata::JS::EmersonScript::invokeCallbackInContext(), Sirikata::JS::EmersonScript::invokeInvokable(), Sirikata::JS::EmersonScript::iOnConnected(), Sirikata::JS::EmersonScript::iOnDisconnected(), iSetRestoreScriptCallback(), iStop(), Sirikata::JS::EmersonScript::iStop(), iStorageCommitCallback(), iStorageCountCallback(), Sirikata::JS::EmersonScript::killScript(), Sirikata::JS::EmersonScript::notifyProximate(), Sirikata::JS::EmersonScript::notifyProximateGone(), Sirikata::JS::EmersonScript::onConnected(), Sirikata::JS::EmersonScript::onDisconnected(), Sirikata::JS::EmersonScript::processSandboxMessage(), Sirikata::JS::EmersonScript::restorePresence(), Sirikata::JS::EmersonScript::runSimulation(), Sirikata::JS::EmersonScript::sendSandbox(), Sirikata::JS::EmersonScript::setBounds(), Sirikata::JS::EmersonScript::setLocation(), Sirikata::JS::EmersonScript::setOrientation(), Sirikata::JS::EmersonScript::setPhysicsFunction(), Sirikata::JS::EmersonScript::setQueryFunction(), setRestoreScript(), Sirikata::JS::EmersonScript::setVisual(), stop(), Sirikata::JS::EmersonScript::stop(), storageBeginTransaction(), storageCommit(), storageCommitCallback(), storageCount(), storageCountCallback(), storageErase(), storageRangeErase(), storageRangeRead(), storageRead(), storageWrite(), Sirikata::JS::EmersonScript::wrapPresence(), and ~JSObjectScript().

We want to keep track of whether we're in an eval loop or not.

If we are, then mNestedEvalCounter keeps track of how many levels of evals we're in. Ie, if we call eval and from inside that eval, call eval again, then we're mNestedEvalCounter should be 2. If we are outside of all evals, then mNestedEvalCounter should be zero.

Referenced by postEvalOps(), and preEvalOps().

See also:
checkResources

Referenced by checkResourcesCPP(), and preEvalOps().

Will be true after stop method is called.

Referenced by isStopped(), and iStop().


The documentation for this class was generated from the following files: