mirror of https://github.com/axmolengine/axmol.git
Expose CC_ENABLE_GC_FOR_NATIVE_OBJECTS
This commit is contained in:
parent
34c7331b99
commit
8d712a4c45
|
@ -329,6 +329,16 @@ THE SOFTWARE.
|
|||
#define CC_ENABLE_SCRIPT_BINDING 1
|
||||
#endif
|
||||
|
||||
/** @def CC_NATIVE_CONTROL_SCRIPT
|
||||
* Indicate whether use script GC to control native object life cycle to get ride of retain/release usage
|
||||
* False by default.
|
||||
*/
|
||||
#if CC_ENABLE_SCRIPT_BINDING
|
||||
#ifndef CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 1
|
||||
#endif
|
||||
#endif
|
||||
|
||||
/** @def CC_CONSTRUCTOR_ACCESS
|
||||
* Indicate the init functions access modifier. If value equals to protected, then these functions are protected.
|
||||
* If value equals to public, these functions are public,
|
||||
|
|
|
@ -76,10 +76,6 @@
|
|||
|
||||
#define BYTE_CODE_FILE_EXT ".jsc"
|
||||
|
||||
// EXPERIMENTAL: Enable this in order to get rid of retain/release
|
||||
// when using the Garbage Collector
|
||||
#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 0
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
#if COCOS2D_DEBUG
|
||||
|
|
|
@ -343,11 +343,12 @@ JS_BINDED_CONSTRUCTOR_IMPL(MinXmlHttpRequest)
|
|||
js_proxy_t *p = jsb_new_proxy(req, obj);
|
||||
|
||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||
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, ref, obj.get());
|
||||
CCLOG("++++++RETAINED++++++ %d Cpp(XMLHttpRequest): %p - JS: %p", ScriptingCore::retainCount, req, obj.get());
|
||||
#endif // COCOS2D_DEBUG
|
||||
#else
|
||||
// autorelease it
|
||||
|
|
Loading…
Reference in New Issue