From b92b67edadcae7b4de44d18c62dc6d407d6787b6 Mon Sep 17 00:00:00 2001 From: Ricardo Quesada Date: Tue, 29 Dec 2015 14:26:41 -0800 Subject: [PATCH] moves macro definition to `ccConfig.h` --- cocos/base/CCRef.cpp | 4 ---- cocos/base/ccConfig.h | 11 +++++++++++ cocos/scripting/js-bindings/manual/ScriptingCore.cpp | 4 ---- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cocos/base/CCRef.cpp b/cocos/base/CCRef.cpp index eed860e602..40821905e7 100644 --- a/cocos/base/CCRef.cpp +++ b/cocos/base/CCRef.cpp @@ -34,10 +34,6 @@ THE SOFTWARE. NS_CC_BEGIN -// EXPERIMENTAL: Enable this in order to get rid of retain/release -// when using the Garbage Collector -#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 0 - #if CC_REF_LEAK_DETECTION static void trackRef(Ref* ref); static void untrackRef(Ref* ref); diff --git a/cocos/base/ccConfig.h b/cocos/base/ccConfig.h index 56ad72fb48..573c13a19e 100644 --- a/cocos/base/ccConfig.h +++ b/cocos/base/ccConfig.h @@ -329,6 +329,17 @@ THE SOFTWARE. #define CC_ENABLE_SCRIPT_BINDING 1 #endif +/** When CC_ENABLE_SCRIPT_BINDING and CC_ENABLE_GC_FOR_NATIVE_OBJECTS are both 1 + then the Garbage collector will will release the native objects, only when the JS/Lua objets + are collected. + The benefit is that users don't need to retain/release the JS/Lua objects manually. + + By default this behavior is disabled by default + */ +#ifndef CC_ENABLE_GC_FOR_NATIVE_OBJECTS +#define CC_ENABLE_GC_FOR_NATIVE_OBJECTS 0 +#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, diff --git a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp index 86ca3f4ad5..6318e02c63 100644 --- a/cocos/scripting/js-bindings/manual/ScriptingCore.cpp +++ b/cocos/scripting/js-bindings/manual/ScriptingCore.cpp @@ -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; static std::string inData;