generate v8-3.19.x compatible code
This commit is contained in:
parent
26a4f84948
commit
9111773400
3 changed files with 16 additions and 19 deletions
|
|
@ -111,15 +111,14 @@ fail:
|
|||
* ----------------------------------------------------------------------------- */
|
||||
%fragment ("js_dtor", "templates")
|
||||
%{
|
||||
void $jswrapper(v8::Persistent< v8::Value > object, void *parameter) {
|
||||
SWIGV8_Proxy* proxy = (SWIGV8_Proxy*) parameter;
|
||||
void $jswrapper(v8::Isolate *iso, v8::Persistent< v8::Object > * object, SWIGV8_Proxy *proxy) {
|
||||
if(proxy->swigCMemOwn && proxy->swigCObject) {
|
||||
$jsfree proxy->swigCObject;
|
||||
}
|
||||
delete proxy;
|
||||
|
||||
object.Clear();
|
||||
object.Dispose();
|
||||
object->Dispose();
|
||||
object->Clear();
|
||||
}
|
||||
%}
|
||||
|
||||
|
|
@ -395,7 +394,7 @@ void $jsname_initialize(v8::Handle<v8::Object> global_obj)
|
|||
v8::HandleScope scope;
|
||||
|
||||
// a class template for creating proxies of undefined types
|
||||
SWIGV8_SWIGTYPE_Proxy_class_templ = SWIGV8_CreateClassTemplate("SwigProxy");
|
||||
SWIGV8_SWIGTYPE_Proxy_class_templ.Reset(v8::Isolate::GetCurrent(), SWIGV8_CreateClassTemplate("SwigProxy"));
|
||||
|
||||
/* create objects for namespaces */
|
||||
$jsv8nspaces
|
||||
|
|
|
|||
|
|
@ -3,14 +3,14 @@
|
|||
/**
|
||||
* Creates a class template for a class with specified initialization function.
|
||||
*/
|
||||
v8::Persistent<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
|
||||
v8::Handle<v8::FunctionTemplate> SWIGV8_CreateClassTemplate(const char* symbol) {
|
||||
v8::Local<v8::FunctionTemplate> class_templ = v8::FunctionTemplate::New();
|
||||
class_templ->SetClassName(v8::String::NewSymbol(symbol));
|
||||
|
||||
v8::Handle<v8::ObjectTemplate> inst_templ = class_templ->InstanceTemplate();
|
||||
inst_templ->SetInternalFieldCount(1);
|
||||
|
||||
return v8::Persistent<v8::FunctionTemplate>::New(class_templ);
|
||||
return class_templ;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -72,7 +72,7 @@ public:
|
|||
|
||||
~SWIGV8_Proxy() {
|
||||
handle.ClearWeak();
|
||||
handle->SetInternalField(0, v8::Undefined());
|
||||
//handle->SetInternalField(0, v8::Undefined());
|
||||
handle.Dispose();
|
||||
handle.Clear();
|
||||
v8::V8::AdjustAmountOfExternalAllocatedMemory(-SWIGV8_AVG_OBJ_SIZE);
|
||||
|
|
@ -87,7 +87,7 @@ public:
|
|||
class SWIGV8_ClientData {
|
||||
public:
|
||||
v8::Handle<v8::FunctionTemplate> class_templ;
|
||||
void (*dtor) (v8::Persistent< v8::Value > object, void *parameter);
|
||||
void (*dtor) (v8::Isolate *iso, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *parameter);
|
||||
};
|
||||
|
||||
v8::Persistent<v8::FunctionTemplate> SWIGV8_SWIGTYPE_Proxy_class_templ;
|
||||
|
|
@ -97,7 +97,7 @@ int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void** ptr, swig_t
|
|||
|
||||
if(objRef->InternalFieldCount() < 1) return SWIG_ERROR;
|
||||
v8::Handle<v8::Value> cdataRef = objRef->GetInternalField(0);
|
||||
SWIGV8_Proxy *cdata = (SWIGV8_Proxy *) v8::External::Unwrap(cdataRef);
|
||||
SWIGV8_Proxy *cdata = (SWIGV8_Proxy *) (!cdataRef.IsEmpty() && cdataRef->IsExternal()? cdataRef.As<v8::External>()->Value(): NULL);
|
||||
if(cdata == NULL) {
|
||||
return SWIG_ERROR;
|
||||
}
|
||||
|
|
@ -122,11 +122,8 @@ int SWIG_V8_ConvertInstancePtr(v8::Handle<v8::Object> objRef, void** ptr, swig_t
|
|||
return SWIG_OK;
|
||||
}
|
||||
|
||||
void SWIGV8_Proxy_DefaultDtor(v8::Persistent< v8::Value > object, void *parameter) {
|
||||
SWIGV8_Proxy* proxy = (SWIGV8_Proxy*) parameter;
|
||||
if(proxy) {
|
||||
delete proxy;
|
||||
}
|
||||
void SWIGV8_Proxy_DefaultDtor(v8::Isolate* isolate, v8::Persistent< v8::Object > *object, SWIGV8_Proxy *proxy) {
|
||||
delete proxy;
|
||||
}
|
||||
|
||||
void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void* ptr, swig_type_info *info, int flags) {
|
||||
|
|
@ -134,9 +131,9 @@ void SWIGV8_SetPrivateData(v8::Handle<v8::Object> obj, void* ptr, swig_type_info
|
|||
cdata->swigCObject = ptr;
|
||||
cdata->swigCMemOwn = (flags & SWIG_POINTER_OWN) ? 1 : 0;
|
||||
cdata->info = info;
|
||||
obj->SetPointerInInternalField(0, cdata);
|
||||
obj->SetAlignedPointerInInternalField(0, cdata);
|
||||
|
||||
cdata->handle = v8::Persistent<v8::Object>::New(obj);
|
||||
cdata->handle.Reset(v8::Isolate::GetCurrent(), obj);
|
||||
|
||||
// clientdata must be set for owned data as we need to register the dtor
|
||||
if(cdata->swigCMemOwn) {
|
||||
|
|
@ -159,12 +156,13 @@ int SWIG_V8_ConvertPtr(v8::Handle<v8::Value> valRef, void** ptr, swig_type_info
|
|||
|
||||
v8::Handle<v8::Object> SWIG_V8_NewPointerObj(void *ptr, swig_type_info *info, int flags) {
|
||||
v8::HandleScope scope;
|
||||
v8::Isolate *iso = v8::Isolate::GetCurrent();
|
||||
|
||||
v8::Handle<v8::FunctionTemplate> class_templ;
|
||||
if(info->clientdata != 0) {
|
||||
class_templ = ((SWIGV8_ClientData*) info->clientdata)->class_templ;
|
||||
class_templ = v8::Handle<v8::FunctionTemplate>::New(iso, ((SWIGV8_ClientData*) info->clientdata)->class_templ);
|
||||
} else {
|
||||
class_templ = SWIGV8_SWIGTYPE_Proxy_class_templ;
|
||||
class_templ = v8::Handle<v8::FunctionTemplate>::New(iso, SWIGV8_SWIGTYPE_Proxy_class_templ);
|
||||
}
|
||||
v8::Handle<v8::Object> result = class_templ->InstanceTemplate()->NewInstance();
|
||||
SWIGV8_SetPrivateData(result, ptr, info, flags);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue