From f8ba878bf6823f0e36ae9121698752514e8775a9 Mon Sep 17 00:00:00 2001 From: byndyx Date: Tue, 12 Nov 2024 20:22:58 +0800 Subject: [PATCH] modify define Signed-off-by: byndyx --- av_transport/common/include/softbus_channel_adapter.h | 7 +++++-- av_transport/common/src/softbus_channel_adapter.cpp | 9 ++++++--- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/av_transport/common/include/softbus_channel_adapter.h b/av_transport/common/include/softbus_channel_adapter.h index 16ebc0ea..7e0393e8 100644 --- a/av_transport/common/include/softbus_channel_adapter.h +++ b/av_transport/common/include/softbus_channel_adapter.h @@ -23,7 +23,6 @@ #include "transport/socket.h" #include "transport/trans_type.h" #include "av_trans_types.h" -#include "single_instance.h" #include "softbus_bus_center.h" #include "softbus_common.h" #include "av_trans_constants.h" @@ -38,8 +37,8 @@ public: }; class SoftbusChannelAdapter { - DECLARE_SINGLE_INSTANCE_BASE(SoftbusChannelAdapter); public: + static SoftbusChannelAdapter& GetInstance(); int32_t CreateChannelServer(const std::string &pkgName, const std::string &sessName); int32_t RemoveChannelServer(const std::string &pkgName, const std::string &sessName); @@ -71,6 +70,10 @@ public: const StreamFrameInfo *frameInfo); private: + SoftbusChannelAdapter(const SoftbusChannelAdapter&) = delete; + SoftbusChannelAdapter& operator= (const SoftbusChannelAdapter&) = delete; + SoftbusChannelAdapter(SoftbusChannelAdapter&&) = delete; + SoftbusChannelAdapter& operator= (SoftbusChannelAdapter&&) = delete; SoftbusChannelAdapter(); ~SoftbusChannelAdapter(); diff --git a/av_transport/common/src/softbus_channel_adapter.cpp b/av_transport/common/src/softbus_channel_adapter.cpp index 5948281d..a7f9ca56 100644 --- a/av_transport/common/src/softbus_channel_adapter.cpp +++ b/av_transport/common/src/softbus_channel_adapter.cpp @@ -28,9 +28,6 @@ namespace OHOS { namespace DistributedHardware { #undef DH_LOG_TAG #define DH_LOG_TAG "SoftbusChannelAdapter" - -IMPLEMENT_SINGLE_INSTANCE(SoftbusChannelAdapter); - namespace { const static std::pair LOCAL_TO_PEER_SESSION_NAME_MAP[] = { {OWNER_NAME_D_MIC + "_" + SENDER_CONTROL_SESSION_NAME_SUFFIX, @@ -108,6 +105,12 @@ static void onDevTimeSyncResult(const TimeSyncResultInfo *info, int32_t result) SoftbusChannelAdapter::GetInstance().OnSoftbusTimeSyncResult(info, result); } +SoftbusChannelAdapter& SoftbusChannelAdapter::GetInstance() +{ + static SoftbusChannelAdapter instance; + return instance; +} + SoftbusChannelAdapter::SoftbusChannelAdapter() { sessListener_.OnBind = OnSessionOpened;