Repository navigation
fix(runtime): treat a WinUI host as a XAML host everywhere - #59
Merged
Merged
Conversation
needs_win32_pump() was true under WinUI 3 as well (the runtime makes its own DispatcherQueueController there, since WinUI's dispatcher isn't a Windows.System.DispatcherQueue), so code keyed on it acted as if there were no XAML host: - defer_microtask_drain never deferred: JS delegates, rAF callbacks and the other native-to-JS entry points drained Promise continuations inline, inside XAML callouts such as the render walk (the 0xC000027B fail-fast the deferral exists to prevent) - __nsWorkerPushesMessages was false: every worker.postMessage blocked the UI thread polling for replies (up to 100 x 5 ms), though replies are posted to the UI thread's dispatcher, which XAML's loop runs needs_win32_pump() is now false when host_pumps_messages(), so all of these follow from one definition, and runtime_pump_timers needs no separate check.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to #58.
Problem
Under WinUI 3,
needs_win32_pump()was true too. The runtime makes its ownDispatcherQueueControllerthere, because WinUI's dispatcher isn't aWindows.System.DispatcherQueue. So code keyed onneeds_win32_pump()behaved as if there were no XAML host:defer_microtask_drainnever deferred. JS delegates,requestAnimationFramecallbacks and the other native-to-JS entry points drained Promise continuations inline. That includes running them inside XAML callouts such as the render walk, which is the 0xC000027B fail-fast the deferral exists to prevent.__nsWorkerPushesMessageswas false. Everyworker.postMessageblocked the UI thread polling for replies (up to 100 × 5 ms). Replies are posted to the UI thread's dispatcher, which XAML's loop runs anyway.Fix
needs_win32_pump()is now false whenhost_pumps_messages()is true. All of the above follow from that one definition, andruntime_pump_timersno longer needs its separate check from #58.Testing
release-with-devtools, together with fix(runtime): pick between same-arity overloads by argument type #60, in a WinUI 3 game that renders every frame (pixi.js on WebGPU). The menu renders, play joins the server, the game runs, and closing the window ends the process.