Conversation
Asyncify instruments every function that might sit on the stack during a nested event loop, which roughly doubles mmapper.wasm (37 MB -> 22 MB without it) and, with it, the browser's compiled-code footprint -- the part that pushes an iPad tab over its memory limit. Without Asyncify a nested QEventLoop::exec() on wasm aborts, so every blocking call that is reachable there is converted: - QMessageBox::information/warning/critical statics -> mmqt::showInformation/ showWarning/showCritical (window_utils): a heap box with WA_DeleteOnClose shown with open(). - QMenu::exec() in the adventure, tasks and timer panels -> mmqt::popupMenu(): takes ownership of the menu and popup()s it. - MainWindow::maybeSave() takes a continuation (File > New/Open/Reload); closeEvent() keeps a blocking maybeSaveBlocking() on desktop, since it cannot be deferred, and on wasm the browser owns the tab's lifetime. - RemoteEditWidget's discard prompt is shown with open(); the close is retried from slot_cancelEdit() when the user discards. - ShaderUtils' "Message from OpenGL" box is non-blocking on wasm only. Left as they are because they are not reachable on wasm: the desktop-only QFileDialog::get* calls, main()'s fatal-GL box (the wasm prober never fails), the QOpenGLDebugLogger abort path (no KHR_debug on WebGL), and the busy-waits in AsyncTasks' destructor, TcpSocket and OpenGLProber. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01QFncyBYH55KbWPdvzvxXQw
Reviewer's GuideThe PR removes Asyncify from the wasm build to reduce binary and compiled-code memory usage, then eliminates wasm-reachable nested event loops by introducing asynchronous message-box/menu helpers and continuation-based save and discard workflows, while retaining blocking behavior for desktop-only paths. Sequence diagram for asynchronous map save continuationsequenceDiagram
participant User
participant MainWindow
participant QMessageBox
participant MapOperation
User->>MainWindow: slot_newFile()
MainWindow->>MainWindow: maybeSave(onProceed)
MainWindow->>QMessageBox: open()
QMessageBox-->>MainWindow: finished(result)
MainWindow->>MainWindow: handleMaybeSaveResult(result)
MainWindow->>MapOperation: forceNewFile()
Sequence diagram for asynchronous discard confirmationsequenceDiagram
participant User
participant RemoteEditWidget
participant QMessageBox
User->>RemoteEditWidget: closeEvent(event)
RemoteEditWidget->>RemoteEditWidget: slot_contentsChanged()
RemoteEditWidget->>RemoteEditWidget: promptDiscardChanges()
RemoteEditWidget->>QMessageBox: open()
QMessageBox-->>RemoteEditWidget: finished(result)
alt result is Discard
RemoteEditWidget->>RemoteEditWidget: slot_cancelEdit()
else result is Cancel
RemoteEditWidget-->>User: Keep editor open
end
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
3 of 4 tasks
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## master #552 +/- ##
==========================================
- Coverage 25.08% 25.06% -0.03%
==========================================
Files 528 528
Lines 44211 44249 +38
Branches 4794 4790 -4
==========================================
Hits 11092 11092
- Misses 33119 33157 +38 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Asyncify instruments every function that might sit on the stack during a
nested event loop, which roughly doubles mmapper.wasm (37 MB -> 22 MB
without it) and, with it, the browser's compiled-code footprint -- the
part that pushes an iPad tab over its memory limit. Without Asyncify a
nested QEventLoop::exec() on wasm aborts, so every blocking call that is
reachable there is converted:
showWarning/showCritical (window_utils): a heap box with
WA_DeleteOnClose shown with open().
mmqt::popupMenu(): takes ownership of the menu and popup()s it.
closeEvent() keeps a blocking maybeSaveBlocking() on desktop, since it
cannot be deferred, and on wasm the browser owns the tab's lifetime.
retried from slot_cancelEdit() when the user discards.
Left as they are because they are not reachable on wasm: the desktop-only
QFileDialog::get* calls, main()'s fatal-GL box (the wasm prober never
fails), the QOpenGLDebugLogger abort path (no KHR_debug on WebGL), and
the busy-waits in AsyncTasks' destructor, TcpSocket and OpenGLProber.
Verified in headless Chromium: the web build loads, loads the map, survives click/drag/zoom, opens Find Rooms/Preferences, and the console has no "exec() is not supported" or abort lines. Desktop: build, 14 tests, clang-format.
🤖 Generated with Claude Code
https://claude.ai/code/session_01QFncyBYH55KbWPdvzvxXQw
Summary by Sourcery
Build WebAssembly without Asyncify while converting reachable blocking UI flows to non-blocking behavior.
Bug Fixes:
Enhancements:
Build:
Tests: