修复webserver死锁

This commit is contained in:
2026-08-17 20:38:43 +08:00
parent 47cf1af7a5
commit 03433a412a
16 changed files with 160 additions and 349 deletions
+15 -11
View File
@@ -92,6 +92,10 @@ TEST(RenderiveWebGallery, TwoDimensionalGalleryPublishesStateAndPixels) {
const auto& observer = state.at("telemetry").at("kernel_observer");
EXPECT_EQ(observer.at("state").at("viewport").at("width"), 560);
EXPECT_EQ(observer.at("renderable_count"), 4U);
EXPECT_EQ(state.at("actions").at("data").size(), 6U);
const auto low_latency_pixels = session.handle(Frame_Request{});
ASSERT_TRUE(low_latency_pixels);
EXPECT_EQ(low_latency_pixels->type, Web_Response_Type::Pixels);
const auto switched = session.handle(Gallery_Request{
Gallery_Request_Kind::Action,
@@ -102,28 +106,28 @@ TEST(RenderiveWebGallery, TwoDimensionalGalleryPublishesStateAndPixels) {
EXPECT_EQ(switched_state.at("telemetry").at("kernel_observer").at("mode"),
"manual");
const std::string render =
R"({"category":"event","type":"gallery_action","action":"mode_render"})";
const auto rendered = session.handle(
Gallery_Request{Gallery_Request_Kind::Action, render});
const auto rendered = session.handle(Frame_Request{});
ASSERT_TRUE(rendered);
EXPECT_EQ(nlohmann::json::parse(rendered->payload).at("type"), "case_state");
EXPECT_EQ(rendered->type, Web_Response_Type::Pixels);
const std::string capture =
R"({"category":"event","type":"gallery_action","action":"capture_next_frame"})";
const auto captured = session.handle(
Gallery_Request{Gallery_Request_Kind::Action, capture});
ASSERT_TRUE(captured);
const auto capture_state = nlohmann::json::parse(captured->payload);
const auto& sessions = capture_state.at("controls")
.at("performance_capture").at("sessions");
ASSERT_EQ(sessions.size(), 1U);
EXPECT_EQ(sessions.front().at("captured_count"), 1U);
const auto pixels = session.handle(Frame_Request{});
ASSERT_TRUE(pixels);
ASSERT_EQ(pixels->type, Web_Response_Type::Pixels);
EXPECT_EQ(pixels->payload.substr(0, 4), "RVP2");
const auto refreshed = session.handle(Gallery_Request{
Gallery_Request_Kind::Refresh,
R"({"category":"event","type":"gallery_refresh"})"});
ASSERT_TRUE(refreshed);
const auto capture_state = nlohmann::json::parse(refreshed->payload);
const auto& sessions = capture_state.at("controls")
.at("performance_capture").at("sessions");
ASSERT_EQ(sessions.size(), 1U);
EXPECT_EQ(sessions.front().at("captured_count"), 1U);
const auto first_pixel = pixels->payload.substr(pixel_frame_header_size, 4);
bool contains_drawn_pixel = false;
for (std::size_t offset = pixel_frame_header_size;