Route recording cleanup through platform services

This commit is contained in:
2026-06-03 05:04:14 +02:00
parent 578b1f6082
commit ac4d065c78
10 changed files with 86 additions and 14 deletions

View File

@@ -81,6 +81,18 @@ public:
++render_capture_ends;
}
[[nodiscard]] bool deletes_recorded_files_on_clear() override
{
++recording_delete_policy_checks;
return deletes_recorded_files;
}
void clear_recorded_files(std::string_view recording_path) override
{
++recording_clears;
cleared_recording_path.assign(recording_path);
}
void update_platform_frame(float delta_time_seconds) override
{
++platform_frame_updates;
@@ -159,6 +171,8 @@ public:
int render_capture_begins = 0;
int render_capture_ends = 0;
int storage_prepares = 0;
int recording_delete_policy_checks = 0;
int recording_clears = 0;
int platform_frame_updates = 0;
int frame_reports = 0;
int display_file_requests = 0;
@@ -172,12 +186,14 @@ public:
bool cursor_visible = false;
bool keyboard_visible = false;
bool prepared_file_saved = true;
bool deletes_recorded_files = true;
float last_platform_delta = 0.0f;
int last_frame_report = 0;
std::string displayed_path;
std::string shared_path;
std::string prepared_file_path;
std::string prepared_file_name;
std::string cleared_recording_path;
std::string picker_path = "D:/Paint/import.png";
std::string save_path = "D:/Paint/export.ppi";
std::string directory_path = "D:/Paint";
@@ -284,6 +300,19 @@ void platform_services_dispatch_render_capture_hooks(pp::tests::Harness& harness
PP_EXPECT(harness, fake.render_capture_ends == 1);
}
void platform_services_dispatch_recording_cleanup(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
PP_EXPECT(harness, services.deletes_recorded_files_on_clear());
services.clear_recorded_files("D:/Paint/frames");
PP_EXPECT(harness, fake.recording_delete_policy_checks == 1);
PP_EXPECT(harness, fake.recording_clears == 1);
PP_EXPECT(harness, fake.cleared_recording_path == "D:/Paint/frames");
}
void platform_services_dispatch_frame_hooks(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -374,6 +403,7 @@ int main()
harness.run("platform services dispatch UI thread lifecycle", platform_services_dispatch_ui_thread_lifecycle);
harness.run("platform services dispatch render context lifecycle", platform_services_dispatch_render_context_lifecycle);
harness.run("platform services dispatch render capture hooks", platform_services_dispatch_render_capture_hooks);
harness.run("platform services dispatch recording cleanup", platform_services_dispatch_recording_cleanup);
harness.run("platform services dispatch frame hooks", platform_services_dispatch_frame_hooks);
harness.run("platform services dispatch file actions", platform_services_dispatch_file_actions);
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);