diff --git a/frameworks/ims/input_event_client_proxy.h b/frameworks/ims/input_event_client_proxy.h index b2d86f41bc164048c88897db7c88d7462d0ffedf..610280c1cbecb8a7e35b41e6d95c0075c3e7ac3d 100755 --- a/frameworks/ims/input_event_client_proxy.h +++ b/frameworks/ims/input_event_client_proxy.h @@ -28,11 +28,7 @@ namespace OHOS { #define MAX_CLIENT_SIZE 1 class InputEventClientProxy : public InputEventDistributer::RawEventListener { public: - static InputEventClientProxy* GetInstance() - { - static InputEventClientProxy ims; - return &ims; - } + static InputEventClientProxy* GetInstance(); static void ClientRequestHandle(int funcId, void* origin, IpcIo* req, IpcIo* reply); diff --git a/frameworks/ims/input_event_listener_proxy.cpp b/frameworks/ims/input_event_listener_proxy.cpp index 7d396502a55cdb9dcfaa887a50f2277f73259cf7..6807dc50ff4bfc2b322993bf54d7e643abb18e79 100755 --- a/frameworks/ims/input_event_listener_proxy.cpp +++ b/frameworks/ims/input_event_listener_proxy.cpp @@ -27,6 +27,12 @@ InputEventListenerProxy::~InputEventListenerProxy() } } +InputEventListenerProxy* InputEventListenerProxy::GetInstance() +{ + static InputEventListenerProxy client; + return &client; +} + bool InputEventListenerProxy::GetIClientProxy() { if (proxy_ == nullptr) { diff --git a/frameworks/wms/lite_wm_requestor.cpp b/frameworks/wms/lite_wm_requestor.cpp index 66560e198cc5dfd1d99e4b2915be9aab46b6b39a..a652c41eb37bae03f576e6d138b27ee25573298d 100755 --- a/frameworks/wms/lite_wm_requestor.cpp +++ b/frameworks/wms/lite_wm_requestor.cpp @@ -21,6 +21,12 @@ #include "surface_impl.h" namespace OHOS { +LiteWMRequestor* LiteWMRequestor::GetInstance() +{ + static LiteWMRequestor requestor; + return &requestor; +} + LiteWMRequestor::LiteWMRequestor() : proxy_(nullptr), listener_(nullptr), surface_(nullptr), sid_({}), layerInfo_({}) { proxy_ = LiteWMSClient::GetInstance()->GetClientProxy(); diff --git a/frameworks/wms/lite_wm_requestor.h b/frameworks/wms/lite_wm_requestor.h index 4f88e8ca546888d8cd8cd638400807c036418dee..043a9731b41c03df86782e16739b39d939548c92 100755 --- a/frameworks/wms/lite_wm_requestor.h +++ b/frameworks/wms/lite_wm_requestor.h @@ -26,12 +26,7 @@ namespace OHOS { class LiteWMRequestor : public IBufferConsumerListener { public: - static LiteWMRequestor* GetInstance() - { - static LiteWMRequestor requestor; - return &requestor; - } - + static LiteWMRequestor* GetInstance(); static int Callback(void* owner, int code, IpcIo* reply); static int32_t WmsMsgHandler(const IpcContext* context, void* ipcMsg, IpcIo* io, void* arg); static int32_t SurfaceRequestHandler(const IpcContext* context, void* ipcMsg, IpcIo* io, void* arg); diff --git a/frameworks/wms/lite_wms_client.cpp b/frameworks/wms/lite_wms_client.cpp index 05498d688b215f00acb98ca1503fee3b20482fa7..044897851900da85b1cc73d8ff1ae3fe8b6b5ec8 100755 --- a/frameworks/wms/lite_wms_client.cpp +++ b/frameworks/wms/lite_wms_client.cpp @@ -19,6 +19,12 @@ #include "samgr_lite.h" namespace OHOS { +LiteWMSClient* LiteWMSClient::GetInstance() +{ + static LiteWMSClient client; + return &client; +} + LiteWMSClient::~LiteWMSClient() { if (proxy_ != nullptr) { diff --git a/frameworks/wms/lite_wms_client.h b/frameworks/wms/lite_wms_client.h index 11e214d2dd6801df87743c967b655b1f2a15b024..7db07fabc5b93d3e6f1df5edb595ad0cdaec3651 100755 --- a/frameworks/wms/lite_wms_client.h +++ b/frameworks/wms/lite_wms_client.h @@ -26,11 +26,7 @@ static const int32_t DEFAULT_IPC_SIZE = 100; class LiteWMSClient { public: - static LiteWMSClient* GetInstance() - { - static LiteWMSClient client; - return &client; - } + static LiteWMSClient* GetInstance(); bool InitLiteWMSClient(); diff --git a/interfaces/innerkits/input_event_listener_proxy.h b/interfaces/innerkits/input_event_listener_proxy.h index 66e5eb486e72ee2ffe33c6f536b4ae2a67218a33..eb35669e13cc56ef9142e13a68380332af4e2eca 100755 --- a/interfaces/innerkits/input_event_listener_proxy.h +++ b/interfaces/innerkits/input_event_listener_proxy.h @@ -23,11 +23,7 @@ namespace OHOS { class InputEventListenerProxy { public: - static InputEventListenerProxy* GetInstance() - { - static InputEventListenerProxy client; - return &client; - } + static InputEventListenerProxy* GetInstance(); class RawEventListener { public: diff --git a/services/ims/input_event_client_proxy.cpp b/services/ims/input_event_client_proxy.cpp index 81f9b639373768b3142fd4f6d06e2e3ae1c1a081..ce3a5bf82780fc9160c74c870d9757bc435ad9f6 100755 --- a/services/ims/input_event_client_proxy.cpp +++ b/services/ims/input_event_client_proxy.cpp @@ -19,6 +19,12 @@ namespace OHOS { pthread_mutex_t InputEventClientProxy::lock_; +InputEventClientProxy* InputEventClientProxy::GetInstance() +{ + static InputEventClientProxy ims; + return &ims; +} + void InputEventClientProxy::ClientRequestHandle(int funcId, void* origin, IpcIo* req, IpcIo* reply) { switch (funcId) { diff --git a/services/ims/input_event_hub.cpp b/services/ims/input_event_hub.cpp index 9b61747695e963539aeb76b174e97c89a63d4435..f96a03c244d0c1bb341abd7faf777e38a2e49fe1 100755 --- a/services/ims/input_event_hub.cpp +++ b/services/ims/input_event_hub.cpp @@ -26,6 +26,12 @@ IInputInterface* InputEventHub::inputInterface_ = nullptr; InputReportEventCb InputEventHub::callback_ = { 0 }; InputEventHub::ReadCallback InputEventHub::readCallback_ = nullptr; +InputEventHub* InputEventHub::GetInstance() +{ + static InputEventHub instance; + return &instance; +} + InputEventHub::InputEventHub() { for (uint8_t i = 0; i < MAX_INPUT_DEVICE_NUM; i++) { diff --git a/services/ims/input_event_hub.h b/services/ims/input_event_hub.h index f9c5312caedb695fb212e45103330ae6ccf7d522..e6d612a656c41427c1bc29871680d2d51bb294ca 100755 --- a/services/ims/input_event_hub.h +++ b/services/ims/input_event_hub.h @@ -29,11 +29,7 @@ namespace OHOS { class InputEventHub { using ReadCallback = void (*)(const RawEvent*); public: - static InputEventHub* GetInstance() - { - static InputEventHub instance; - return &instance; - } + static InputEventHub* GetInstance(); /** * @brief SetUp hub. This operation will open all input devices. diff --git a/services/ims/input_manager_service.cpp b/services/ims/input_manager_service.cpp index f6e4e33b7b062efadb309a978945634f174f7564..7d647a31e8ba57b6e7085b0f57ba4269e03f87c8 100755 --- a/services/ims/input_manager_service.cpp +++ b/services/ims/input_manager_service.cpp @@ -27,6 +27,12 @@ pthread_mutex_t InputManagerService::lock_; pthread_cond_t InputManagerService::nonEmpty_; pthread_cond_t InputManagerService::nonFull_; +InputManagerService* InputManagerService::GetInstance() +{ + static InputManagerService instance; + return &instance; +} + void InputManagerService::Run() { hub_ = InputEventHub::GetInstance(); diff --git a/services/ims/input_manager_service.h b/services/ims/input_manager_service.h index a0d380ca706765ce3b3cf2489964a15593360f19..812439c8ea8184aea6ffdeb8ed02c2636ca1c670 100755 --- a/services/ims/input_manager_service.h +++ b/services/ims/input_manager_service.h @@ -30,11 +30,7 @@ public: * * @returns instance of input manager service */ - static InputManagerService* GetInstance() - { - static InputManagerService instance; - return &instance; - } + static InputManagerService* GetInstance(); /** * Init input manager service. diff --git a/services/wms/lite_wm.cpp b/services/wms/lite_wm.cpp index 977f5b39be738507dfd68747569f53ee2ddcaf26..bafc3d58c5b34a43110d65df038ce472066f1f37 100755 --- a/services/wms/lite_wm.cpp +++ b/services/wms/lite_wm.cpp @@ -124,6 +124,12 @@ LiteWM::~LiteWM() { } +LiteWM* LiteWM::GetInstance() +{ + static LiteWM liteWm; + return &liteWm; +} + void LiteWM::MainTaskHandler() { if (layerData_ == nullptr || layerData_->virAddr == nullptr) { diff --git a/services/wms/lite_wm.h b/services/wms/lite_wm.h index a666c8ba46b6f187bc948ed3e9f0f1cb517a5992..1fc8639843b2633a675fd879ec26c84373857cef 100755 --- a/services/wms/lite_wm.h +++ b/services/wms/lite_wm.h @@ -44,11 +44,7 @@ struct CursorInfo { class LiteWM : public InputEventDistributer::RawEventListener { public: - static LiteWM* GetInstance() - { - static LiteWM liteWm; - return &liteWm; - } + static LiteWM* GetInstance(); void MainTaskHandler(); diff --git a/services/wms/lite_wms.cpp b/services/wms/lite_wms.cpp index 0feac13e44d7d689a36fccc4a97cd87c2ce78981..47fd9b790d1770846416b404ad01955bf2bb3af7 100755 --- a/services/wms/lite_wms.cpp +++ b/services/wms/lite_wms.cpp @@ -21,6 +21,12 @@ #include "surface_impl.h" namespace OHOS { +LiteWMS* LiteWMS::GetInstance() +{ + static LiteWMS wms; + return &wms; +} + void LiteWMS::WMSRequestHandle(int funcId, void* origin, IpcIo* req, IpcIo* reply) { switch (funcId) { diff --git a/services/wms/lite_wms.h b/services/wms/lite_wms.h index 52a4882e201663aabe03ed244a8403738113805c..2bf84d095f4e751426952fd67c3968157582f717 100755 --- a/services/wms/lite_wms.h +++ b/services/wms/lite_wms.h @@ -29,11 +29,7 @@ public: SvcIdentity sid; }; - static LiteWMS* GetInstance() - { - static LiteWMS wms; - return &wms; - } + static LiteWMS* GetInstance(); static void WMSRequestHandle(int funcId, void* origin, IpcIo* req, IpcIo* reply);