File Information
Library:
Package:
Header: Poco/OSP/JS/JSExecutor.h
Description
An extension of the Poco::JS::Core::JSExecutor for executing JavaScript code within an OSP environment.
Adds the following global JavaScript objects:
- bundle (Poco::OSP::Bundle wrapper)
- properties (bundle properties wrapper)
- serviceRegistry (Poco::OSP::ServiceRegistry wrapper)
- logger (bundle context logger wrapper)
- HTTPRequest (HTTP request constructor)
- DBSession (Database session constructor)
Inheritance
Direct Base Classes: Poco::JS::Core::JSExecutor
All Base Classes: Poco::JS::Core::JSExecutor, Poco::RefCountedObject, Poco::Runnable
Member Summary
Member Functions: bundle, context, formatErrorInfo, getDefaultMemoryLimit, getGlobalModuleRegistry, getGlobalModuleSearchPaths, handleError, handleMemoryWarning, handleOutOfMemory, setDefaultMemoryLimit, setGlobalModuleRegistry, setGlobalModuleSearchPaths, setupGlobalObject, setupGlobalObjectTemplate
Inherited Functions: addModuleRegistry, addModuleSearchPath, attachToCurrentThread, buildStackTrace, call, callInContext, cancelTerminate, cleanup, compile, current, duplicate, globalContext, handleError, handleMemoryWarning, handleOutOfMemory, importModule, include, includeScript, isRunning, isTerminating, isolate, referenceCount, release, reportError, require, resolveModule, run, runImpl, scriptCompleted, scriptContext, setWrapperProperty, setup, setupGlobalObject, setupGlobalObjectTemplate, sleep, stop, terminate, uri
Types Aliases
Ptr
using Ptr = Poco::AutoPtr < JSExecutor >;
Constructors
JSExecutor
JSExecutor(
Poco::OSP::BundleContext::Ptr pContext,
Poco::OSP::Bundle::Ptr pBundle,
const std::string & source,
const Poco::URI & sourceURI,
const std::vector < std::string > & moduleSearchPaths,
Poco::UInt64 memoryLimit
);
Creates the JSExecutor.
Destructor
~JSExecutor
~JSExecutor();
Destroys the JSExecutor.
Member Functions
bundle
Poco::OSP::Bundle::Ptr bundle() const;
Returns the bundle containing the script.
context
Poco::OSP::BundleContext::Ptr context() const;
Returns the bundle context.
formatErrorInfo
static std::string formatErrorInfo(
const ErrorInfo & errorInfo
);
Formats the given error information to a string suitable for logging.
getDefaultMemoryLimit
static Poco::UInt64 getDefaultMemoryLimit();
Returns the global default memory limit for scripts.
getGlobalModuleRegistry
static Poco::JS::Core::ModuleRegistry::Ptr getGlobalModuleRegistry();
Returns the global module registry.
getGlobalModuleSearchPaths
static const std::vector < std::string > getGlobalModuleSearchPaths();
Returns the global module search paths.
setDefaultMemoryLimit
static void setDefaultMemoryLimit(
Poco::UInt64 memoryLimit
);
Sets the global default memory limit for scripts.
setGlobalModuleRegistry
static void setGlobalModuleRegistry(
Poco::JS::Core::ModuleRegistry::Ptr pModuleRegistry
);
Sets the global module registry.
setGlobalModuleSearchPaths
static void setGlobalModuleSearchPaths(
const std::vector < std::string > & searchPaths
);
Sets the global module search paths.
handleError
void handleError(
const ErrorInfo & errorInfo
);
handleMemoryWarning
void handleMemoryWarning(
std::size_t currentHeapLimit,
std::size_t initialHeapLimit
);
handleOutOfMemory
void handleOutOfMemory(
std::size_t currentHeapLimit,
std::size_t initialHeapLimit
);
setupGlobalObject
void setupGlobalObject(
v8::Local < v8::Object > & global,
v8::Isolate * pIsolate
);
setupGlobalObjectTemplate
void setupGlobalObjectTemplate(
v8::Local < v8::ObjectTemplate > & global,
v8::Isolate * pIsolate
);