Route live reload policy through platform services
This commit is contained in:
@@ -449,7 +449,8 @@ 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
|
||||||
recording cleanup, prepared-file save/download handoff;
|
recording cleanup, live asset/layout reload policy, 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, 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 |
|
| 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, live asset/layout reload policy, 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,8 +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, recording file cleanup, image/file/save-file pickers,
|
display, file sharing, recording file cleanup, live asset/layout reload policy,
|
||||||
and directory pickers.
|
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
|
||||||
@@ -513,6 +513,9 @@ Recording clear now asks `PlatformServices` whether the platform owns recorded
|
|||||||
file deletion and dispatches the cleanup through the service, preserving the
|
file deletion and dispatches the cleanup through the service, preserving the
|
||||||
current Apple recorded-frame cleanup while removing Apple-specific file cleanup
|
current Apple recorded-frame cleanup while removing Apple-specific file cleanup
|
||||||
guards from `App::rec_clear`.
|
guards from `App::rec_clear`.
|
||||||
|
The UI loop now asks `PlatformServices` whether live shader/layout reloading
|
||||||
|
should run, preserving the previous Windows/macOS reload behavior while removing
|
||||||
|
the direct `(_WIN32 || __OSX__)` guard from `App::ui_thread_main`.
|
||||||
`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,
|
||||||
@@ -1029,8 +1032,9 @@ Results:
|
|||||||
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, recording cleanup
|
lifecycle dispatch, render-capture frame hook dispatch, recording cleanup
|
||||||
dispatch, per-frame platform hook dispatch, picker callback dispatch, and
|
dispatch, live asset/layout reload policy dispatch, per-frame platform hook
|
||||||
prepared-file save/download callback dispatch. The live Windows app now
|
dispatch, picker callback dispatch, and 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
|
||||||
|
|||||||
25
src/app.cpp
25
src/app.cpp
@@ -1014,22 +1014,23 @@ void App::ui_thread_main()
|
|||||||
rendered_frames = 0;
|
rendered_frames = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if /*_DEBUG &&*/ (_WIN32 || __OSX__)
|
if (platform_enables_live_asset_reloading())
|
||||||
t_reloader += dt;
|
|
||||||
if (t_reloader > 1.0)
|
|
||||||
{
|
{
|
||||||
t_reloader = 0;
|
t_reloader += dt;
|
||||||
if (ShaderManager::reload())
|
if (t_reloader > 1.0)
|
||||||
{
|
{
|
||||||
stroke->update_controls();
|
t_reloader = 0;
|
||||||
redraw = true;
|
if (ShaderManager::reload())
|
||||||
|
{
|
||||||
|
stroke->update_controls();
|
||||||
|
redraw = true;
|
||||||
|
}
|
||||||
|
if (layout.reload())
|
||||||
|
redraw = true;
|
||||||
|
if (layout_designer.reload())
|
||||||
|
redraw = true;
|
||||||
}
|
}
|
||||||
if (layout.reload())
|
|
||||||
redraw = true;
|
|
||||||
if (layout_designer.reload())
|
|
||||||
redraw = true;
|
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
tick(dt);
|
tick(dt);
|
||||||
|
|
||||||
|
|||||||
@@ -200,6 +200,7 @@ public:
|
|||||||
void end_render_capture_frame();
|
void end_render_capture_frame();
|
||||||
[[nodiscard]] bool platform_deletes_recorded_files_on_clear();
|
[[nodiscard]] bool platform_deletes_recorded_files_on_clear();
|
||||||
void clear_platform_recorded_files(std::string path);
|
void clear_platform_recorded_files(std::string path);
|
||||||
|
[[nodiscard]] bool platform_enables_live_asset_reloading();
|
||||||
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(
|
||||||
|
|||||||
@@ -269,6 +269,11 @@ void App::clear_platform_recorded_files(std::string path)
|
|||||||
active_platform_services().clear_recorded_files(path);
|
active_platform_services().clear_recorded_files(path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool App::platform_enables_live_asset_reloading()
|
||||||
|
{
|
||||||
|
return active_platform_services().enables_live_asset_reloading();
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -35,6 +35,7 @@ public:
|
|||||||
virtual void end_render_capture_frame() = 0;
|
virtual void end_render_capture_frame() = 0;
|
||||||
[[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0;
|
[[nodiscard]] virtual bool deletes_recorded_files_on_clear() = 0;
|
||||||
virtual void clear_recorded_files(std::string_view recording_path) = 0;
|
virtual void clear_recorded_files(std::string_view recording_path) = 0;
|
||||||
|
[[nodiscard]] virtual bool enables_live_asset_reloading() = 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;
|
||||||
|
|||||||
@@ -230,6 +230,15 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool enables_live_asset_reloading() override
|
||||||
|
{
|
||||||
|
#if defined(__OSX__)
|
||||||
|
return true;
|
||||||
|
#else
|
||||||
|
return false;
|
||||||
|
#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;
|
||||||
|
|||||||
@@ -261,6 +261,11 @@ public:
|
|||||||
(void)recording_path;
|
(void)recording_path;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool enables_live_asset_reloading() override
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|||||||
@@ -93,6 +93,12 @@ public:
|
|||||||
cleared_recording_path.assign(recording_path);
|
cleared_recording_path.assign(recording_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[[nodiscard]] bool enables_live_asset_reloading() override
|
||||||
|
{
|
||||||
|
++live_asset_reload_policy_checks;
|
||||||
|
return live_asset_reloading;
|
||||||
|
}
|
||||||
|
|
||||||
void update_platform_frame(float delta_time_seconds) override
|
void update_platform_frame(float delta_time_seconds) override
|
||||||
{
|
{
|
||||||
++platform_frame_updates;
|
++platform_frame_updates;
|
||||||
@@ -173,6 +179,7 @@ public:
|
|||||||
int storage_prepares = 0;
|
int storage_prepares = 0;
|
||||||
int recording_delete_policy_checks = 0;
|
int recording_delete_policy_checks = 0;
|
||||||
int recording_clears = 0;
|
int recording_clears = 0;
|
||||||
|
int live_asset_reload_policy_checks = 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;
|
||||||
@@ -187,6 +194,7 @@ public:
|
|||||||
bool keyboard_visible = false;
|
bool keyboard_visible = false;
|
||||||
bool prepared_file_saved = true;
|
bool prepared_file_saved = true;
|
||||||
bool deletes_recorded_files = true;
|
bool deletes_recorded_files = true;
|
||||||
|
bool live_asset_reloading = 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;
|
||||||
@@ -313,6 +321,18 @@ void platform_services_dispatch_recording_cleanup(pp::tests::Harness& harness)
|
|||||||
PP_EXPECT(harness, fake.cleared_recording_path == "D:/Paint/frames");
|
PP_EXPECT(harness, fake.cleared_recording_path == "D:/Paint/frames");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void platform_services_dispatch_live_asset_reload_policy(pp::tests::Harness& harness)
|
||||||
|
{
|
||||||
|
FakePlatformServices fake("unused");
|
||||||
|
pp::platform::PlatformServices& services = fake;
|
||||||
|
|
||||||
|
PP_EXPECT(harness, services.enables_live_asset_reloading());
|
||||||
|
fake.live_asset_reloading = false;
|
||||||
|
PP_EXPECT(harness, !services.enables_live_asset_reloading());
|
||||||
|
|
||||||
|
PP_EXPECT(harness, fake.live_asset_reload_policy_checks == 2);
|
||||||
|
}
|
||||||
|
|
||||||
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");
|
||||||
@@ -404,6 +424,7 @@ int main()
|
|||||||
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 recording cleanup", platform_services_dispatch_recording_cleanup);
|
||||||
|
harness.run("platform services dispatch live asset reload policy", platform_services_dispatch_live_asset_reload_policy);
|
||||||
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