mirror of
https://github.com/phpv8/v8js.git
synced 2024-12-22 14:01:53 +00:00
use ObjectTemplate as base for global object
This commit is contained in:
parent
7a947fe9d1
commit
bd730068a2
@ -425,16 +425,14 @@ static PHP_METHOD(V8Js, __construct)
|
|||||||
/* Create global template for global object */
|
/* Create global template for global object */
|
||||||
// Now we are using multiple isolates this needs to be created for every context
|
// Now we are using multiple isolates this needs to be created for every context
|
||||||
|
|
||||||
v8::Local<v8::FunctionTemplate> tpl = v8::FunctionTemplate::New(c->isolate, 0);
|
v8::Local<v8::ObjectTemplate> tpl = v8::ObjectTemplate::New(c->isolate);
|
||||||
|
|
||||||
tpl->SetClassName(V8JS_SYM("V8Js"));
|
|
||||||
c->global_template.Reset(isolate, tpl);
|
c->global_template.Reset(isolate, tpl);
|
||||||
|
|
||||||
/* Register builtin methods */
|
/* Register builtin methods */
|
||||||
v8js_register_methods(tpl->InstanceTemplate(), c);
|
v8js_register_methods(tpl, c);
|
||||||
|
|
||||||
/* Create context */
|
/* Create context */
|
||||||
v8::Local<v8::Context> context = v8::Context::New(isolate, &extension_conf, tpl->InstanceTemplate());
|
v8::Local<v8::Context> context = v8::Context::New(isolate, &extension_conf, tpl);
|
||||||
|
|
||||||
if (exts) {
|
if (exts) {
|
||||||
v8js_free_ext_strarr(exts, exts_count);
|
v8js_free_ext_strarr(exts, exts_count);
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
|
|
||||||
/* Abbreviate long type names */
|
/* Abbreviate long type names */
|
||||||
typedef v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > v8js_function_tmpl_t;
|
typedef v8::Persistent<v8::FunctionTemplate, v8::CopyablePersistentTraits<v8::FunctionTemplate> > v8js_function_tmpl_t;
|
||||||
|
typedef v8::Persistent<v8::ObjectTemplate, v8::CopyablePersistentTraits<v8::ObjectTemplate> > v8js_object_tmpl_t;
|
||||||
typedef v8::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object> > v8js_persistent_obj_t;
|
typedef v8::Persistent<v8::Object, v8::CopyablePersistentTraits<v8::Object> > v8js_persistent_obj_t;
|
||||||
|
|
||||||
/* Forward declarations */
|
/* Forward declarations */
|
||||||
@ -48,7 +49,7 @@ struct v8js_ctx {
|
|||||||
bool memory_limit_hit;
|
bool memory_limit_hit;
|
||||||
long average_object_size;
|
long average_object_size;
|
||||||
|
|
||||||
v8js_function_tmpl_t global_template;
|
v8js_object_tmpl_t global_template;
|
||||||
v8js_function_tmpl_t array_tmpl;
|
v8js_function_tmpl_t array_tmpl;
|
||||||
|
|
||||||
zval module_normaliser;
|
zval module_normaliser;
|
||||||
|
Loading…
Reference in New Issue
Block a user