Route render context lifecycle through platform services

This commit is contained in:
2026-06-03 04:50:42 +02:00
parent f3925f8423
commit 7a9b14a86f
10 changed files with 134 additions and 49 deletions

View File

@@ -50,6 +50,21 @@ public:
++ui_thread_detaches;
}
void acquire_render_context() override
{
++render_context_acquires;
}
void release_render_context() override
{
++render_context_releases;
}
void present_render_context() override
{
++render_context_presents;
}
void update_platform_frame(float delta_time_seconds) override
{
++platform_frame_updates;
@@ -122,6 +137,9 @@ public:
int keyboard_updates = 0;
int ui_thread_attaches = 0;
int ui_thread_detaches = 0;
int render_context_acquires = 0;
int render_context_releases = 0;
int render_context_presents = 0;
int platform_frame_updates = 0;
int frame_reports = 0;
int display_file_requests = 0;
@@ -201,6 +219,20 @@ void platform_services_dispatch_ui_thread_lifecycle(pp::tests::Harness& harness)
PP_EXPECT(harness, fake.ui_thread_detaches == 1);
}
void platform_services_dispatch_render_context_lifecycle(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
pp::platform::PlatformServices& services = fake;
services.acquire_render_context();
services.present_render_context();
services.release_render_context();
PP_EXPECT(harness, fake.render_context_acquires == 1);
PP_EXPECT(harness, fake.render_context_presents == 1);
PP_EXPECT(harness, fake.render_context_releases == 1);
}
void platform_services_dispatch_frame_hooks(pp::tests::Harness& harness)
{
FakePlatformServices fake("unused");
@@ -288,6 +320,7 @@ int main()
harness.run("platform services preserve empty clipboard writes", platform_services_preserve_empty_clipboard_writes);
harness.run("platform services dispatch visibility updates", platform_services_dispatch_visibility_updates);
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 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);