diff --git a/inspector/connect_inspector.cpp b/inspector/connect_inspector.cpp index 55a1796b340871ee48fa585089542006b217e8b0..a51f4973e234a487ac781fa17218efe6fddb4254 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 OnInspectorRecordMessage(const std::string& message) { if (message.find(START_RECORD_MESSAGE, 0) != std::string::npos) { @@ -156,16 +145,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"); @@ -198,14 +177,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 600e194d62f4d8ad3fbed89b768b5abf855e1a22..10d5e41ba7e6d166a6217f712762cde562b3313c 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 6c275f34c39ab5c77ded7bf61ce45d1f0f962ecf..69b4fd77d8d2e52651f304c73ef6430e557acac7 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)); } @@ -157,7 +148,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); @@ -168,7 +158,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); ASSERT_TRUE(WaitForConnection());