fix(osr): re-assert last-known visibility after browser bind#15
Merged
Conversation
Under a create burst, a setVisible edge issued before the browser binds (recorded as intent only) or lost/mis-ordered could leave a slot latched hidden while on-screen — a permanently blank tile — because cef_host gates every frame on slot->visible and never reconciles it after establishment. CefWebController now tracks the last requested visibility and re-asserts it once the browser binds (in _createSession, after channel re-registration), but ONLY when it was explicitly set: a never-set slot keeps CEF's default-shown, so a fresh/recovered off-screen slot isn't force-repainted (no 60fps off-screen pump). The hidden->visible edge repaints the latched tile; a matching state is a no-op. Pairs with a consumer-side direct visibility drive in work_canvas's agent_ui tile (whose 5-hop InheritedNotifier visibility path could drop the edge). Adds a unit test pinning re-assert-when-set / no-re-assert-when-unset. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Problem
Under a startup burst of many browser creates, one browser could end up established but permanently blank on-screen.
cef_hostgates every frame onslot->visibleand never reconciles that flag against reality after establishment — so asetVisibleedge that races the browser bind (recorded as intent only,browser==null) or is lost/mis-ordered can latch a slot hidden while the tile is on-screen. The native first-present watchdog (DoInvalidate) can't rescue it, because aWasHidden(true)browser's compositor is idled — noInvalidate/BeginFrameproduces a frame. Which tile loses is timing-dependent, so a different tile goes blank each launch.Fix
CefWebControllernow tracks the last requested visibility and re-asserts it once the browser binds (in_createSession, after channel re-registration) — replaying an edge that landed before bind or was lost under the burst. Thefalse→truere-assert hits the nativeDoSetVisibleedge and repaints the latched tile.Gated on an explicit-set flag: a slot whose visibility was never set keeps CEF's default-shown, so a fresh/recovered off-screen slot isn't force-repainted (which would pump it at 60fps until its cull edge lands). A matching state is a no-op.
Pairs with a consumer-side change in work_canvas's
agent_uitile, which drives the session's visibility directly (its 5-hopInheritedNotifierpath could drop the edge). The direct-drive ensures the correct value is what gets re-asserted; the re-assert here is the generic backstop for all consumers (before-bind window). Both are needed — one closes the before-bind window, the other the after-bind window.Test
Adds
create re-asserts last-known visibility only when explicitly set— pins that an explicitsetVisible(false)/(true)is replayed aftercreate(), and a never-set slot is not (the off-screen guard). Full suite green (+59).Validation
Validated in a consuming app (work_canvas firebase-dev) across 8 relaunches with 16+ CEF tiles: the previously-blank agent_ui tile renders every launch, zero wedges (baseline was ~1 blank tile per launch).
🤖 Generated with Claude Code