From 19a39a6755786ce0ceacc1a746b7b489c0cff056 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A9=AC=E6=A0=B9=E5=A0=82?= Date: Tue, 18 Apr 2023 13:23:33 +0000 Subject: [PATCH] remoteobject mem free MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: 马根堂 --- ipc/native/src/core/source/ipc_object_proxy.cpp | 1 - ipc/native/src/napi_common/source/napi_remote_object.cpp | 7 ------- .../src/napi_common/source/napi_remote_object_holder.cpp | 3 --- 3 files changed, 11 deletions(-) diff --git a/ipc/native/src/core/source/ipc_object_proxy.cpp b/ipc/native/src/core/source/ipc_object_proxy.cpp index 10b2d4a..502ae35 100644 --- a/ipc/native/src/core/source/ipc_object_proxy.cpp +++ b/ipc/native/src/core/source/ipc_object_proxy.cpp @@ -55,7 +55,6 @@ static constexpr HiviewDFX::HiLogLabel LABEL = { LOG_CORE, LOG_ID_IPC, "IPCObjec IPCObjectProxy::IPCObjectProxy(int handle, std::u16string descriptor, int proto) : IRemoteObject(std::move(descriptor)), handle_(handle), proto_(proto), isFinishInit_(false), isRemoteDead_(false) { - ZLOGD(LABEL, "[mem_free]IPCObjectProxy create"); ExtendObjectLifetime(); } diff --git a/ipc/native/src/napi_common/source/napi_remote_object.cpp b/ipc/native/src/napi_common/source/napi_remote_object.cpp index 013957f..38206e7 100644 --- a/ipc/native/src/napi_common/source/napi_remote_object.cpp +++ b/ipc/native/src/napi_common/source/napi_remote_object.cpp @@ -53,7 +53,6 @@ inline T *ConvertNativeValueTo(NativeValue *value) static void RemoteObjectHolderFinalizeCb(napi_env env, void *data, void *hint) { - ZLOGI(LOG_LABEL, "[mem_free]RemoteObjectHolderFinalizeCb inter"); NAPIRemoteObjectHolder *holder = reinterpret_cast(data); if (holder == nullptr) { ZLOGW(LOG_LABEL, "RemoteObjectHolderFinalizeCb null holder"); @@ -62,14 +61,12 @@ static void RemoteObjectHolderFinalizeCb(napi_env env, void *data, void *hint) holder->Lock(); int32_t curAttachCount = holder->DecAttachCount(); if (curAttachCount == 0) { - ZLOGI(LOG_LABEL, "[mem_free]RemoteObjectHolderFinalizeCb release holder"); delete holder; } } static void *RemoteObjectDetachCb(NativeEngine *engine, void *value, void *hint) { - ZLOGI(LOG_LABEL, "[mem_free]RemoteObjectDetachCb inter"); (void)engine; (void)hint; return value; @@ -77,7 +74,6 @@ static void *RemoteObjectDetachCb(NativeEngine *engine, void *value, void *hint) static NativeValue *RemoteObjectAttachCb(NativeEngine *engine, void *value, void *hint) { - ZLOGI(LOG_LABEL, "[mem_free]RemoteObjectAttachCb inter"); (void)hint; NAPIRemoteObjectHolder *holder = reinterpret_cast(value); if (holder == nullptr) { @@ -119,7 +115,6 @@ static NativeValue *RemoteObjectAttachCb(NativeEngine *engine, void *value, void napi_value RemoteObject_JS_Constructor(napi_env env, napi_callback_info info) { - ZLOGI(LOG_LABEL, "[mem_free]RemoteObject_JS_Constructor inter"); // new napi remote object size_t argc = 2; size_t expectedArgc = 1; @@ -160,7 +155,6 @@ napi_value RemoteObject_JS_Constructor(napi_env env, napi_callback_info info) NAPIRemoteObject::NAPIRemoteObject(napi_env env, napi_value thisVar, const std::u16string &descriptor) : IPCObjectStub(descriptor) { - ZLOGI(LOG_LABEL, "[mem_free]NAPIRemoteObject create"); env_ = env; thisVar_ = thisVar; napi_create_reference(env, thisVar_, 1, &thisVarRef_); @@ -169,7 +163,6 @@ NAPIRemoteObject::NAPIRemoteObject(napi_env env, napi_value thisVar, const std:: NAPIRemoteObject::~NAPIRemoteObject() { - ZLOGI(LOG_LABEL, "[mem_free]NAPIRemoteObject Destructor"); if (thisVarRef_ != nullptr) { napi_status status = napi_delete_reference(env_, thisVarRef_); NAPI_ASSERT_RETURN_VOID(env_, status == napi_ok, "failed to delete ref to js RemoteObject"); diff --git a/ipc/native/src/napi_common/source/napi_remote_object_holder.cpp b/ipc/native/src/napi_common/source/napi_remote_object_holder.cpp index d94f234..c2b00be 100644 --- a/ipc/native/src/napi_common/source/napi_remote_object_holder.cpp +++ b/ipc/native/src/napi_common/source/napi_remote_object_holder.cpp @@ -25,12 +25,10 @@ static constexpr OHOS::HiviewDFX::HiLogLabel LOG_LABEL = { LOG_CORE, LOG_ID_IPC, NAPIRemoteObjectHolder::NAPIRemoteObjectHolder(napi_env env, const std::u16string &descriptor) : env_(env), descriptor_(descriptor), cachedObject_(nullptr), localInterfaceRef_(nullptr), attachCount_(1) { - ZLOGI(LOG_LABEL, "[mem_free]NAPIRemoteObjectHolder create"); } NAPIRemoteObjectHolder::~NAPIRemoteObjectHolder() { - ZLOGI(LOG_LABEL, "[mem_free]NAPIRemoteObjectHolder free"); // free the reference of object. cachedObject_ = nullptr; if (localInterfaceRef_ != nullptr) { @@ -40,7 +38,6 @@ NAPIRemoteObjectHolder::~NAPIRemoteObjectHolder() sptr NAPIRemoteObjectHolder::Get(napi_value jsRemoteObject) { - ZLOGI(LOG_LABEL, "[mem_free]NAPIRemoteObjectHolder Get"); std::lock_guard lockGuard(mutex_); // grab an strong reference to the object, // so it will not be freed util this reference released. -- GitLab