Route diagnostic hooks through platform services
This commit is contained in:
@@ -449,8 +449,8 @@ Known local toolchain state:
|
||||
virtual-keyboard visibility, external file display, file sharing, native
|
||||
app/window close, UI-thread lifecycle hooks, render-context lifecycle hooks,
|
||||
render-capture frame hooks, per-frame platform hooks, picker callbacks, and
|
||||
recording cleanup, live asset/layout reload policy, prepared-file
|
||||
save/download handoff;
|
||||
recording cleanup, live asset/layout reload policy, diagnostic
|
||||
stacktrace/crash hooks, prepared-file save/download handoff;
|
||||
Windows
|
||||
live app execution now uses injected
|
||||
`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-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-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 |
|
||||
| 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, diagnostic stacktrace/crash 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 |
|
||||
|
||||
## Closed Debt
|
||||
|
||||
|
||||
@@ -473,7 +473,8 @@ startup storage path preparation, clipboard text, cursor visibility,
|
||||
virtual-keyboard visibility, UI-thread lifecycle hooks, render-context
|
||||
acquire/release/present hooks, render-capture frame hooks, external file
|
||||
display, file sharing, recording file cleanup, live asset/layout reload policy,
|
||||
image/file/save-file pickers, and directory pickers.
|
||||
diagnostic stacktrace/crash hooks, image/file/save-file pickers, and directory
|
||||
pickers.
|
||||
Windows installs an injected `WindowsPlatformServices` implementation from
|
||||
`src/platform_windows/windows_platform_services.*` in `pp_platform_windows`;
|
||||
other platforms still route through the debt-tracked legacy fallback adapter
|
||||
@@ -516,6 +517,9 @@ 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`.
|
||||
`App::stacktrace` and `App::crash_test` now dispatch through `PlatformServices`,
|
||||
with Windows retaining the debug-break crash hook and the legacy adapter
|
||||
preserving Apple stacktrace/crash and Android crash-test behavior.
|
||||
`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
|
||||
prompt, and dirty-document save-before-upload states before legacy UI, canvas,
|
||||
@@ -1032,9 +1036,9 @@ Results:
|
||||
dispatch, external file display dispatch, file sharing dispatch, native
|
||||
app/window close dispatch, UI-thread lifecycle dispatch, render-context
|
||||
lifecycle dispatch, render-capture frame hook dispatch, recording cleanup
|
||||
dispatch, live asset/layout reload policy dispatch, per-frame platform hook
|
||||
dispatch, picker callback dispatch, and prepared-file save/download callback
|
||||
dispatch. The live Windows app now
|
||||
dispatch, live asset/layout reload policy dispatch, diagnostic hook dispatch,
|
||||
per-frame platform hook dispatch, picker callback dispatch, and prepared-file
|
||||
save/download callback dispatch. The live Windows app now
|
||||
consumes this interface through an injected
|
||||
`WindowsPlatformServices` instance isolated in
|
||||
`src/platform_windows/windows_platform_services.*`; other platforms still
|
||||
|
||||
@@ -79,24 +79,12 @@ bool App::clipboard_set_text(const std::string& s)
|
||||
|
||||
void App::stacktrace()
|
||||
{
|
||||
#if __OSX__
|
||||
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
|
||||
LOG("callstack:\n%s", [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
#endif
|
||||
active_platform_services().log_stacktrace();
|
||||
}
|
||||
|
||||
void App::crash_test()
|
||||
{
|
||||
#ifdef __IOS__
|
||||
[ios_view crash];
|
||||
#elif __OSX__
|
||||
[osx_view hockeyapp_crash];
|
||||
#elif defined(_WIN32)
|
||||
__debugbreak();
|
||||
#elif defined(__ANDROID__)
|
||||
int *x = nullptr; *x = 42;
|
||||
LOG("%d", *x);
|
||||
#endif
|
||||
active_platform_services().trigger_crash_test();
|
||||
}
|
||||
|
||||
void App::tick(float dt)
|
||||
|
||||
@@ -22,6 +22,8 @@ public:
|
||||
virtual ~PlatformServices() = default;
|
||||
|
||||
[[nodiscard]] virtual PlatformStoragePaths prepare_storage_paths() = 0;
|
||||
virtual void log_stacktrace() = 0;
|
||||
virtual void trigger_crash_test() = 0;
|
||||
[[nodiscard]] virtual std::string clipboard_text() = 0;
|
||||
[[nodiscard]] virtual bool set_clipboard_text(std::string_view text) = 0;
|
||||
virtual void set_cursor_visible(bool visible) = 0;
|
||||
|
||||
@@ -101,6 +101,26 @@ public:
|
||||
#endif
|
||||
}
|
||||
|
||||
void log_stacktrace() override
|
||||
{
|
||||
#if defined(__OSX__)
|
||||
NSString* callstack = [[NSThread callStackSymbols] componentsJoinedByString:@"\n"];
|
||||
LOG("callstack:\n%s", [callstack cStringUsingEncoding:NSUTF8StringEncoding]);
|
||||
#endif
|
||||
}
|
||||
|
||||
void trigger_crash_test() override
|
||||
{
|
||||
#ifdef __IOS__
|
||||
[App::I->ios_view crash];
|
||||
#elif __OSX__
|
||||
[App::I->osx_view hockeyapp_crash];
|
||||
#elif defined(__ANDROID__)
|
||||
int *x = nullptr; *x = 42;
|
||||
LOG("%d", *x);
|
||||
#endif
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string clipboard_text() override
|
||||
{
|
||||
#if __IOS__
|
||||
|
||||
@@ -195,6 +195,15 @@ public:
|
||||
};
|
||||
}
|
||||
|
||||
void log_stacktrace() override
|
||||
{
|
||||
}
|
||||
|
||||
void trigger_crash_test() override
|
||||
{
|
||||
__debugbreak();
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string clipboard_text() override
|
||||
{
|
||||
return ::clipboard_text();
|
||||
|
||||
@@ -21,6 +21,16 @@ public:
|
||||
return storage_paths;
|
||||
}
|
||||
|
||||
void log_stacktrace() override
|
||||
{
|
||||
++stacktrace_logs;
|
||||
}
|
||||
|
||||
void trigger_crash_test() override
|
||||
{
|
||||
++crash_tests;
|
||||
}
|
||||
|
||||
[[nodiscard]] std::string clipboard_text() override
|
||||
{
|
||||
++clipboard_reads;
|
||||
@@ -177,6 +187,8 @@ public:
|
||||
int render_capture_begins = 0;
|
||||
int render_capture_ends = 0;
|
||||
int storage_prepares = 0;
|
||||
int stacktrace_logs = 0;
|
||||
int crash_tests = 0;
|
||||
int recording_delete_policy_checks = 0;
|
||||
int recording_clears = 0;
|
||||
int live_asset_reload_policy_checks = 0;
|
||||
@@ -244,6 +256,18 @@ void platform_services_dispatch_storage_path_preparation(pp::tests::Harness& har
|
||||
PP_EXPECT(harness, paths.temporary_path == "D:/Paint/tmp");
|
||||
}
|
||||
|
||||
void platform_services_dispatch_diagnostics(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("unused");
|
||||
pp::platform::PlatformServices& services = fake;
|
||||
|
||||
services.log_stacktrace();
|
||||
services.trigger_crash_test();
|
||||
|
||||
PP_EXPECT(harness, fake.stacktrace_logs == 1);
|
||||
PP_EXPECT(harness, fake.crash_tests == 1);
|
||||
}
|
||||
|
||||
void platform_services_preserve_empty_clipboard_writes(pp::tests::Harness& harness)
|
||||
{
|
||||
FakePlatformServices fake("initial");
|
||||
@@ -417,6 +441,7 @@ int main()
|
||||
{
|
||||
pp::tests::Harness harness;
|
||||
harness.run("platform services dispatch storage path preparation", platform_services_dispatch_storage_path_preparation);
|
||||
harness.run("platform services dispatch diagnostics", platform_services_dispatch_diagnostics);
|
||||
harness.run("platform services dispatch clipboard reads and writes", platform_services_dispatch_clipboard_reads_and_writes);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user