From b9dae71cce126bddfdc10b9a3a33487803861edb Mon Sep 17 00:00:00 2001 From: pandamicro Date: Tue, 29 Aug 2017 17:41:02 +0800 Subject: [PATCH] Complete jsb proxy tracking log infos --- .../cocos/scripting/js-bindings/manual/ScriptingCore.cpp | 4 ++++ .../scripting/js-bindings/manual/cocos2d_specifics.hpp | 9 ++++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index a25423ad44..3ffcd9e767 100644 --- a/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/native/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -2256,6 +2256,10 @@ void jsb_ref_autoreleased_init(JSContext* cx, JS::HandleObject obj, Ref* ref, co // rebind void jsb_ref_rebind(JSContext* cx, JS::HandleObject jsobj, js_proxy_t *proxy, cocos2d::Ref* oldRef, cocos2d::Ref* newRef, const char* debug) { +#if COCOS2D_DEBUG > 1 + CCLOG("------REBOUND------ Cpp(%s): %p - JS: %p", debug, oldRef, jsobj.get()); + CCLOG("++++++REBOUND++++++ Cpp(%s): %p - JS: %p", debug, newRef, jsobj.get()); +#endif // COCOS2D_DEBUG #if CC_ENABLE_GC_FOR_NATIVE_OBJECTS // Release the old reference as it have been retained by jsobj previously, // and the jsobj won't have any chance to release it in the future diff --git a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp index a410d90428..6391e9b467 100644 --- a/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp +++ b/native/cocos/scripting/js-bindings/manual/cocos2d_specifics.hpp @@ -76,11 +76,11 @@ namespace jsb } ~Object() { -#if COCOS2D_DEBUG > 1 - CCLOG("Release JSBObject %p, with proxy: %p", this, _proxy); -#endif // COCOS2D_DEBUG if (_proxy) { +#if COCOS2D_DEBUG > 1 + CCLOG("Release JSBObject %p, with proxy: %p", this, _proxy); +#endif // COCOS2D_DEBUG jsb_remove_proxy(_proxy); } } @@ -88,6 +88,9 @@ namespace jsb { if (_proxy) { +#if COCOS2D_DEBUG > 1 + CCLOG("Release JSBObject %p, with proxy: %p", this, _proxy); +#endif // COCOS2D_DEBUG jsb_remove_proxy(_proxy); } JS::RootedValue val(cx, JS::ObjectOrNullValue(jsobj));