From 496d025e2069a8c0a399982a1043edc5b50e3597 Mon Sep 17 00:00:00 2001 From: James Chen Date: Wed, 30 Aug 2017 14:17:11 +0800 Subject: [PATCH 1/2] Removes unused code in jsb_creator_manual.cpp. --- .../cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp index eca3767859..3e6daff4a7 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp @@ -34,8 +34,7 @@ static bool js_creator_PhysicsContactListener_setPreSolve(se::State& s) CC_UNUSED bool ok = true; se::ValueArray args; args.resize(1); - bool fromCache = false; - ok &= native_ptr_to_rooted_seval(larg0, __jsb_b2Contact_class, &args[0], &fromCache); + ok &= native_ptr_to_rooted_seval(larg0, __jsb_b2Contact_class, &args[0]); se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; From df013030414d337a7ee19ea7da535398df21d49b Mon Sep 17 00:00:00 2001 From: James Chen Date: Thu, 31 Aug 2017 10:33:17 +0800 Subject: [PATCH 2/2] attachChild -> attachObject, detachChild -> detachObject, isSame -> strictEquals --- .../js-bindings/auto/jsb_cocos2dx_auto.cpp | 28 +++++++++---------- .../auto/jsb_cocos2dx_dragonbones_auto.cpp | 4 +-- .../jsb_cocos2dx_experimental_video_auto.cpp | 2 +- ...jsb_cocos2dx_experimental_webView_auto.cpp | 8 +++--- .../auto/jsb_cocos2dx_extension_auto.cpp | 8 +++--- .../auto/jsb_cocos2dx_network_auto.cpp | 6 ++-- .../auto/jsb_cocos2dx_spine_auto.cpp | 12 ++++---- .../js-bindings/auto/jsb_cocos2dx_ui_auto.cpp | 26 ++++++++--------- .../jswrapper/chakracore/Class.cpp | 8 ------ .../jswrapper/chakracore/Object.cpp | 14 +++++----- .../jswrapper/chakracore/Object.hpp | 6 ++-- .../jswrapper/chakracore/ScriptEngine.cpp | 4 +-- .../js-bindings/jswrapper/jsc/Object.cpp | 14 +++++----- .../js-bindings/jswrapper/jsc/Object.hpp | 21 +++++++------- .../jswrapper/jsc/ScriptEngine.cpp | 4 +-- .../js-bindings/jswrapper/sm/Object.cpp | 14 +++++----- .../js-bindings/jswrapper/sm/Object.hpp | 6 ++-- .../js-bindings/jswrapper/sm/ScriptEngine.cpp | 4 +-- .../js-bindings/jswrapper/v8/Object.cpp | 14 +++++----- .../js-bindings/jswrapper/v8/Object.hpp | 6 ++-- .../js-bindings/jswrapper/v8/ScriptEngine.cpp | 4 +-- .../manual/jsb_cocos2dx_manual.cpp | 10 +++---- .../js-bindings/manual/jsb_creator_manual.cpp | 10 +++---- .../manual/jsb_dragonbones_manual.cpp | 6 ++-- .../scripting/js-bindings/manual/jsb_node.cpp | 10 +++---- .../js-bindings/manual/jsb_socketio.cpp | 2 +- native/tools/bindings-generator | 2 +- 27 files changed, 123 insertions(+), 130 deletions(-) diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp index 94bbb5e9da..475ef1259b 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp @@ -2396,7 +2396,7 @@ static bool js_cocos2dx_Node_setAfterVisitCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Renderer* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -3555,7 +3555,7 @@ static bool js_cocos2dx_Node_setBeforeVisitCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Renderer* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -4238,7 +4238,7 @@ static bool js_cocos2dx_Node_enumerateChildren(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Node* larg0) -> bool { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -9114,7 +9114,7 @@ static bool js_cocos2dx_EventListenerAcceleration_init(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Acceleration* larg0, cocos2d::Event* larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -10791,7 +10791,7 @@ static bool js_cocos2dx_GLProgramState_setUniformCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::GLProgram* larg0, cocos2d::Uniform* larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -10834,7 +10834,7 @@ static bool js_cocos2dx_GLProgramState_setUniformCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::GLProgram* larg0, cocos2d::Uniform* larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -11002,7 +11002,7 @@ static bool js_cocos2dx_GLProgramState_setVertexAttribCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::VertexAttrib* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -23507,7 +23507,7 @@ static bool js_cocos2dx_MenuItem_initWithCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -23608,7 +23608,7 @@ static bool js_cocos2dx_MenuItem_setCallback(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -23829,7 +23829,7 @@ static bool js_cocos2dx_MenuItemLabel_initWithLabel(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -23988,7 +23988,7 @@ static bool js_cocos2dx_MenuItemAtlasFont_initWithString(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[5]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -24152,7 +24152,7 @@ static bool js_cocos2dx_MenuItemFont_initWithString(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -24428,7 +24428,7 @@ static bool js_cocos2dx_MenuItemSprite_initWithNormalSprite(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[3]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -24712,7 +24712,7 @@ static bool js_cocos2dx_MenuItemImage_initWithNormalImage(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[3]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp index b29e43778e..4d48614ffa 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_dragonbones_auto.cpp @@ -4400,7 +4400,7 @@ static bool js_cocos2dx_dragonbones_CCArmatureDisplay_setEventCallback(se::State { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](dragonBones::EventObject* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -4465,7 +4465,7 @@ static bool js_cocos2dx_dragonbones_CCArmatureDisplay_addEvent(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](dragonBones::EventObject* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp index 6e3a4f1c78..bd6e125202 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_video_auto.cpp @@ -235,7 +235,7 @@ static bool js_cocos2dx_experimental_video_VideoPlayer_addEventListener(se::Stat { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::experimental::ui::VideoPlayer::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.cpp index 8187e8ad39..a544e6821d 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_experimental_webView_auto.cpp @@ -20,7 +20,7 @@ static bool js_cocos2dx_experimental_webView_WebView_setOnShouldStartLoading(se: { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::experimental::ui::WebView* larg0, const std::basic_string & larg1) -> bool { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -73,7 +73,7 @@ static bool js_cocos2dx_experimental_webView_WebView_setOnDidFailLoading(se::Sta { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::experimental::ui::WebView* larg0, const std::basic_string & larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -311,7 +311,7 @@ static bool js_cocos2dx_experimental_webView_WebView_setOnJSCallback(se::State& { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::experimental::ui::WebView* larg0, const std::basic_string & larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -488,7 +488,7 @@ static bool js_cocos2dx_experimental_webView_WebView_setOnDidFinishLoading(se::S { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::experimental::ui::WebView* larg0, const std::basic_string & larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp index cfdfd9fbfb..8f966f1b3b 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp @@ -753,7 +753,7 @@ static bool js_cocos2dx_extension_AssetsManagerEx_setVerifyCallback(se::State& s { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const std::basic_string & larg0, cocos2d::extension::ManifestAsset larg1) -> bool { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -839,7 +839,7 @@ static bool js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle(se::St { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const std::basic_string & larg0, const std::basic_string & larg1) -> int { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1082,7 +1082,7 @@ static bool js_cocos2dx_extension_AssetsManagerEx_constructor(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[2]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const std::basic_string & larg0, const std::basic_string & larg1) -> int { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1205,7 +1205,7 @@ static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_init(se::State& s { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[1]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::extension::EventAssetsManagerEx* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp index e4fd500384..aeb127a347 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp @@ -19,7 +19,7 @@ static bool js_cocos2dx_network_Downloader_setOnTaskError(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const cocos2d::network::DownloadTask & larg0, int larg1, int larg2, const std::basic_string & larg3) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -70,7 +70,7 @@ static bool js_cocos2dx_network_Downloader_setOnTaskProgress(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const cocos2d::network::DownloadTask & larg0, long long larg1, long long larg2, long long larg3) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -157,7 +157,7 @@ static bool js_cocos2dx_network_Downloader_setOnFileTaskSuccess(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const cocos2d::network::DownloadTask & larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp index e6feebb9f4..44ce54c160 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_spine_auto.cpp @@ -882,7 +882,7 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setDisposeListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](spTrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -950,7 +950,7 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setEndListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](spTrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1016,7 +1016,7 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setCompleteListener(se::State& s { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](spTrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1091,7 +1091,7 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](spTrackEntry* larg0, spEvent* larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1163,7 +1163,7 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setInterruptListener(se::State& { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](spTrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1266,7 +1266,7 @@ static bool js_cocos2dx_spine_SkeletonAnimation_setStartListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](spTrackEntry* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp index af3268b856..6a61a02a1a 100644 --- a/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp +++ b/native/cocos/scripting/js-bindings/auto/jsb_cocos2dx_ui_auto.cpp @@ -752,7 +752,7 @@ static bool js_cocos2dx_ui_Widget_addCCSEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, int larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1481,7 +1481,7 @@ static bool js_cocos2dx_ui_Widget_addTouchEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::Widget::TouchEventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -1589,7 +1589,7 @@ static bool js_cocos2dx_ui_Widget_addClickEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -4205,7 +4205,7 @@ static bool js_cocos2dx_ui_CheckBox_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::CheckBox::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -4409,7 +4409,7 @@ static bool js_cocos2dx_ui_RadioButton_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::ui::RadioButton* larg0, cocos2d::ui::RadioButton::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -4719,7 +4719,7 @@ static bool js_cocos2dx_ui_RadioButtonGroup_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::ui::RadioButton* larg0, int larg1, cocos2d::ui::RadioButtonGroup::EventType larg2) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -6932,7 +6932,7 @@ static bool js_cocos2dx_ui_ScrollView_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::ScrollView::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -7937,7 +7937,7 @@ static bool js_cocos2dx_ui_ListView_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::ListView::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -8712,7 +8712,7 @@ static bool js_cocos2dx_ui_Slider_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::Slider::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -10003,7 +10003,7 @@ static bool js_cocos2dx_ui_TextField_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::TextField::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -11084,7 +11084,7 @@ static bool js_cocos2dx_ui_PageView_addEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](cocos2d::Ref* larg0, cocos2d::ui::PageView::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -13189,7 +13189,7 @@ static bool js_cocos2dx_ui_RichText_initWithXML(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[2]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](const std::basic_string & larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -17594,7 +17594,7 @@ static bool js_cocos2dx_ui_TabControl_setTabChangedEventListener(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](int larg0, cocos2d::ui::TabControl::EventType larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/jswrapper/chakracore/Class.cpp b/native/cocos/scripting/js-bindings/jswrapper/chakracore/Class.cpp index f8743626ae..e9e9d68c25 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/chakracore/Class.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/chakracore/Class.cpp @@ -78,14 +78,6 @@ namespace se { bool Class::install() { -// auto iter = __clsMap.find(_name); -// if (iter != __clsMap.end()) -// { -// assert(!iter->second->_parent->isSame(_parent)); -// } -// -// __clsMap.emplace(_name, this); - JsValueRef funcName; _CHECK(JsCreateString(_name.c_str(), _name.length(), &funcName)); JsValueRef jsConstructor; diff --git a/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.cpp b/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.cpp index 084ea07ece..981945c051 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.cpp @@ -590,16 +590,16 @@ namespace se { return _rootCount > 0; } - bool Object::isSame(Object* o) const + bool Object::strictEquals(Object* o) const { bool same = false; _CHECK(JsStrictEquals(_obj, o->_obj, &same)); return same; } - bool Object::attachChild(Object* child) + bool Object::attachObject(Object* obj) { - assert(child); + assert(obj); Object* global = ScriptEngine::getInstance()->getGlobalObject(); Value jsbVal; @@ -614,14 +614,14 @@ namespace se { ValueArray args; args.push_back(Value(this)); - args.push_back(Value(child)); + args.push_back(Value(obj)); func.toObject()->call(args, global); return true; } - bool Object::detachChild(Object* child) + bool Object::detachObject(Object* obj) { - assert(child); + assert(obj); Object* global = ScriptEngine::getInstance()->getGlobalObject(); Value jsbVal; if (!global->getProperty("jsb", &jsbVal)) @@ -635,7 +635,7 @@ namespace se { ValueArray args; args.push_back(Value(this)); - args.push_back(Value(child)); + args.push_back(Value(obj)); func.toObject()->call(args, global); return true; } diff --git a/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.hpp b/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.hpp index d49da94926..1e283d3fb6 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.hpp +++ b/native/cocos/scripting/js-bindings/jswrapper/chakracore/Object.hpp @@ -53,9 +53,9 @@ namespace se { void unroot(); bool isRooted() const; - bool isSame(Object* o) const; - bool attachChild(Object* child); - bool detachChild(Object* child); + bool strictEquals(Object* obj) const; + bool attachObject(Object* obj); + bool detachObject(Object* obj); // Private API used in wrapper static Object* _createJSObject(Class* cls, JsValueRef obj); diff --git a/native/cocos/scripting/js-bindings/jswrapper/chakracore/ScriptEngine.cpp b/native/cocos/scripting/js-bindings/jswrapper/chakracore/ScriptEngine.cpp index c0a6065606..71e1274e2c 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/chakracore/ScriptEngine.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/chakracore/ScriptEngine.cpp @@ -383,7 +383,7 @@ namespace se { } clearException(); - iterOwner->second->attachChild(iterTarget->second); + iterOwner->second->attachObject(iterTarget->second); } void ScriptEngine::_releaseScriptObject(void* owner, void* target) @@ -401,7 +401,7 @@ namespace se { } clearException(); - iterOwner->second->detachChild(iterTarget->second); + iterOwner->second->detachObject(iterTarget->second); } bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type) diff --git a/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.cpp b/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.cpp index 0dec4dcce1..08d232583f 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.cpp @@ -572,14 +572,14 @@ namespace se { return _rootCount > 0; } - bool Object::isSame(Object* o) const + bool Object::strictEquals(Object* o) const { return JSValueIsStrictEqual(__cx, _obj, o->_obj); } - bool Object::attachChild(Object* child) + bool Object::attachObject(Object* obj) { - assert(child); + assert(obj); Object* global = ScriptEngine::getInstance()->getGlobalObject(); Value jsbVal; @@ -594,14 +594,14 @@ namespace se { ValueArray args; args.push_back(Value(this)); - args.push_back(Value(child)); + args.push_back(Value(obj)); func.toObject()->call(args, global); return true; } - bool Object::detachChild(Object* child) + bool Object::detachObject(Object* obj) { - assert(child); + assert(obj); Object* global = ScriptEngine::getInstance()->getGlobalObject(); Value jsbVal; if (!global->getProperty("jsb", &jsbVal)) @@ -615,7 +615,7 @@ namespace se { ValueArray args; args.push_back(Value(this)); - args.push_back(Value(child)); + args.push_back(Value(obj)); func.toObject()->call(args, global); return true; } diff --git a/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.hpp b/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.hpp index e32c1486ad..d5312bb498 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.hpp +++ b/native/cocos/scripting/js-bindings/jswrapper/jsc/Object.hpp @@ -227,14 +227,14 @@ namespace se { * @param[in] o The object to be tested with this object. * @return true if the two values are strict equal, otherwise false. */ - bool isSame(Object* o) const; + bool strictEquals(Object* o) const; /** - * @brief Attaches a child object to an object. - * @param[in] child The child object to be attached. + * @brief Attaches an object to current object. + * @param[in] obj The object to be attached. * @return true if succeed, otherwise false. - * @note This method will set child object as a property of this object, therefore the lifecycle of child object will depend on this object, - * which means child may be garbage collected only after this object is garbage collected. + * @note This method will set `obj` as a property of current object, therefore the lifecycle of child object will depend on current object, + * which means `obj` may be garbage collected only after current object is garbage collected. * It's normally used in binding a native callback method. For example: ```javascript @@ -256,7 +256,7 @@ namespace se { se::Value jsThis(args[1]); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=]() -> void { ... @@ -279,14 +279,15 @@ namespace se { } ``` */ - bool attachChild(Object* child); + bool attachObject(Object* obj); /** - * @brief Detaches a child object from an object. - * @param[in] child The child object ot be detached. + * @brief Detaches an object from current object. + * @param[in] obj The object to be detached. * @return true if succeed, otherwise false. + * @note The attached object will not be released if current object is not garbage collected. */ - bool detachChild(Object* child); + bool detachObject(Object* obj); // Private API used in wrapper static Object* _createJSObject(Class* cls, JSObjectRef obj); diff --git a/native/cocos/scripting/js-bindings/jswrapper/jsc/ScriptEngine.cpp b/native/cocos/scripting/js-bindings/jswrapper/jsc/ScriptEngine.cpp index ef84ea5c7f..15ac07a163 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/jsc/ScriptEngine.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/jsc/ScriptEngine.cpp @@ -407,7 +407,7 @@ namespace se { } clearException(); - iterOwner->second->attachChild(iterTarget->second); + iterOwner->second->attachObject(iterTarget->second); } void ScriptEngine::_releaseScriptObject(void* owner, void* target) @@ -425,7 +425,7 @@ namespace se { } clearException(); - iterOwner->second->detachChild(iterTarget->second); + iterOwner->second->detachObject(iterTarget->second); } bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type) diff --git a/native/cocos/scripting/js-bindings/jswrapper/sm/Object.cpp b/native/cocos/scripting/js-bindings/jswrapper/sm/Object.cpp index 0237225ec1..0d480e2cee 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/sm/Object.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/sm/Object.cpp @@ -515,7 +515,7 @@ namespace se { return _rootCount > 0; } - bool Object::isSame(Object* o) const + bool Object::strictEquals(Object* o) const { JSObject* thisObj = _getJSObject(); JSObject* oThisObj = o->_getJSObject(); @@ -531,11 +531,11 @@ namespace se { return ok && same; } - bool Object::attachChild(Object* child) + bool Object::attachObject(Object* obj) { - assert(child); + assert(obj); JSObject* ownerObj = _getJSObject(); - JSObject* targetObj = child->_getJSObject(); + JSObject* targetObj = obj->_getJSObject(); if (ownerObj == nullptr || targetObj == nullptr) return false; @@ -556,11 +556,11 @@ namespace se { return JS_CallFunctionName(__cx, jsbObj, "registerNativeRef", args, &rval); } - bool Object::detachChild(Object* child) + bool Object::detachObject(Object* obj) { - assert(child); + assert(obj); JSObject* ownerObj = _getJSObject(); - JSObject* targetObj = child->_getJSObject(); + JSObject* targetObj = obj->_getJSObject(); if (ownerObj == nullptr || targetObj == nullptr) { LOGD("%s: try to detach on invalid object, owner: %p, target: %p\n", __FUNCTION__, ownerObj, targetObj); diff --git a/native/cocos/scripting/js-bindings/jswrapper/sm/Object.hpp b/native/cocos/scripting/js-bindings/jswrapper/sm/Object.hpp index b85a7861fd..82be6eb69c 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/sm/Object.hpp +++ b/native/cocos/scripting/js-bindings/jswrapper/sm/Object.hpp @@ -53,9 +53,9 @@ namespace se { void unroot(); bool isRooted() const; - bool isSame(Object* o) const; - bool attachChild(Object* child); - bool detachChild(Object* child); + bool strictEquals(Object* o) const; + bool attachObject(Object* obj); + bool detachObject(Object* obj); // Private API used in wrapper static Object* _createJSObject(Class* cls, JSObject* obj); diff --git a/native/cocos/scripting/js-bindings/jswrapper/sm/ScriptEngine.cpp b/native/cocos/scripting/js-bindings/jswrapper/sm/ScriptEngine.cpp index 34afde05ed..f0d4a49973 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/sm/ScriptEngine.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/sm/ScriptEngine.cpp @@ -671,7 +671,7 @@ namespace se { } clearException(); - iterOwner->second->attachChild(iterTarget->second); + iterOwner->second->attachObject(iterTarget->second); } void ScriptEngine::_releaseScriptObject(void* owner, void* target) @@ -689,7 +689,7 @@ namespace se { } clearException(); - iterOwner->second->detachChild(iterTarget->second); + iterOwner->second->detachObject(iterTarget->second); } bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type) diff --git a/native/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp b/native/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp index b5771551a9..6d06521eef 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/v8/Object.cpp @@ -642,15 +642,15 @@ namespace se { return _rootCount > 0; } - bool Object::isSame(Object *o) const + bool Object::strictEquals(Object *o) const { Object* a = const_cast(this); return a->_obj.handle(__isolate) == o->_obj.handle(__isolate); } - bool Object::attachChild(Object *child) + bool Object::attachObject(Object* obj) { - assert(child); + assert(obj); Object* global = ScriptEngine::getInstance()->getGlobalObject(); Value jsbVal; @@ -665,14 +665,14 @@ namespace se { ValueArray args; args.push_back(Value(this)); - args.push_back(Value(child)); + args.push_back(Value(obj)); func.toObject()->call(args, global); return true; } - bool Object::detachChild(Object *child) + bool Object::detachObject(Object* obj) { - assert(child); + assert(obj); Object* global = ScriptEngine::getInstance()->getGlobalObject(); Value jsbVal; @@ -687,7 +687,7 @@ namespace se { ValueArray args; args.push_back(Value(this)); - args.push_back(Value(child)); + args.push_back(Value(obj)); func.toObject()->call(args, global); return true; } diff --git a/native/cocos/scripting/js-bindings/jswrapper/v8/Object.hpp b/native/cocos/scripting/js-bindings/jswrapper/v8/Object.hpp index 26e611f58a..79b163d855 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/v8/Object.hpp +++ b/native/cocos/scripting/js-bindings/jswrapper/v8/Object.hpp @@ -60,9 +60,9 @@ namespace se { void unroot(); bool isRooted() const; - bool isSame(Object* o) const; - bool attachChild(Object* child); - bool detachChild(Object* child); + bool strictEquals(Object* o) const; + bool attachObject(Object* obj); + bool detachObject(Object* obj); // Private API used in wrapper static Object* _createJSObject(Class* cls, v8::Local obj); diff --git a/native/cocos/scripting/js-bindings/jswrapper/v8/ScriptEngine.cpp b/native/cocos/scripting/js-bindings/jswrapper/v8/ScriptEngine.cpp index c37353721a..903f1de94d 100644 --- a/native/cocos/scripting/js-bindings/jswrapper/v8/ScriptEngine.cpp +++ b/native/cocos/scripting/js-bindings/jswrapper/v8/ScriptEngine.cpp @@ -425,7 +425,7 @@ namespace se { clearException(); AutoHandleScope hs; - iterOwner->second->attachChild(iterTarget->second); + iterOwner->second->attachObject(iterTarget->second); } void ScriptEngine::_releaseScriptObject(void* owner, void* target) @@ -444,7 +444,7 @@ namespace se { clearException(); AutoHandleScope hs; - iterOwner->second->detachChild(iterTarget->second); + iterOwner->second->detachObject(iterTarget->second); } bool ScriptEngine::_onReceiveNodeEvent(void* node, NodeEventType type) diff --git a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp index 92912512bc..9ba63b71a0 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_cocos2dx_manual.cpp @@ -689,7 +689,7 @@ static bool js_EventListenerAcceleration_create(se::State& s) { se::Value jsThis(obj); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](Acceleration* acc, Event* event) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -824,7 +824,7 @@ static bool js_EventListenerCustom_create(se::State& s) obj->setPrivateData(ret); s.rval().setObject(obj); - obj->attachChild(funcVal.toObject()); + obj->attachObject(funcVal.toObject()); return true; } @@ -1290,7 +1290,7 @@ static bool js_cocos2dx_CallFunc_init(cocos2d::CallFuncN* nativeObj, se::Object* SE_PRECONDITION2(false, false, "js_cocos2dx_CallFunc_create, args[0](func) isn't a function object"); } - jsobj->attachChild(funcVal.toObject()); + jsobj->attachObject(funcVal.toObject()); if (argc >= 2) { @@ -1299,14 +1299,14 @@ static bool js_cocos2dx_CallFunc_init(cocos2d::CallFuncN* nativeObj, se::Object* { SE_PRECONDITION2(false, false, "js_cocos2dx_CallFunc_create, args[1](this) isn't an object"); } - jsobj->attachChild(thisVal.toObject()); + jsobj->attachObject(thisVal.toObject()); } if (argc >= 3) { dataVal = args[2]; if (dataVal.isObject()) - jsobj->attachChild(dataVal.toObject()); + jsobj->attachObject(dataVal.toObject()); } bool ok = nativeObj->initWithFunction([=](Node* sender){ diff --git a/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp index 3e6daff4a7..89cad56bdf 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_creator_manual.cpp @@ -26,7 +26,7 @@ static bool js_creator_PhysicsContactListener_setPreSolve(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](b2Contact* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -74,7 +74,7 @@ static bool js_creator_PhysicsContactListener_setPostSolve(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](b2Contact* larg0, const creator::PhysicsContactImpulse* larg1) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -88,7 +88,7 @@ static bool js_creator_PhysicsContactListener_setPostSolve(se::State& s) ok &= native_ptr_to_seval((creator::PhysicsContactImpulse*)larg1, __jsb_creator_PhysicsContactImpulse_class, &args[1], &fromCache); if (!fromCache) { - jsThis.toObject()->attachChild(args[1].toObject()); + jsThis.toObject()->attachObject(args[1].toObject()); } se::Value rval; se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr; @@ -129,7 +129,7 @@ static bool js_creator_PhysicsContactListener_setBeginContact(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](b2Contact* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; @@ -184,7 +184,7 @@ static bool js_creator_PhysicsContactListener_setEndContact(se::State& s) { se::Value jsThis(s.thisObject()); se::Value jsFunc(args[0]); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); auto lambda = [=](b2Contact* larg0) -> void { se::ScriptEngine::getInstance()->clearException(); se::AutoHandleScope hs; diff --git a/native/cocos/scripting/js-bindings/manual/jsb_dragonbones_manual.cpp b/native/cocos/scripting/js-bindings/manual/jsb_dragonbones_manual.cpp index 7c0d261970..b838a107f8 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_dragonbones_manual.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_dragonbones_manual.cpp @@ -288,7 +288,7 @@ static bool js_cocos2dx_dragonbones_TransformObject_getGlobal(se::State& s) SE_PRECONDITION2(ok, false, "Convert dragonBones::Transform to se::Value failed!"); if (!isReturnCached) { - s.thisObject()->attachChild(s.rval().toObject()); + s.thisObject()->attachObject(s.rval().toObject()); } return true; } @@ -302,7 +302,7 @@ static bool js_cocos2dx_dragonbones_TransformObject_getOrigin(se::State& s) SE_PRECONDITION2(ok, false, "Convert dragonBones::Transform to se::Value failed!"); if (!isReturnCached) { - s.thisObject()->attachChild(s.rval().toObject()); + s.thisObject()->attachObject(s.rval().toObject()); } return true; } @@ -316,7 +316,7 @@ static bool js_cocos2dx_dragonbones_TransformObject_getOffset(se::State& s) SE_PRECONDITION2(ok, false, "Convert dragonBones::Transform to se::Value failed!"); if (!isReturnCached) { - s.thisObject()->attachChild(s.rval().toObject()); + s.thisObject()->attachObject(s.rval().toObject()); } return true; } diff --git a/native/cocos/scripting/js-bindings/manual/jsb_node.cpp b/native/cocos/scripting/js-bindings/manual/jsb_node.cpp index f8b70c8ed8..f5c7aba72c 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_node.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_node.cpp @@ -249,7 +249,7 @@ static void removeSchedule(uint32_t jsFuncId, uint32_t jsTargetId, bool needDeta se::Object* func = iter->second.getFunc(); if (needDetachChild) { - target->detachChild(func); + target->detachObject(func); } func->release(); @@ -280,7 +280,7 @@ static void removeScheduleForThis(uint32_t jsTargetId, bool needDetachChild) func = e.second.getFunc(); if (needDetachChild) { - target->detachChild(func); + target->detachObject(func); } func->release(); // Release jsFunc @@ -309,8 +309,8 @@ static void removeAllSchedules(bool needDetachChild) func = e.second.getFunc(); if (needDetachChild) { - CCLOG("detachChild: owner: %p, target: %p", target, func); - target->detachChild(func); + CCLOG("detachObject: owner: %p, target: %p", target, func); + target->detachObject(func); } target->release(); // Release jsThis func->release(); // Release jsFunc @@ -447,7 +447,7 @@ static bool Scheduler_scheduleCommon(Scheduler* scheduler, const se::Value& jsTh assert(jsThis.isObject()); assert(jsFunc.isObject()); assert(jsFunc.toObject()->isFunction()); - jsThis.toObject()->attachChild(jsFunc.toObject()); + jsThis.toObject()->attachObject(jsFunc.toObject()); std::string key; diff --git a/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp b/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp index b9daeb2885..370b7bb4fd 100644 --- a/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp +++ b/native/cocos/scripting/js-bindings/manual/jsb_socketio.cpp @@ -103,7 +103,7 @@ public: _eventRegistry[eventName].clear(); _eventRegistry[eventName].push_back(callback); _eventRegistry[eventName].push_back(target); - target.toObject()->attachChild(callback.toObject()); + target.toObject()->attachObject(callback.toObject()); } private: diff --git a/native/tools/bindings-generator b/native/tools/bindings-generator index 76c3e5d20f..1865e320c1 160000 --- a/native/tools/bindings-generator +++ b/native/tools/bindings-generator @@ -1 +1 @@ -Subproject commit 76c3e5d20f78f913a50926355db89ce6bd58f0ae +Subproject commit 1865e320c17b8627d06a0c36c054dcdf055a6ab0