From 594e0eb39f73c40f6342f975c291fd9da965f1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=8F=B6=E6=B1=9F=E6=B5=A9?= <5715935+yejianghao1995@user.noreply.gitee.com> Date: Thu, 6 Mar 2025 14:44:34 +0800 Subject: [PATCH] layout delete Issue: https://gitee.com/openharmony/arkcompiler_toolchain/issues/IBLLOB Change-Id: Ica74e19296a877bda1fcdb9a237896cc288a2b4b Signed-off-by: yejianghao --- inspector/connect_inspector.cpp | 25 +------------------------ inspector/connect_inspector.h | 4 +--- inspector/test/connect_server_test.cpp | 13 +------------ 3 files changed, 3 insertions(+), 39 deletions(-) diff --git a/inspector/connect_inspector.cpp b/inspector/connect_inspector.cpp index c7bd9295..e5feb119 100644 --- a/inspector/connect_inspector.cpp +++ b/inspector/connect_inspector.cpp @@ -27,8 +27,6 @@ using panda::ecmascript::tooling::Result; std::mutex g_connectMutex; std::unique_ptr g_inspector = nullptr; static constexpr char CONNECTED_MESSAGE[] = "connected"; -static constexpr char OPEN_MESSAGE[] = "layoutOpen"; -static constexpr char CLOSE_MESSAGE[] = "layoutClose"; static constexpr char REQUEST_MESSAGE[] = "tree"; static constexpr char STOPDEBUGGER_MESSAGE[] = "stopDebugger"; static constexpr char OPEN_ARKUI_STATE_PROFILER[] = "ArkUIStateProfilerOpen"; @@ -66,15 +64,6 @@ void OnConnectedMessage(const std::string& message) } } -void OnOpenMessage(const std::string& message) -{ - if (message.find(OPEN_MESSAGE, 0) != std::string::npos) { - if (g_inspector->setSwitchStatus_ != nullptr) { - LOGI("layoutOpen start"); - g_inspector->setSwitchStatus_(true); - } - } -} void SendMessageCallBack(const std::string& message) { if (g_inspector->connectServer_ != nullptr) { @@ -162,16 +151,6 @@ void OnMessage(const std::string &message) if (OnCangjieInspectorMessage(message)) { return; } - OnOpenMessage(message); - if (message.find(CLOSE_MESSAGE, 0) != std::string::npos) { - if (g_setConnectCallBack != nullptr) { - g_setConnectCallBack(false); - } - if (g_inspector->setSwitchStatus_ != nullptr) { - LOGI("layoutClose start"); - g_inspector->setSwitchStatus_(false); - } - } if (message.find(OPEN_ARKUI_STATE_PROFILER, 0) != std::string::npos) { if (g_inspector->setArkUIStateProfilerStatus_ != nullptr) { LOGI("state profiler open"); @@ -201,14 +180,12 @@ void OnMessage(const std::string &message) } } -void SetSwitchCallBack(const std::function& setSwitchStatus, - const std::function& createLayoutInfo, int32_t instanceId) +void SetSwitchCallBack(const std::function& createLayoutInfo, int32_t instanceId) { std::lock_guard lock(g_connectMutex); if (g_inspector == nullptr) { g_inspector = std::make_unique(); } - g_inspector->setSwitchStatus_ = setSwitchStatus; g_inspector->createLayoutInfo_ = createLayoutInfo; g_inspector->instanceId_ = instanceId; } diff --git a/inspector/connect_inspector.h b/inspector/connect_inspector.h index f8df2059..f0888a55 100644 --- a/inspector/connect_inspector.h +++ b/inspector/connect_inspector.h @@ -48,8 +48,7 @@ bool WaitForConnection(); void SetDebugModeCallBack(const std::function& setDebugMode); -void SetSwitchCallBack(const std::function& setSwitchStatus, - const std::function& createLayoutInfo, int32_t instanceId); +void SetSwitchCallBack(const std::function& createLayoutInfo, int32_t instanceId); void SetProfilerCallback(const std::function &setArkUIStateProfilerStatus); @@ -92,7 +91,6 @@ public: std::unordered_map infoBuffer_; std::unique_ptr connectServer_; std::atomic waitingForDebugger_ = true; - std::function setSwitchStatus_; std::function setArkUIStateProfilerStatus_; std::function createLayoutInfo_; std::function setDebugMode_; diff --git a/inspector/test/connect_server_test.cpp b/inspector/test/connect_server_test.cpp index b1bdb7bf..4e27d7c7 100644 --- a/inspector/test/connect_server_test.cpp +++ b/inspector/test/connect_server_test.cpp @@ -40,8 +40,6 @@ public: #if defined(OHOS_PLATFORM) static constexpr char CONNECTED_MESSAGE_TEST[] = "connected"; - static constexpr char OPEN_MESSAGE_TEST[] = "layoutOpen"; - static constexpr char CLOSE_MESSAGE_TEST[] = "layoutClose"; static constexpr char REQUEST_MESSAGE_TEST[] = "tree"; static constexpr char STOPDEBUGGER_MESSAGE_TEST[] = "stopDebugger"; static constexpr char OPEN_ARKUI_STATE_PROFILER_TEST[] = "ArkUIStateProfilerOpen"; @@ -61,7 +59,6 @@ public: bool g_profilerFlag = false; bool g_connectFlag = false; -bool g_switchStatus = false; int32_t g_createInfoId = 0; int32_t g_instanceId = 1; std::string g_arkUIMsg = ""; @@ -83,14 +80,10 @@ void CallbackInit() GTEST_LOG_(INFO) << "Execute DebugModeCallBack."; }; SetDebugModeCallBack(debugModeCb); - - auto switchStatusCb = [](bool flag) -> void { - g_switchStatus = flag; - }; auto createInfoCb = [](int32_t id) -> void { g_createInfoId = id; }; - SetSwitchCallBack(switchStatusCb, createInfoCb, g_instanceId); + SetSwitchCallBack(createInfoCb, g_instanceId); auto startRecordFunc = []() -> void {}; auto stopRecordFunc = []() -> void {}; @@ -135,7 +128,6 @@ HWTEST_F(ConnectServerTest, InspectorConnectTest, testing::ext::TestSize.Level0) EXPECT_TRUE(clientSocket.SendReply(CONNECTED_MESSAGE_TEST)); EXPECT_TRUE(clientSocket.SendReply(OPEN_ARKUI_STATE_PROFILER_TEST)); EXPECT_TRUE(clientSocket.SendReply(REQUEST_MESSAGE_TEST)); - EXPECT_TRUE(clientSocket.SendReply(OPEN_MESSAGE_TEST)); EXPECT_TRUE(clientSocket.SendReply(START_RECORD_MESSAGE_TEST)); EXPECT_TRUE(clientSocket.SendReply(STOP_RECORD_MESSAGE_TEST)); EXPECT_TRUE(clientSocket.SendReply(ARKUI_MESSAGE)); @@ -145,7 +137,6 @@ HWTEST_F(ConnectServerTest, InspectorConnectTest, testing::ext::TestSize.Level0) std::string recv = clientSocket.Decode(); EXPECT_STREQ(recv.c_str(), INSPECTOR_SERVER_OK); if (strcmp(recv.c_str(), INSPECTOR_SERVER_OK) == 0) { - EXPECT_TRUE(clientSocket.SendReply(CLOSE_MESSAGE_TEST)); EXPECT_TRUE(clientSocket.SendReply(STOPDEBUGGER_MESSAGE_TEST)); EXPECT_TRUE(clientSocket.SendReply(CLOSE_ARKUI_STATE_PROFILER_TEST)); } @@ -159,7 +150,6 @@ HWTEST_F(ConnectServerTest, InspectorConnectTest, testing::ext::TestSize.Level0) sleep(WAIT_TIME); ASSERT_TRUE(g_profilerFlag); ASSERT_EQ(g_createInfoId, g_instanceId); - ASSERT_TRUE(g_switchStatus); ASSERT_TRUE(g_connectFlag); EXPECT_STREQ(g_arkUIMsg.c_str(), ARKUI_MESSAGE); EXPECT_STREQ(g_wMSMsg.c_str(), WMS_MESSAGE); @@ -171,7 +161,6 @@ HWTEST_F(ConnectServerTest, InspectorConnectTest, testing::ext::TestSize.Level0) // Waiting for executing the message instruction sent by the client sleep(WAIT_TIME); ASSERT_FALSE(g_profilerFlag); - ASSERT_FALSE(g_switchStatus); ASSERT_FALSE(g_connectFlag); SendMessage(INSPECTOR_QUIT); -- Gitee