Route recording cleanup through platform services
This commit is contained in:
@@ -449,7 +449,7 @@ Known local toolchain state:
|
|||||||
virtual-keyboard visibility, external file display, file sharing, native
|
virtual-keyboard visibility, external file display, file sharing, native
|
||||||
app/window close, UI-thread lifecycle hooks, render-context lifecycle hooks,
|
app/window close, UI-thread lifecycle hooks, render-context lifecycle hooks,
|
||||||
render-capture frame hooks, per-frame platform hooks, picker callbacks, and
|
render-capture frame hooks, per-frame platform hooks, picker callbacks, and
|
||||||
prepared-file save/download handoff;
|
recording cleanup, prepared-file save/download handoff;
|
||||||
Windows
|
Windows
|
||||||
live app execution now uses injected
|
live app execution now uses injected
|
||||||
`WindowsPlatformServices` from
|
`WindowsPlatformServices` from
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ agent or engineer to remove them without reconstructing context from chat.
|
|||||||
| DEBT-0014 | Open | Modernization | `windows-clangcl-asan` now configures as a headless Ninja/clang-cl preset and uses the release MSVC runtime required by ASan, but local builds still fail because installed clang-cl 18.1.8 is paired with VS 2026-preview STL headers that require Clang 20 or newer | Sanitizer validation should be local and repeatable, but this machine's compiler/header pairing is incompatible | `cmake --fresh --preset windows-clangcl-asan`; `cmake --build --preset windows-clangcl-asan --target pp_foundation` | Install/use Clang 20+ with the VS 2026 STL, or point the preset at a compatible VS 2022 toolchain, then make `platform-build.ps1 -Presets windows-clangcl-asan` pass for the headless matrix |
|
| DEBT-0014 | Open | Modernization | `windows-clangcl-asan` now configures as a headless Ninja/clang-cl preset and uses the release MSVC runtime required by ASan, but local builds still fail because installed clang-cl 18.1.8 is paired with VS 2026-preview STL headers that require Clang 20 or newer | Sanitizer validation should be local and repeatable, but this machine's compiler/header pairing is incompatible | `cmake --fresh --preset windows-clangcl-asan`; `cmake --build --preset windows-clangcl-asan --target pp_foundation` | Install/use Clang 20+ with the VS 2026 STL, or point the preset at a compatible VS 2022 toolchain, then make `platform-build.ps1 -Presets windows-clangcl-asan` pass for the headless matrix |
|
||||||
| DEBT-0015 | Open | Modernization | Cursor visibility requests now consume pure `pp_app_core` planning through `pano_cli plan-cursor-visibility`, `App::show_cursor`/`App::hide_cursor` dispatch through `PlatformServices` without platform guards, and Windows live execution uses injected `WindowsPlatformServices`, but macOS cursor execution still reaches the retained fallback adapter | Keep canvas cursor behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-cursor-visibility --visible`; `ctest --preset desktop-fast --build-config Debug` | Cursor visibility execution is owned by injected `pp_platform_*` services for every supported platform |
|
| DEBT-0015 | Open | Modernization | Cursor visibility requests now consume pure `pp_app_core` planning through `pano_cli plan-cursor-visibility`, `App::show_cursor`/`App::hide_cursor` dispatch through `PlatformServices` without platform guards, and Windows live execution uses injected `WindowsPlatformServices`, but macOS cursor execution still reaches the retained fallback adapter | Keep canvas cursor behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-cursor-visibility --visible`; `ctest --preset desktop-fast --build-config Debug` | Cursor visibility execution is owned by injected `pp_platform_*` services for every supported platform |
|
||||||
| DEBT-0016 | Open | Modernization | Clipboard get/set requests now consume pure `pp_app_core` planning through `pano_cli plan-clipboard-read` and `pano_cli plan-clipboard-write`, and Windows live execution uses injected `WindowsPlatformServices`, but Apple/Android clipboard execution still reaches retained fallback adapter branches from `App::clipboard_get_text` and `App::clipboard_set_text` | Keep picker/color text clipboard behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-clipboard-write --text #ff00aa`; `ctest --preset desktop-fast --build-config Debug` | Clipboard execution is owned by injected `pp_platform_*` services for every supported platform |
|
| DEBT-0016 | Open | Modernization | Clipboard get/set requests now consume pure `pp_app_core` planning through `pano_cli plan-clipboard-read` and `pano_cli plan-clipboard-write`, and Windows live execution uses injected `WindowsPlatformServices`, but Apple/Android clipboard execution still reaches retained fallback adapter branches from `App::clipboard_get_text` and `App::clipboard_set_text` | Keep picker/color text clipboard behavior stable while platform shells are extracted incrementally | `pp_app_core_document_platform_io_tests`; `pano_cli plan-clipboard-write --text #ff00aa`; `ctest --preset desktop-fast --build-config Debug` | Clipboard execution is owned by injected `pp_platform_*` services for every supported platform |
|
||||||
| DEBT-0017 | Open | Modernization | Startup storage path preparation, `App::clipboard_get_text`, `App::clipboard_set_text`, `App::show_cursor`, `App::hide_cursor`, `App::showKeyboard`, `App::hideKeyboard`, `App::display_file`, `App::share_file`, native app/window close, UI-thread lifecycle hooks, render-context acquire/release/present hooks, render-capture frame hooks, per-frame platform hooks, `App::pick_image`, `App::pick_file`, the non-writer `App::pick_file_save`, `App::pick_dir`, and prepared-file save/download handoff now call the SDK-free `pp::platform::PlatformServices` interface, and Windows injects `WindowsPlatformServices` from `src/platform_windows/windows_platform_services.*`; non-Windows live implementations still use `src/platform_legacy/legacy_platform_services.*`, a named fallback adapter that forwards to retained Apple/Android/Linux/Web bridge functions and retained no-op branches | Preserve behavior while moving platform execution behind a testable service boundary before platform shell implementations are injected | `pp_platform_api_tests`; `pp_app_core_document_platform_io_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Replace `src/platform_legacy/legacy_platform_services.*` with injected `pp_platform_*` service implementations owned by each non-Windows platform shell |
|
| DEBT-0017 | Open | Modernization | Startup storage path preparation, `App::clipboard_get_text`, `App::clipboard_set_text`, `App::show_cursor`, `App::hide_cursor`, `App::showKeyboard`, `App::hideKeyboard`, `App::display_file`, `App::share_file`, native app/window close, UI-thread lifecycle hooks, render-context acquire/release/present hooks, render-capture frame hooks, recording cleanup, per-frame platform hooks, `App::pick_image`, `App::pick_file`, the non-writer `App::pick_file_save`, `App::pick_dir`, and prepared-file save/download handoff now call the SDK-free `pp::platform::PlatformServices` interface, and Windows injects `WindowsPlatformServices` from `src/platform_windows/windows_platform_services.*`; non-Windows live implementations still use `src/platform_legacy/legacy_platform_services.*`, a named fallback adapter that forwards to retained Apple/Android/Linux/Web bridge functions and retained no-op branches | Preserve behavior while moving platform execution behind a testable service boundary before platform shell implementations are injected | `pp_platform_api_tests`; `pp_app_core_document_platform_io_tests`; `ctest --preset desktop-fast --build-config Debug`; `powershell -ExecutionPolicy Bypass -File scripts\automation\package-smoke.ps1 -Preset windows-msvc-default -Configuration Debug` | Replace `src/platform_legacy/legacy_platform_services.*` with injected `pp_platform_*` service implementations owned by each non-Windows platform shell |
|
||||||
|
|
||||||
## Closed Debt
|
## Closed Debt
|
||||||
|
|
||||||
|
|||||||
@@ -472,7 +472,8 @@ before retained platform clipboard bridges continue.
|
|||||||
startup storage path preparation, clipboard text, cursor visibility,
|
startup storage path preparation, clipboard text, cursor visibility,
|
||||||
virtual-keyboard visibility, UI-thread lifecycle hooks, render-context
|
virtual-keyboard visibility, UI-thread lifecycle hooks, render-context
|
||||||
acquire/release/present hooks, render-capture frame hooks, external file
|
acquire/release/present hooks, render-capture frame hooks, external file
|
||||||
display, file sharing, image/file/save-file pickers, and directory pickers.
|
display, file sharing, recording file cleanup, image/file/save-file pickers,
|
||||||
|
and directory pickers.
|
||||||
Windows installs an injected `WindowsPlatformServices` implementation from
|
Windows installs an injected `WindowsPlatformServices` implementation from
|
||||||
`src/platform_windows/windows_platform_services.*` in `pp_platform_windows`;
|
`src/platform_windows/windows_platform_services.*` in `pp_platform_windows`;
|
||||||
other platforms still route through the debt-tracked legacy fallback adapter
|
other platforms still route through the debt-tracked legacy fallback adapter
|
||||||
@@ -508,6 +509,10 @@ Startup data/work/recording/temp path preparation now dispatches through
|
|||||||
`PlatformServices`, with Windows creating the Documents/PanoPainter folder
|
`PlatformServices`, with Windows creating the Documents/PanoPainter folder
|
||||||
tree in `WindowsPlatformServices` and Apple/Linux/Web behavior preserved in the
|
tree in `WindowsPlatformServices` and Apple/Linux/Web behavior preserved in the
|
||||||
legacy adapter until platform shells are injected.
|
legacy adapter until platform shells are injected.
|
||||||
|
Recording clear now asks `PlatformServices` whether the platform owns recorded
|
||||||
|
file deletion and dispatches the cleanup through the service, preserving the
|
||||||
|
current Apple recorded-frame cleanup while removing Apple-specific file cleanup
|
||||||
|
guards from `App::rec_clear`.
|
||||||
`pano_cli plan-cloud-upload` exposes the app-core cloud upload decision used by
|
`pano_cli plan-cloud-upload` exposes the app-core cloud upload decision used by
|
||||||
the live cloud upload command for missing-canvas, new-document warning, publish
|
the live cloud upload command for missing-canvas, new-document warning, publish
|
||||||
prompt, and dirty-document save-before-upload states before legacy UI, canvas,
|
prompt, and dirty-document save-before-upload states before legacy UI, canvas,
|
||||||
@@ -1023,9 +1028,9 @@ Results:
|
|||||||
clipboard writes, cursor visibility dispatch, virtual-keyboard visibility
|
clipboard writes, cursor visibility dispatch, virtual-keyboard visibility
|
||||||
dispatch, external file display dispatch, file sharing dispatch, native
|
dispatch, external file display dispatch, file sharing dispatch, native
|
||||||
app/window close dispatch, UI-thread lifecycle dispatch, render-context
|
app/window close dispatch, UI-thread lifecycle dispatch, render-context
|
||||||
lifecycle dispatch, render-capture frame hook dispatch, per-frame platform
|
lifecycle dispatch, render-capture frame hook dispatch, recording cleanup
|
||||||
hook dispatch, picker callback dispatch, and prepared-file save/download
|
dispatch, per-frame platform hook dispatch, picker callback dispatch, and
|
||||||
callback dispatch. The live Windows app now
|
prepared-file save/download callback dispatch. The live Windows app now
|
||||||
consumes this interface through an injected
|
consumes this interface through an injected
|
||||||
`WindowsPlatformServices` instance isolated in
|
`WindowsPlatformServices` instance isolated in
|
||||||
`src/platform_windows/windows_platform_services.*`; other platforms still
|
`src/platform_windows/windows_platform_services.*`; other platforms still
|
||||||
|
|||||||
10
src/app.cpp
10
src/app.cpp
@@ -759,18 +759,12 @@ void App::rec_clear()
|
|||||||
{
|
{
|
||||||
const auto plan = pp::app::plan_recording_clear(
|
const auto plan = pp::app::plan_recording_clear(
|
||||||
rec_running,
|
rec_running,
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
platform_deletes_recorded_files_on_clear()
|
||||||
true
|
|
||||||
#else
|
|
||||||
false
|
|
||||||
#endif
|
|
||||||
);
|
);
|
||||||
if (plan.stop_running_recording)
|
if (plan.stop_running_recording)
|
||||||
rec_stop();
|
rec_stop();
|
||||||
#if defined(__IOS__) || defined(__OSX__)
|
|
||||||
if (plan.delete_recorded_files)
|
if (plan.delete_recorded_files)
|
||||||
delete_all_files_in_path(rec_path);
|
clear_platform_recorded_files(rec_path);
|
||||||
#endif
|
|
||||||
rec_count = plan.frame_count_after_clear;
|
rec_count = plan.frame_count_after_clear;
|
||||||
update_rec_frames();
|
update_rec_frames();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -198,6 +198,8 @@ public:
|
|||||||
void present_render_context();
|
void present_render_context();
|
||||||
void begin_render_capture_frame();
|
void begin_render_capture_frame();
|
||||||
void end_render_capture_frame();
|
void end_render_capture_frame();
|
||||||
|
[[nodiscard]] bool platform_deletes_recorded_files_on_clear();
|
||||||
|
void clear_platform_recorded_files(std::string path);
|
||||||
void update_platform_frame(float delta_time_seconds);
|
void update_platform_frame(float delta_time_seconds);
|
||||||
void report_rendered_frames(int frames);
|
void report_rendered_frames(int frames);
|
||||||
void save_prepared_file(
|
void save_prepared_file(
|
||||||
|
|||||||
@@ -259,6 +259,16 @@ void App::end_render_capture_frame()
|
|||||||
active_platform_services().end_render_capture_frame();
|
active_platform_services().end_render_capture_frame();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool App::platform_deletes_recorded_files_on_clear()
|
||||||
|
{
|
||||||
|
return active_platform_services().deletes_recorded_files_on_clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void App::clear_platform_recorded_files(std::string path)
|
||||||
|
{
|
||||||
|
active_platform_services().clear_recorded_files(path);
|
||||||
|
}
|
||||||
|
|
||||||
void App::update_platform_frame(float delta_time_seconds)
|
void App::update_platform_frame(float delta_time_seconds)
|
||||||
{
|
{
|
||||||
active_platform_services().update_platform_frame(delta_time_seconds);
|
active_platform_services().update_platform_frame(delta_time_seconds);
|
||||||
|
|||||||
@@ -33,6 +33,8 @@ public:
|
|||||||
virtual void present_render_context() = 0;
|
virtual void present_render_context() = 0;
|
||||||
virtual void begin_render_capture_frame() = 0;
|
virtual void begin_render_capture_frame() = 0;
|
||||||
virtual void end_render_capture_frame() = 0;
|
virtual void end_render_capture_frame() = 0;
|
||||||
|
[[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0;
|
||||||
|
virtual void clear_recorded_files(std::string_view recording_path) = 0;
|
||||||
virtual void update_platform_frame(float delta_time_seconds) = 0;
|
virtual void update_platform_frame(float delta_time_seconds) = 0;
|
||||||
virtual void report_rendered_frames(int frames) = 0;
|
virtual void report_rendered_frames(int frames) = 0;
|
||||||
virtual void display_file(std::string_view path) = 0;
|
virtual void display_file(std::string_view path) = 0;
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ void android_pick_file_save(std::function<void(std::string)> callback);
|
|||||||
std::string android_get_clipboard();
|
std::string android_get_clipboard();
|
||||||
bool android_set_clipboard(const std::string& s);
|
bool android_set_clipboard(const std::string& s);
|
||||||
#elif __APPLE__
|
#elif __APPLE__
|
||||||
|
void delete_all_files_in_path(const std::string& source_path);
|
||||||
#elif __LINUX__
|
#elif __LINUX__
|
||||||
#include <tinyfiledialogs.h>
|
#include <tinyfiledialogs.h>
|
||||||
std::string linux_home_path();
|
std::string linux_home_path();
|
||||||
@@ -211,6 +212,24 @@ public:
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool deletes_recorded_files_on_clear() override
|
||||||
|
{
|
||||||
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear_recorded_files(std::string_view recording_path) override
|
||||||
|
{
|
||||||
|
#if defined(__IOS__) || defined(__OSX__)
|
||||||
|
delete_all_files_in_path(std::string(recording_path));
|
||||||
|
#else
|
||||||
|
(void)recording_path;
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void update_platform_frame(float delta_time_seconds) override
|
void update_platform_frame(float delta_time_seconds) override
|
||||||
{
|
{
|
||||||
(void)delta_time_seconds;
|
(void)delta_time_seconds;
|
||||||
|
|||||||
@@ -251,6 +251,16 @@ public:
|
|||||||
win32_renderdoc_frame_end();
|
win32_renderdoc_frame_end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool deletes_recorded_files_on_clear() override
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
void clear_recorded_files(std::string_view recording_path) override
|
||||||
|
{
|
||||||
|
(void)recording_path;
|
||||||
|
}
|
||||||
|
|
||||||
void update_platform_frame(float delta_time_seconds) override
|
void update_platform_frame(float delta_time_seconds) override
|
||||||
{
|
{
|
||||||
win32_update_stylus(delta_time_seconds);
|
win32_update_stylus(delta_time_seconds);
|
||||||
|
|||||||
@@ -81,6 +81,18 @@ public:
|
|||||||
++render_capture_ends;
|
++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
|
void update_platform_frame(float delta_time_seconds) override
|
||||||
{
|
{
|
||||||
++platform_frame_updates;
|
++platform_frame_updates;
|
||||||
@@ -159,6 +171,8 @@ public:
|
|||||||
int render_capture_begins = 0;
|
int render_capture_begins = 0;
|
||||||
int render_capture_ends = 0;
|
int render_capture_ends = 0;
|
||||||
int storage_prepares = 0;
|
int storage_prepares = 0;
|
||||||
|
int recording_delete_policy_checks = 0;
|
||||||
|
int recording_clears = 0;
|
||||||
int platform_frame_updates = 0;
|
int platform_frame_updates = 0;
|
||||||
int frame_reports = 0;
|
int frame_reports = 0;
|
||||||
int display_file_requests = 0;
|
int display_file_requests = 0;
|
||||||
@@ -172,12 +186,14 @@ public:
|
|||||||
bool cursor_visible = false;
|
bool cursor_visible = false;
|
||||||
bool keyboard_visible = false;
|
bool keyboard_visible = false;
|
||||||
bool prepared_file_saved = true;
|
bool prepared_file_saved = true;
|
||||||
|
bool deletes_recorded_files = true;
|
||||||
float last_platform_delta = 0.0f;
|
float last_platform_delta = 0.0f;
|
||||||
int last_frame_report = 0;
|
int last_frame_report = 0;
|
||||||
std::string displayed_path;
|
std::string displayed_path;
|
||||||
std::string shared_path;
|
std::string shared_path;
|
||||||
std::string prepared_file_path;
|
std::string prepared_file_path;
|
||||||
std::string prepared_file_name;
|
std::string prepared_file_name;
|
||||||
|
std::string cleared_recording_path;
|
||||||
std::string picker_path = "D:/Paint/import.png";
|
std::string picker_path = "D:/Paint/import.png";
|
||||||
std::string save_path = "D:/Paint/export.ppi";
|
std::string save_path = "D:/Paint/export.ppi";
|
||||||
std::string directory_path = "D:/Paint";
|
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);
|
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)
|
void platform_services_dispatch_frame_hooks(pp::tests::Harness& harness)
|
||||||
{
|
{
|
||||||
FakePlatformServices fake("unused");
|
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 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 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 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 frame hooks", platform_services_dispatch_frame_hooks);
|
||||||
harness.run("platform services dispatch file actions", platform_services_dispatch_file_actions);
|
harness.run("platform services dispatch file actions", platform_services_dispatch_file_actions);
|
||||||
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);
|
harness.run("platform services dispatch picker callbacks", platform_services_dispatch_picker_callbacks);
|
||||||
|
|||||||
Reference in New Issue
Block a user