mirror of https://github.com/axmolengine/axmol.git
Merge pull request #15060 from pandamicro/v3
Cleanup log for New memory model
This commit is contained in:
commit
cb60561053
|
@ -1049,6 +1049,9 @@ void Director::restartDirector()
|
|||
|
||||
// release the objects
|
||||
PoolManager::getInstance()->getCurrentPool()->clear();
|
||||
|
||||
// Restart animation
|
||||
startAnimation();
|
||||
|
||||
// Real restart in script level
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
|
|
|
@ -78,10 +78,6 @@
|
|||
|
||||
using namespace cocos2d;
|
||||
|
||||
#if COCOS2D_DEBUG
|
||||
int ScriptingCore::retainCount = 0;
|
||||
#endif //COCOS2D_DEBUG
|
||||
|
||||
static std::string inData;
|
||||
static std::string outData;
|
||||
static std::vector<std::string> g_queue;
|
||||
|
@ -2199,9 +2195,9 @@ JSObject* jsb_create_weak_jsobject(JSContext *cx, void *native, js_type_class_t
|
|||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
JS::AddNamedObjectRoot(cx, &proxy->obj, debug);
|
||||
#else
|
||||
#if COCOS2D_DEBUG
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CC_UNUSED_PARAM(proxy);
|
||||
// CCLOG("++++++WEAK_REF++++++ Cpp(%s): %p - JS: %p", debug, native, jsObj.get());
|
||||
CCLOG("++++++WEAK_REF++++++ Cpp(%s): %p - JS: %p", debug, native, jsObj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
return jsObj;
|
||||
|
@ -2226,9 +2222,8 @@ JSObject* jsb_ref_get_or_create_jsobject(JSContext *cx, cocos2d::Ref *ref, js_ty
|
|||
CC_UNUSED_PARAM(newproxy);
|
||||
ref->retain();
|
||||
js_add_FinalizeHook(cx, jsObj);
|
||||
#if COCOS2D_DEBUG
|
||||
ScriptingCore::retainCount++;
|
||||
CCLOG("++++++RETAINED++++++ %d Cpp(%s): %p - JS: %p", ScriptingCore::retainCount, debug, ref, jsObj.get());
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("++++++RETAINED++++++ Cpp(%s): %p - JS: %p", debug, ref, jsObj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
#else
|
||||
// don't autorelease it
|
||||
|
@ -2270,8 +2265,8 @@ JSObject* jsb_get_or_create_weak_jsobject(JSContext *cx, void *native, js_type_c
|
|||
#if not CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
JS::AddNamedObjectRoot(cx, &proxy->obj, debug);
|
||||
#else
|
||||
#if COCOS2D_DEBUG
|
||||
// CCLOG("++++++WEAK_REF++++++ Cpp(%s): %p - JS: %p", debug, native, jsObj.get());
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("++++++WEAK_REF++++++ Cpp(%s): %p - JS: %p", debug, native, jsObj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
return jsObj;
|
||||
|
@ -2286,9 +2281,8 @@ void jsb_ref_init(JSContext* cx, JS::Heap<JSObject*> *obj, Ref* ref, const char*
|
|||
JS::RootedObject jsObj(cx, *obj);
|
||||
js_add_FinalizeHook(cx, jsObj);
|
||||
// don't retain it, already retained
|
||||
#if COCOS2D_DEBUG
|
||||
ScriptingCore::retainCount++;
|
||||
CCLOG("++++++RETAINED++++++ %d Cpp(%s): %p - JS: %p", ScriptingCore::retainCount, debug, ref, jsObj.get());
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("++++++RETAINED++++++ Cpp(%s): %p - JS: %p", debug, ref, jsObj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
#else
|
||||
// autorelease it
|
||||
|
|
|
@ -89,9 +89,6 @@ private:
|
|||
bool _callFromScript;
|
||||
ScriptingCore();
|
||||
public:
|
||||
#if COCOS2D_DEBUG
|
||||
static int retainCount;
|
||||
#endif // COCOS2D_DEBUG
|
||||
|
||||
~ScriptingCore();
|
||||
|
||||
|
|
|
@ -2526,7 +2526,9 @@ bool JSB_cpSpace_constructor(JSContext *cx, uint32_t argc, jsval *vp)
|
|||
|
||||
jsb_set_jsobject_for_proxy(jsobj, ret_val);
|
||||
jsb_set_c_proxy_for_jsobject(jsobj, ret_val, JSB_C_FLAG_CALL_FREE);
|
||||
CCLOG("++++++RETAINED++++++ %d Cpp(%s): %p - JS: %p", ScriptingCore::retainCount, "cp.Space", ret_val, jsobj.get());
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("++++++RETAINED++++++ Cpp(%s): %p - JS: %p", "cp.Space", ret_val, jsobj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
args.rval().set(OBJECT_TO_JSVAL(jsobj));
|
||||
|
||||
return true;
|
||||
|
|
|
@ -825,7 +825,9 @@ void JSB_cpSpace_finalize(JSFreeOp *fop, JSObject *jsthis)
|
|||
if(proxy->flags == JSB_C_FLAG_CALL_FREE)
|
||||
cpSpaceFree(space);
|
||||
jsb_del_c_proxy_for_jsobject(jsthis);
|
||||
CCLOG("------RELEASED------ %d Cpp(cp.Space): %p - JS: %p", ScriptingCore::retainCount, space, jsthis);
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("------RELEASED------ Cpp(cp.Space): %p - JS: %p", space, jsthis);
|
||||
#endif // COCOS2D_DEBUG
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -5900,18 +5900,17 @@ void jsb_FinalizeHook_finalize(JSFreeOp *fop, JSObject *obj)
|
|||
{
|
||||
CC_SAFE_RELEASE(refObj);
|
||||
}
|
||||
#if COCOS2D_DEBUG
|
||||
ScriptingCore::retainCount--;
|
||||
CCLOG("------RELEASED------ %d Cpp: %p - JS: %p", ScriptingCore::retainCount, refObj, ownerPtr);
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("------RELEASED------ Cpp: %p - JS: %p", refObj, ownerPtr);
|
||||
#endif // COCOS2D_DEBUG
|
||||
}
|
||||
#if COCOS2D_DEBUG
|
||||
#if COCOS2D_DEBUG > 1
|
||||
else {
|
||||
CCLOG("A non ref object have registered finalize hook: %p", nproxy->ptr);
|
||||
}
|
||||
#endif // COCOS2D_DEBUG
|
||||
}
|
||||
#if COCOS2D_DEBUG
|
||||
#if COCOS2D_DEBUG > 1
|
||||
else {
|
||||
CCLOG("jsbindings: Failed to remove proxy for js object: %p, it may cause memory leak and future crash", ownerPtr);
|
||||
}
|
||||
|
|
|
@ -401,9 +401,8 @@ JS_BINDED_CONSTRUCTOR_IMPL(MinXmlHttpRequest)
|
|||
CC_UNUSED_PARAM(p);
|
||||
js_add_FinalizeHook(cx, obj);
|
||||
// don't retain it, already retained
|
||||
#if COCOS2D_DEBUG
|
||||
ScriptingCore::retainCount++;
|
||||
CCLOG("++++++RETAINED++++++ %d Cpp(XMLHttpRequest): %p - JS: %p", ScriptingCore::retainCount, req, obj.get());
|
||||
#if COCOS2D_DEBUG > 1
|
||||
CCLOG("++++++RETAINED++++++ Cpp(XMLHttpRequest): %p - JS: %p", req, obj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
#else
|
||||
// autorelease it
|
||||
|
|
Loading…
Reference in New Issue