0
0
mirror of https://github.com/phpv8/v8js.git synced 2024-09-19 00:25:18 +00:00

Remove php_ prefix to struct & type names

This commit is contained in:
Stefan Siegl 2014-12-13 01:15:29 +01:00
parent 3efec8d428
commit 2954de2db5
13 changed files with 85 additions and 85 deletions

View File

@ -101,17 +101,17 @@ v8::Handle<v8::Value> zval_to_v8js(zval *, v8::Isolate * TSRMLS_DC);
/* Convert V8 value into zval */
int v8js_to_zval(v8::Handle<v8::Value>, zval *, int, v8::Isolate * TSRMLS_DC);
struct php_v8js_accessor_ctx
struct v8js_accessor_ctx
{
char *variable_name_string;
uint variable_name_string_len;
v8::Isolate *isolate;
};
void php_v8js_accessor_ctx_dtor(php_v8js_accessor_ctx * TSRMLS_DC);
void v8js_accessor_ctx_dtor(v8js_accessor_ctx * TSRMLS_DC);
/* Register accessors into passed object */
void php_v8js_register_accessors(std::vector<php_v8js_accessor_ctx*> *accessor_list, v8::Local<v8::FunctionTemplate>, zval *, v8::Isolate * TSRMLS_DC);
void php_v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8::Local<v8::FunctionTemplate>, zval *, v8::Isolate * TSRMLS_DC);
/* Resource declaration */
@ -126,7 +126,7 @@ ZEND_BEGIN_MODULE_GLOBALS(v8js)
bool use_array_access; /* Convert ArrayAccess, Countable objects to array-like objects */
// Timer thread globals
std::deque<php_v8js_timer_ctx *> timer_stack;
std::deque<v8js_timer_ctx *> timer_stack;
std::thread *timer_thread;
std::mutex timer_mutex;
bool timer_stop;
@ -145,15 +145,15 @@ ZEND_EXTERN_MODULE_GLOBALS(v8js)
#endif
/* Register builtin methods into passed object */
void php_v8js_register_methods(v8::Handle<v8::ObjectTemplate>, php_v8js_ctx *c);
void php_v8js_register_methods(v8::Handle<v8::ObjectTemplate>, v8js_ctx *c);
typedef struct _php_v8js_script {
typedef struct _v8js_script {
char *name;
v8::Isolate *isolate;
v8::Persistent<v8::Script, v8::CopyablePersistentTraits<v8::Script>> *script;
} php_v8js_script;
} v8js_script;
static void php_v8js_script_free(php_v8js_script *res, bool dispose_persistent);
static void v8js_script_free(v8js_script *res, bool dispose_persistent);
#endif /* PHP_V8JS_MACROS_H */

View File

@ -186,7 +186,7 @@ static PHP_GINIT_FUNCTION(v8js)
v8js_globals->timer_thread = NULL;
v8js_globals->timer_stop = false;
new(&v8js_globals->timer_mutex) std::mutex;
new(&v8js_globals->timer_stack) std::deque<php_v8js_timer_ctx *>;
new(&v8js_globals->timer_stack) std::deque<v8js_timer_ctx *>;
v8js_globals->fatal_error_abort = 0;
#endif

View File

@ -57,13 +57,13 @@ struct php_v8js_jsext {
/* }}} */
#ifdef ENABLE_DEBUGGER_SUPPORT
static php_v8js_ctx *v8js_debug_context;
static v8js_ctx *v8js_debug_context;
static int v8js_debug_auto_break_mode;
#endif
static void php_v8js_free_storage(void *object TSRMLS_DC) /* {{{ */
{
php_v8js_ctx *c = (php_v8js_ctx *) object;
v8js_ctx *c = (v8js_ctx *) object;
zend_object_std_dtor(&c->std TSRMLS_CC);
@ -99,9 +99,9 @@ static void php_v8js_free_storage(void *object TSRMLS_DC) /* {{{ */
c->template_cache.~map();
/* Clear contexts */
for (std::vector<php_v8js_accessor_ctx*>::iterator it = c->accessor_list.begin();
for (std::vector<v8js_accessor_ctx*>::iterator it = c->accessor_list.begin();
it != c->accessor_list.end(); ++it) {
php_v8js_accessor_ctx_dtor(*it TSRMLS_CC);
v8js_accessor_ctx_dtor(*it TSRMLS_CC);
}
c->accessor_list.~vector();
@ -164,9 +164,9 @@ static void php_v8js_free_storage(void *object TSRMLS_DC) /* {{{ */
static zend_object_value php_v8js_new(zend_class_entry *ce TSRMLS_DC) /* {{{ */
{
zend_object_value retval;
php_v8js_ctx *c;
v8js_ctx *c;
c = (php_v8js_ctx *) ecalloc(1, sizeof(*c));
c = (v8js_ctx *) ecalloc(1, sizeof(*c));
zend_object_std_init(&c->std, ce TSRMLS_CC);
TSRMLS_SET_CTX(c->zts_ctx);
@ -187,7 +187,7 @@ static zend_object_value php_v8js_new(zend_class_entry *ce TSRMLS_DC) /* {{{ */
new(&c->modules_loaded) std::map<char *, v8js_persistent_obj_t>;
new(&c->template_cache) std::map<const char *,v8js_tmpl_t>();
new(&c->accessor_list) std::vector<php_v8js_accessor_ctx *>();
new(&c->accessor_list) std::vector<v8js_accessor_ctx *>();
new(&c->weak_closures) std::map<v8js_tmpl_t *, v8js_persistent_obj_t>();
new(&c->weak_objects) std::map<zval *, v8js_persistent_obj_t>();
@ -299,7 +299,7 @@ static PHP_METHOD(V8Js, __construct)
const char **exts = NULL;
int exts_count = 0;
php_v8js_ctx *c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
v8js_ctx *c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
if (!c->context.IsEmpty()) {
/* called __construct() twice, bail out */
@ -461,9 +461,9 @@ PHP_METHOD(V8Js, __wakeup)
}
/* }}} */
static void php_v8js_compile_script(zval *this_ptr, const char *str, int str_len, const char *identifier, int identifier_len, php_v8js_script **ret TSRMLS_DC)
static void php_v8js_compile_script(zval *this_ptr, const char *str, int str_len, const char *identifier, int identifier_len, v8js_script **ret TSRMLS_DC)
{
php_v8js_script *res = NULL;
v8js_script *res = NULL;
V8JS_BEGIN_CTX(c, this_ptr)
@ -482,7 +482,7 @@ static void php_v8js_compile_script(zval *this_ptr, const char *str, int str_len
php_v8js_throw_script_exception(&try_catch TSRMLS_CC);
return;
}
res = (php_v8js_script *)emalloc(sizeof(php_v8js_script));
res = (v8js_script *)emalloc(sizeof(v8js_script));
res->script = new v8::Persistent<v8::Script, v8::CopyablePersistentTraits<v8::Script>>(c->isolate, script);
v8::String::Utf8Value _sname(sname);
@ -492,9 +492,9 @@ static void php_v8js_compile_script(zval *this_ptr, const char *str, int str_len
return;
}
static void php_v8js_execute_script(zval *this_ptr, php_v8js_script *res, long flags, long time_limit, long memory_limit, zval **return_value TSRMLS_DC)
static void php_v8js_execute_script(zval *this_ptr, v8js_script *res, long flags, long time_limit, long memory_limit, zval **return_value TSRMLS_DC)
{
php_v8js_ctx *c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
v8js_ctx *c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
if (res->isolate != c->isolate) {
zend_error(E_WARNING, "Script resource from wrong V8Js object passed");
@ -525,7 +525,7 @@ static PHP_METHOD(V8Js, executeString)
char *str = NULL, *identifier = NULL, *tz = NULL;
int str_len = 0, identifier_len = 0;
long flags = V8JS_FLAG_NONE, time_limit = 0, memory_limit = 0;
php_v8js_script *res = NULL;
v8js_script *res = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|slll", &str, &str_len, &identifier, &identifier_len, &flags, &time_limit, &memory_limit) == FAILURE) {
return;
@ -536,7 +536,7 @@ static PHP_METHOD(V8Js, executeString)
RETURN_FALSE;
}
php_v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value TSRMLS_CC);
php_v8js_script_free(res, true);
v8js_script_free(res, true);
efree(res);
}
/* }}} */
@ -548,7 +548,7 @@ static PHP_METHOD(V8Js, compileString)
{
char *str = NULL, *identifier = NULL;
int str_len = 0, identifier_len = 0;
php_v8js_script *res = NULL;
v8js_script *res = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s|s", &str, &str_len, &identifier, &identifier_len) == FAILURE) {
return;
@ -569,13 +569,13 @@ static PHP_METHOD(V8Js, executeScript)
{
long flags = V8JS_FLAG_NONE, time_limit = 0, memory_limit = 0;
zval *zscript;
php_v8js_script *res;
v8js_script *res;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r|lll", &zscript, &flags, &time_limit, &memory_limit) == FAILURE) {
return;
}
ZEND_FETCH_RESOURCE(res, php_v8js_script*, &zscript, -1, PHP_V8JS_SCRIPT_RES_NAME, le_v8js_script);
ZEND_FETCH_RESOURCE(res, v8js_script*, &zscript, -1, PHP_V8JS_SCRIPT_RES_NAME, le_v8js_script);
ZEND_VERIFY_RESOURCE(res);
php_v8js_execute_script(getThis(), res, flags, time_limit, memory_limit, &return_value TSRMLS_CC);
@ -591,7 +591,7 @@ static PHP_METHOD(V8Js, checkString)
const char *identifier = "V8Js::checkString()";
int identifier_len = 19;
php_v8js_script *res = NULL;
v8js_script *res = NULL;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "s", &str, &str_len) == FAILURE) {
return;
@ -602,7 +602,7 @@ static PHP_METHOD(V8Js, checkString)
RETURN_FALSE;
}
php_v8js_script_free(res, true);
v8js_script_free(res, true);
efree(res);
RETURN_TRUE;
}
@ -614,7 +614,7 @@ static PHP_METHOD(V8Js, checkString)
__destruct for V8Js */
static PHP_METHOD(V8Js, __destruct)
{
php_v8js_ctx *c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
v8js_ctx *c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
if(!c->isolate) {
/* c->isolate is initialized by __construct, which wasn't called if this
@ -680,13 +680,13 @@ static PHP_METHOD(V8Js, startDebugAgent)
*/
static PHP_METHOD(V8Js, getPendingException)
{
php_v8js_ctx *c;
v8js_ctx *c;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
if (c->pending_exception) {
RETURN_ZVAL(c->pending_exception, 1, 0);
@ -698,13 +698,13 @@ static PHP_METHOD(V8Js, getPendingException)
*/
static PHP_METHOD(V8Js, clearPendingException)
{
php_v8js_ctx *c;
v8js_ctx *c;
if (zend_parse_parameters_none() == FAILURE) {
return;
}
c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
if (c->pending_exception) {
zval_ptr_dtor(&c->pending_exception);
@ -717,14 +717,14 @@ static PHP_METHOD(V8Js, clearPendingException)
*/
static PHP_METHOD(V8Js, setModuleLoader)
{
php_v8js_ctx *c;
v8js_ctx *c;
zval *callable;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "z", &callable) == FAILURE) {
return;
}
c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c->module_loader = callable;
Z_ADDREF_P(c->module_loader);
@ -735,20 +735,20 @@ static PHP_METHOD(V8Js, setModuleLoader)
*/
static PHP_METHOD(V8Js, setTimeLimit)
{
php_v8js_ctx *c;
v8js_ctx *c;
long time_limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &time_limit) == FAILURE) {
return;
}
c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c->time_limit = time_limit;
V8JSG(timer_mutex).lock();
for (std::deque< php_v8js_timer_ctx* >::iterator it = V8JSG(timer_stack).begin();
for (std::deque< v8js_timer_ctx* >::iterator it = V8JSG(timer_stack).begin();
it != V8JSG(timer_stack).end(); it ++) {
if((*it)->v8js_ctx == c && !(*it)->killed) {
if((*it)->ctx == c && !(*it)->killed) {
(*it)->time_limit = time_limit;
// Calculate the time point when the time limit is exceeded
@ -771,20 +771,20 @@ static PHP_METHOD(V8Js, setTimeLimit)
*/
static PHP_METHOD(V8Js, setMemoryLimit)
{
php_v8js_ctx *c;
v8js_ctx *c;
long memory_limit = 0;
if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "l", &memory_limit) == FAILURE) {
return;
}
c = (php_v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c = (v8js_ctx *) zend_object_store_get_object(getThis() TSRMLS_CC);
c->memory_limit = memory_limit;
V8JSG(timer_mutex).lock();
for (std::deque< php_v8js_timer_ctx* >::iterator it = V8JSG(timer_stack).begin();
for (std::deque< v8js_timer_ctx* >::iterator it = V8JSG(timer_stack).begin();
it != V8JSG(timer_stack).end(); it ++) {
if((*it)->v8js_ctx == c && !(*it)->killed) {
if((*it)->ctx == c && !(*it)->killed) {
(*it)->memory_limit = memory_limit;
}
}
@ -827,7 +827,7 @@ static void php_v8js_persistent_zval_dtor(zval **p) /* {{{ */
}
/* }}} */
static void php_v8js_script_free(php_v8js_script *res, bool dispose_persistent)
static void v8js_script_free(v8js_script *res, bool dispose_persistent)
{
if (res->name) {
efree(res->name);
@ -839,11 +839,11 @@ static void php_v8js_script_free(php_v8js_script *res, bool dispose_persistent)
}
}
static void php_v8js_script_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
static void v8js_script_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) /* {{{ */
{
php_v8js_script *res = (php_v8js_script *)rsrc->ptr;
v8js_script *res = (v8js_script *)rsrc->ptr;
if (res) {
php_v8js_script_free(res, false);
v8js_script_free(res, false);
efree(res);
}
}
@ -1130,7 +1130,7 @@ PHP_MINIT_FUNCTION(v8js_class) /* {{{ */
zend_declare_class_constant_long(php_ce_v8js, ZEND_STRL("DEBUG_AUTO_BREAK_ALWAYS"), V8JS_DEBUG_AUTO_BREAK_ALWAYS TSRMLS_CC);
#endif
le_v8js_script = zend_register_list_destructors_ex(php_v8js_script_dtor, NULL, PHP_V8JS_SCRIPT_RES_NAME, module_number);
le_v8js_script = zend_register_list_destructors_ex(v8js_script_dtor, NULL, PHP_V8JS_SCRIPT_RES_NAME, module_number);
} /* }}} */
/*

View File

@ -21,10 +21,10 @@ typedef v8::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object> > v8
/* Forward declarations */
struct v8js_v8object;
struct php_v8js_accessor_ctx;
struct v8js_accessor_ctx;
/* {{{ Context container */
struct php_v8js_ctx {
struct v8js_ctx {
zend_object std;
v8::Persistent<v8::String> object_name;
v8::Persistent<v8::Context> context;
@ -51,7 +51,7 @@ struct php_v8js_ctx {
std::list<v8js_v8object *> v8js_v8objects;
std::vector<php_v8js_accessor_ctx *> accessor_list;
std::vector<v8js_accessor_ctx *> accessor_list;
char *tz;
#ifdef ZTS
void ***zts_ctx;
@ -60,7 +60,7 @@ struct php_v8js_ctx {
/* }}} */
#ifdef ZTS
# define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((php_v8js_ctx *) isolate->GetData(0))->zts_ctx);
# define V8JS_TSRMLS_FETCH() TSRMLS_FETCH_FROM_CTX(((v8js_ctx *) isolate->GetData(0))->zts_ctx);
#else
# define V8JS_TSRMLS_FETCH()
#endif

View File

@ -199,7 +199,7 @@ V8JS_METHOD(require)
// Get the extension context
v8::Handle<v8::External> data = v8::Handle<v8::External>::Cast(info.Data());
php_v8js_ctx *c = static_cast<php_v8js_ctx*>(data->Value());
v8js_ctx *c = static_cast<v8js_ctx*>(data->Value());
// Check that we have a module loader
if (c->module_loader == NULL) {
@ -389,7 +389,7 @@ V8JS_METHOD(require)
efree(normalised_module_id);
}
void php_v8js_register_methods(v8::Handle<v8::ObjectTemplate> global, php_v8js_ctx *c) /* {{{ */
void php_v8js_register_methods(v8::Handle<v8::ObjectTemplate> global, v8js_ctx *c) /* {{{ */
{
v8::Isolate *isolate = c->isolate;
global->Set(V8JS_SYM("exit"), v8::FunctionTemplate::New(isolate, V8JS_MN(exit)), v8::ReadOnly);

View File

@ -41,7 +41,7 @@ static void php_v8js_call_php_func(zval *value, zend_class_entry *ce, zend_funct
char *error;
int error_len, i, flags = V8JS_FLAG_NONE;
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
/* Set parameter limits */
min_num_args = method_ptr->common.required_num_args;
@ -200,7 +200,7 @@ static void php_v8js_construct_callback(const v8::FunctionCallbackInfo<v8::Value
v8::Local<v8::External> ext_tmpl = v8::Local<v8::External>::Cast(cons_data->Get(0));
v8::Local<v8::External> ext_ce = v8::Local<v8::External>::Cast(cons_data->Get(1));
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
if (info[0]->IsExternal()) {
// Object created by v8js in php_v8js_hash_to_jsobj, PHP object passed as v8::External.
@ -262,7 +262,7 @@ static void php_v8js_weak_object_callback(const v8::WeakCallbackData<v8::Object,
zval *value = data.GetParameter();
zval_ptr_dtor(&value);
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
ctx->weak_objects.at(value).Reset();
ctx->weak_objects.erase(value);
@ -277,7 +277,7 @@ static void php_v8js_weak_closure_callback(const v8::WeakCallbackData<v8::Object
persist_tpl_->Reset();
delete persist_tpl_;
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
ctx->weak_closures.at(persist_tpl_).Reset();
ctx->weak_closures.erase(persist_tpl_);
@ -410,7 +410,7 @@ static void php_v8js_invoke_callback(const v8::FunctionCallbackInfo<v8::Value>&
}
if (info.IsConstructCall()) {
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
v8::String::Utf8Value str(self->GetConstructorName()->ToString());
const char *constructor_name = ToCString(str);
@ -769,7 +769,7 @@ static void php_v8js_named_property_deleter(v8::Local<v8::String> property, cons
static v8::Handle<v8::Object> php_v8js_wrap_object(v8::Isolate *isolate, zend_class_entry *ce, zval *value TSRMLS_DC) /* {{{ */
{
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
v8::Local<v8::FunctionTemplate> new_tpl;
v8js_tmpl_t *persist_tpl_;

View File

@ -44,10 +44,10 @@ static void v8js_timer_interrupt_handler(v8::Isolate *isolate, void *data) { /*
V8JSG(timer_mutex).lock();
for (std::deque< php_v8js_timer_ctx* >::iterator it = V8JSG(timer_stack).begin();
for (std::deque< v8js_timer_ctx* >::iterator it = V8JSG(timer_stack).begin();
it != V8JSG(timer_stack).end(); it ++) {
php_v8js_timer_ctx *timer_ctx = *it;
php_v8js_ctx *c = timer_ctx->v8js_ctx;
v8js_timer_ctx *timer_ctx = *it;
v8js_ctx *c = timer_ctx->ctx;
if(c->isolate != isolate || timer_ctx->killed) {
continue;
@ -70,8 +70,8 @@ void v8js_timer_thread(TSRMLS_D) /* {{{ */
V8JSG(timer_mutex).lock();
if (V8JSG(timer_stack).size()) {
php_v8js_timer_ctx *timer_ctx = V8JSG(timer_stack).front();
php_v8js_ctx *c = timer_ctx->v8js_ctx;
v8js_timer_ctx *timer_ctx = V8JSG(timer_stack).front();
v8js_ctx *c = timer_ctx->ctx;
std::chrono::time_point<std::chrono::high_resolution_clock> now = std::chrono::high_resolution_clock::now();
if(timer_ctx->killed) {
@ -110,12 +110,12 @@ void v8js_timer_thread(TSRMLS_D) /* {{{ */
/* }}} */
void v8js_timer_push(long time_limit, long memory_limit, php_v8js_ctx *c TSRMLS_DC) /* {{{ */
void v8js_timer_push(long time_limit, long memory_limit, v8js_ctx *c TSRMLS_DC) /* {{{ */
{
V8JSG(timer_mutex).lock();
// Create context for this timer
php_v8js_timer_ctx *timer_ctx = (php_v8js_timer_ctx *)emalloc(sizeof(php_v8js_timer_ctx));
v8js_timer_ctx *timer_ctx = (v8js_timer_ctx *)emalloc(sizeof(v8js_timer_ctx));
// Calculate the time point when the time limit is exceeded
std::chrono::milliseconds duration(time_limit);
@ -125,7 +125,7 @@ void v8js_timer_push(long time_limit, long memory_limit, php_v8js_ctx *c TSRMLS_
timer_ctx->time_limit = time_limit;
timer_ctx->memory_limit = memory_limit;
timer_ctx->time_point = from + duration;
timer_ctx->v8js_ctx = c;
timer_ctx->ctx = c;
timer_ctx->killed = false;
V8JSG(timer_stack).push_front(timer_ctx);

View File

@ -15,17 +15,17 @@
#define V8JS_TIMER_H
// Timer context
struct php_v8js_timer_ctx
struct v8js_timer_ctx
{
long time_limit;
long memory_limit;
std::chrono::time_point<std::chrono::high_resolution_clock> time_point;
php_v8js_ctx *v8js_ctx;
v8js_ctx *ctx;
bool killed;
};
void v8js_timer_thread(TSRMLS_D);
void v8js_timer_push(long time_limit, long memory_limit, php_v8js_ctx *c TSRMLS_DC);
void v8js_timer_push(long time_limit, long memory_limit, v8js_ctx *c TSRMLS_DC);
#endif /* V8JS_TIMER_H */

View File

@ -59,7 +59,7 @@ void v8js_v8_init(TSRMLS_D) /* {{{ */
/* }}} */
void v8js_v8_call(php_v8js_ctx *c, zval **return_value,
void v8js_v8_call(v8js_ctx *c, zval **return_value,
long flags, long time_limit, long memory_limit,
std::function< v8::Local<v8::Value>(v8::Isolate *) >& v8_call TSRMLS_DC) /* {{{ */
{
@ -124,7 +124,7 @@ void v8js_v8_call(php_v8js_ctx *c, zval **return_value,
/* Pop our context from the stack and read (possibly updated) limits
* into local variables. */
V8JSG(timer_mutex).lock();
php_v8js_timer_ctx *timer_ctx = V8JSG(timer_stack).front();
v8js_timer_ctx *timer_ctx = V8JSG(timer_stack).front();
V8JSG(timer_stack).pop_front();
V8JSG(timer_mutex).unlock();
@ -198,7 +198,7 @@ void v8js_v8_call(php_v8js_ctx *c, zval **return_value,
}
/* }}} */
void v8js_terminate_execution(php_v8js_ctx *c TSRMLS_DC) /* {{{ */
void v8js_terminate_execution(v8js_ctx *c TSRMLS_DC) /* {{{ */
{
// Forcefully terminate the current thread of V8 execution in the isolate
v8::V8::TerminateExecution(c->isolate);

View File

@ -42,10 +42,10 @@ static inline const char * ToCString(const v8::String::Utf8Value &value) /* {{{
void v8js_v8_init(TSRMLS_D);
void v8js_v8_call(php_v8js_ctx *c, zval **return_value,
void v8js_v8_call(v8js_ctx *c, zval **return_value,
long flags, long time_limit, long memory_limit,
std::function< v8::Local<v8::Value>(v8::Isolate *) >& v8_call TSRMLS_DC);
void v8js_terminate_execution(php_v8js_ctx *c TSRMLS_DC);
void v8js_terminate_execution(v8js_ctx *c TSRMLS_DC);
/* Fetch V8 object properties */
int v8js_get_properties_hash(v8::Handle<v8::Value> jsValue, HashTable *retval, int flags, v8::Isolate *isolate TSRMLS_DC);
@ -64,8 +64,8 @@ int v8js_get_properties_hash(v8::Handle<v8::Value> jsValue, HashTable *retval, i
v8::Context::Scope context_scope(v8_context);
#define V8JS_BEGIN_CTX(ctx, object) \
php_v8js_ctx *(ctx); \
(ctx) = (php_v8js_ctx *) zend_object_store_get_object(object TSRMLS_CC); \
v8js_ctx *(ctx); \
(ctx) = (v8js_ctx *) zend_object_store_get_object(object TSRMLS_CC); \
V8JS_CTX_PROLOGUE(ctx);

View File

@ -511,7 +511,7 @@ PHP_METHOD(V8Function, __wakeup)
void php_v8js_create_v8(zval *res, v8::Handle<v8::Value> value, int flags, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
{
php_v8js_ctx *ctx = (php_v8js_ctx *) isolate->GetData(0);
v8js_ctx *ctx = (v8js_ctx *) isolate->GetData(0);
v8js_v8object *c;
object_init_ex(res, value->IsFunction() ? php_ce_v8function : php_ce_v8object);

View File

@ -19,7 +19,7 @@ struct v8js_v8object {
zend_object std;
v8::Persistent<v8::Value> v8obj;
int flags;
struct php_v8js_ctx *ctx;
struct v8js_ctx *ctx;
HashTable *properties;
};
/* }}} */

View File

@ -28,7 +28,7 @@ extern "C" {
static void php_v8js_fetch_php_variable(v8::Local<v8::String> name, const v8::PropertyCallbackInfo<v8::Value>& info) /* {{{ */
{
v8::Handle<v8::External> data = v8::Handle<v8::External>::Cast(info.Data());
php_v8js_accessor_ctx *ctx = static_cast<php_v8js_accessor_ctx *>(data->Value());
v8js_accessor_ctx *ctx = static_cast<v8js_accessor_ctx *>(data->Value());
v8::Isolate *isolate = ctx->isolate;
zval **variable;
@ -43,14 +43,14 @@ static void php_v8js_fetch_php_variable(v8::Local<v8::String> name, const v8::Pr
}
/* }}} */
void php_v8js_accessor_ctx_dtor(php_v8js_accessor_ctx *ctx TSRMLS_DC) /* {{{ */
void v8js_accessor_ctx_dtor(v8js_accessor_ctx *ctx TSRMLS_DC) /* {{{ */
{
efree(ctx->variable_name_string);
efree(ctx);
}
/* }}} */
void php_v8js_register_accessors(std::vector<php_v8js_accessor_ctx*> *accessor_list, v8::Local<v8::FunctionTemplate> php_obj_t, zval *array, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
void php_v8js_register_accessors(std::vector<v8js_accessor_ctx*> *accessor_list, v8::Local<v8::FunctionTemplate> php_obj_t, zval *array, v8::Isolate *isolate TSRMLS_DC) /* {{{ */
{
char *property_name;
uint property_name_len;
@ -80,7 +80,7 @@ void php_v8js_register_accessors(std::vector<php_v8js_accessor_ctx*> *accessor_l
}
// Create context to store accessor data
php_v8js_accessor_ctx *ctx = (php_v8js_accessor_ctx *)emalloc(sizeof(php_v8js_accessor_ctx));
v8js_accessor_ctx *ctx = (v8js_accessor_ctx *)emalloc(sizeof(v8js_accessor_ctx));
ctx->variable_name_string = estrdup(Z_STRVAL_PP(item));
ctx->variable_name_string_len = Z_STRLEN_PP(item);
ctx->isolate = isolate;