webview (macOS): App Nap exemption so background/occluded UIs stay live - #4
Open
turinglambdaai wants to merge 1 commit into
Open
turinglambdaai wants to merge 1 commit into
turinglambdaai wants to merge 1 commit into
Conversation
macOS throttles/suspends 'idle' apps whose windows are fully occluded. For monitoring-style Glaze UIs (live charts, streaming logs, dashboards) that means the page's timers and rendering freeze as soon as another window covers the app — the backend keeps serving, the UI goes stale. ensure-app! now declares NSActivityUserInitiated via [NSProcessInfo beginActivityWithOptions:] once per process. A Glaze app with an open window is by definition user-initiated work, so the token is intentionally never ended. Failure to acquire the activity is non-fatal (best effort). Note: this removes the process-level suspension component. WebKit may still apply its own page-visibility throttling in some macOS versions; that behavior, if observed, is a documented platform limitation rather than an App Nap effect. glaze-test: 216 passed (includes the macOS WebView e2e suite). Fixes #2
Owner
Author
|
CI 说明: |
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.
Fixes #2
改动
ensure-app!(每个进程一次)里通过[NSProcessInfo beginActivityWithOptions:]声明NSActivityUserInitiated(0x00FFFFFF),token 永不释放——开着窗口的 Glaze 应用按定义就是用户发起的工作。获取失败为非致命(best effort)。动机
macOS 会对窗口被完全遮挡的"空闲"应用做节流/挂起。监测类 UI(实时曲线、日志尾随、数据流视图)在窗口被盖住的一刻页面定时器与渲染冻结——后端仍在服务(curl 可见事件流),前端却停止刷新,用户感知为"应用坏了"。进程级 App Nap 豁免是 Electron 等框架对监测类应用的同款反制。
边界说明
本 PR 消除的是进程级挂起分量。WebKit 自身基于页面可见性的节流在不同 macOS 版本上的表现需要实测观察;若仍能观察到,那属于 WebKit 页面可见性行为,应作为平台限制文档化,而不是 App Nap 效应。
验证
raco test glaze-test/:216 通过(含 macOS WebView e2e:open/load/capture/navigate/close/on-close)