mirror of https://github.com/axmolengine/axmol.git
parent
e987f13d56
commit
3eb7d62e6e
|
@ -216,7 +216,7 @@ void removeJSObject(JSContext* cx, cocos2d::Ref* nativeObj)
|
||||||
auto proxy = jsb_get_native_proxy(nativeObj);
|
auto proxy = jsb_get_native_proxy(nativeObj);
|
||||||
if (proxy)
|
if (proxy)
|
||||||
{
|
{
|
||||||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
JS::RemoveObjectRoot(cx, &proxy->obj);
|
JS::RemoveObjectRoot(cx, &proxy->obj);
|
||||||
#endif
|
#endif
|
||||||
// remove the proxy here, since this was a "stack" object, not heap
|
// remove the proxy here, since this was a "stack" object, not heap
|
||||||
|
@ -2192,7 +2192,7 @@ JSObject* jsb_create_weak_jsobject(JSContext *cx, void *native, js_type_class_t
|
||||||
JS::RootedObject jsObj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
|
JS::RootedObject jsObj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
|
||||||
auto proxy = jsb_new_proxy(native, jsObj);
|
auto proxy = jsb_new_proxy(native, jsObj);
|
||||||
|
|
||||||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
JS::AddNamedObjectRoot(cx, &proxy->obj, debug);
|
JS::AddNamedObjectRoot(cx, &proxy->obj, debug);
|
||||||
#else
|
#else
|
||||||
#if COCOS2D_DEBUG > 1
|
#if COCOS2D_DEBUG > 1
|
||||||
|
@ -2262,7 +2262,7 @@ JSObject* jsb_get_or_create_weak_jsobject(JSContext *cx, void *native, js_type_c
|
||||||
JS::RootedObject jsObj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
|
JS::RootedObject jsObj(cx, JS_NewObject(cx, typeClass->jsclass, proto, parent));
|
||||||
proxy = jsb_new_proxy(native, jsObj);
|
proxy = jsb_new_proxy(native, jsObj);
|
||||||
|
|
||||||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
JS::AddNamedObjectRoot(cx, &proxy->obj, debug);
|
JS::AddNamedObjectRoot(cx, &proxy->obj, debug);
|
||||||
#else
|
#else
|
||||||
#if COCOS2D_DEBUG > 1
|
#if COCOS2D_DEBUG > 1
|
||||||
|
|
|
@ -2215,7 +2215,7 @@ bool js_forceGC(JSContext *cx, uint32_t argc, jsval *vp) {
|
||||||
bool js_cocos2dx_retain(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_retain(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||||
cocos2d::Ref* cobj = (cocos2d::Ref *)(proxy ? proxy->ptr : NULL);
|
cocos2d::Ref* cobj = (cocos2d::Ref *)(proxy ? proxy->ptr : NULL);
|
||||||
|
@ -2230,7 +2230,7 @@ bool js_cocos2dx_retain(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
bool js_cocos2dx_release(JSContext *cx, uint32_t argc, jsval *vp)
|
bool js_cocos2dx_release(JSContext *cx, uint32_t argc, jsval *vp)
|
||||||
{
|
{
|
||||||
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
JS::CallArgs args = JS::CallArgsFromVp(argc, vp);
|
||||||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if ! CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
JS::RootedObject obj(cx, args.thisv().toObjectOrNull());
|
||||||
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
js_proxy_t *proxy = jsb_get_js_proxy(obj);
|
||||||
cocos2d::Ref* cobj = (cocos2d::Ref *)(proxy ? proxy->ptr : NULL);
|
cocos2d::Ref* cobj = (cocos2d::Ref *)(proxy ? proxy->ptr : NULL);
|
||||||
|
|
Loading…
Reference in New Issue