[WIP] Refactor InfiniFrame.Native#267
Conversation
- Introduced InfiniFrameNativeStatusCode enum to represent native call status - Updated InfiniFrameNative methods to return status codes instead of void - Added EnsureSucceeded method to handle error checking and throw exceptions with detailed messages - Modified InvokeUtilities to use status codes in callbacks - Updated MonitorsUtility and InfiniFrameWindow to handle status codes and ensure proper error handling - Added tests for native export guards to validate error handling and status codes - Divide Exports to logical code-zones - Update clang and testing utilities - Add native_quality.sh for QA CI - Update CMakeLists for new native structure - Create & Update Interop layer
|
It will be a big headache |
|
@AnnaSasDev sorry i am busy at these days. I'll continue my work as soon as I have a day-off |
@freakdaniel no worries, I will continue work on other items then, but that will most likely mean I will have to touch the native layer a bit more when trying to resolve some of the Photino Backlog. Meaning it will cause some merge issues that will need to be resolved. |
Set InfiniFrameNativeTestExports to true by default when Configuration is Debug and the property is not explicitly provided, so CMakeBuildTestExports becomes ON for Debug builds. Added a comment and preserved the existing fallback to false for non-Debug or explicitly unset cases.
…dows - Implemented retry logic with delays in `FocusedTests` to handle cases where the window focus isn't acquired immediately. - Added fallback activation paths in `InfiniFrameWindow::SetFocused` for restricted foreground activation scenarios. - Updated `GetFocused` to include additional checks for active, foreground, and child windows.
…ss-thread invoke readiness - Consolidated branching in `CreateUtility` to reduce complexity in thread creation logic. - Ensured `messageLoopReady` signaling to improve stability and reliability of cross-thread window operations. - Updated `TemporaryFilesPath` to include unique subdirectories using `Guid.NewGuid`.
…ecific notifications and tests - Added checks for Windows OS in relevant tests and methods to ensure platform compatibility. - Improved thread safety with `RunOnStaThread` for Windows-only test logic in `InfiniFrameBlazorAppBuilderTests`. - Fixed missing initialization checks for `_toastHandler` in `Notifications.WinToast`. - Removed redundant `InitializeNotifications` call from `Window.cpp`.
…veStatusCode` enum
…ehavior - Updated window functionality tests (`SizeTests`, `WidthTests`, `HeightTests`, `LocationTests`, `TopTests`, `LeftTests`) to set `TemporaryFilesPath` to `null`. - Prevents test failures caused by inconsistent GUID behavior during parameter setup.
|
@freakdaniel Merged |
|
No worries at work and other irl stuff having priority. |
Summary
Major refactoring of the InfiniFrame.Native interop layer to address issue #260. PR introduces a status-code-based error propagation model, modularizes platform-specific code into focused components, establishes native CI quality gates, and centralizes memory ownership contracts. The monolithic Exports.cpp and platform window files are split into logical modules with consistent precondition guards
Type of Change
Affected Modules / Scope
Changes Introduced
Interop Layer Redesign
InfiniFrameNativeStatusCodeenum for consistent native call status reportingNativeResult.hwithEnsureSucceeded()method for error checking and detailed exception messagesNativeString.handNativeBuffer.hto centralize string/buffer ownership contractsInitParamsReader.hfor validated init parameter parsingExportApi.hwith shared export declarationsExport Modularization
Exports.cpp- main entry/exit with guardsExports.Browser.cpp- browser operations (navigation, web messaging, notifications, custom schemes)Exports.Dialog.cpp- dialog operationsExports.Events.cpp- event callbacks (monitors, closing, focus, moved, resized, invoke)Exports.Lifecycle.cpp- window lifecycle (ctor/dtor/close)Exports.Memory.cpp- memory operations (FreeString, FreeStringArray)Exports.Platform.cpp- platform-specific APIsExports.WindowCommands.cpp- window commands (center, restore, minimize, maximize, etc.)Platform Modularization
Window.cppintoWindowProc.Win32.cpp/h,WebView2Host.Win32.cpp,WebView2CustomSchemes.Win32.cpp/h,WebView2Messaging.Win32.cpp,WebView2ResourceRequests.Win32.cpp,WebView2Settings.Win32.cpp,WebView2Bridge.Win32.cpp,Monitors.Win32.cpp,Notifications.WinToast.cpp,UiDispatcher.Win32.cpp,WindowImpl.Win32.hWindow.cppintoWebKitBridge.Gtk.cpp,WebKitCustomSchemes.Gtk.cpp,WebKitMessaging.Gtk.cpp/h,WebKitSettings.Gtk.cpp,Monitors.Gtk.cpp,Notifications.LibNotify.cpp,UiDispatcher.Gtk.cpp,WindowState.Gtk.cpp,WindowImpl.Gtk.hWKWebViewBridge.Cocoa.mm,WKWebViewSettings.Cocoa.mm,WKCustomSchemes.Cocoa.mm,WKJsInterop.Cocoa.mm,Monitors.Cocoa.mm,Notifications.UserNotifications.Cocoa.mm,UiDispatcher.Cocoa.mm,WindowState.Cocoa.mm,WindowImpl.Cocoa.hError Handling Improvements
exit(0)paths in window construction with error propagation viaEnsureSucceeded()InvokeUtilitiesandMonitorsUtilityto use status codes in callbacksInfiniFrameWindowto handle status codes and ensure proper error propagationTest Infrastructure
Exports.Tests.cpp) now behindINFINIFRAME_BUILD_TEST_EXPORTScmake optionInfiniFrameNativeExportGuardTests.csto validate error handling and status codesInfiniFrameNativeTestExports=truefor test buildsCI Quality Gates
native_quality.shscript with clang-format, clang-tidy, and sanitizer build modesShared Components
CustomSchemeResponse.hfor cross-platform custom scheme response handlingInfiniWindowExtensions.csFluent API with status code supportInfiniFrameNative.csto return status codesInfiniFrameNativeStatusCode.csenumRelated Issues
exit(0)on errorsChecklist