Repository navigation
fix(window): stop a covered window drawing after a phone stream, and keep a streamed foreground tab live - #26657
Conversation
…e is released Restoring background throttling only clears Electron's disable_hidden flag; the occlusion or minimize hide swallowed while the lease was held is never replayed, so a covered window kept compositing at ~60 rAF/s until the next cover cycle. After the last release, a discarded empty-rect stayHidden capturePage makes Chromium's capturer-count decrement re-apply the current visibility, so the pending hide lands without the page ever reporting visible. Skipped for a focused renderer, best-effort and never awaited. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…ng it Drops the synchronous try/catch around the stayHidden capture so a missing capturePage fails loudly; only the promise rejection is swallowed. Test doubles that reach a final lease release now provide capturePage. Keeps the focused-window skip (a covered window loses focus) and the empty rect. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…n the stream ends When the streamed tab is the foreground desktop tab, the guest's own widget is what a cover hides, and lifting the window throttle does not reach it, so the phone froze after one or two frames. The page stream now re-applies the guest's setBackgroundThrottling(false) at start and on the window's hide/minimize while live. At stream end it drops those listeners, re-throttles the guest and replays its swallowed hide with the same stayHidden capture the window lease uses (now exported as replaySwallowedHide), so the guest stops painting. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
…tle lease The page stream now takes a rendererPublicationThrottle lease on the guest instead of a bespoke guest-paint helper. The start unthrottle sets the guest widget's disable_hidden flag (copied onto new widgets), so the window hide/minimize re-apply listeners were no-ops and are gone. The guest gets the lease's end-of-stream re-throttle and stayHidden re-hide, including the focus skip, which holds for a guest because its isFocused requires the embedder's window to be key and its root view focused. Claude-Session: https://claude.ai/code/session_01JNnE9qzUZMMnqpZWCqM3nb
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 5 remain after this review. 📝 WalkthroughWalkthroughThe renderer publication throttle now supports focus checks and hidden page captures after the final lease ends. Screencast streams acquire a throttle lease for the guest web contents and release it when the stream ends. Tests cover lease sharing, guest destruction, capture behavior, and updated runtime test doubles. Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to Closing a streamed guest triggers debugger detachment and lease cleanup. No concrete user-impacting issue remains that warrants delaying the PR. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Follow-up to #26284.
Problem
setBackgroundThrottling(true), but in Electron that only clears the "don't hide" flag. It never replays the hide that was swallowed while the lease was held, and Chromium's visibility update skips an unchanged visibility.Fix
setBackgroundThrottling(true), the lease takes a hidden capture:capturePagewith an empty rect and{ stayHidden: true }. When the capture completes, Chromium re-applies the current visibility, so the swallowed hide lands.isFocusedrequires the (embedder's) window to be key, and a cover takes that away, so a focused target has nothing to replay. This also avoids a full-view readback on ordinary releases while the user is working.No new lifecycle state and no wire change. It's desktop-only.
Verification
Measured on real macOS hardware with the window actually shown, against a no-stream baseline, interleaved:
visible, never showed or focused the window, and later streams worked. Phone-created terminals and phone tab close while covered leave no leftover drawing.