Skip to content

fix(cef): pace per-host browser creates + retry targetId resolve (shared-host burst-render)#5

Merged
wenkaifan0720 merged 1 commit into
mainfrom
fix/shared-host-burst-render
Jun 23, 2026
Merged

fix(cef): pace per-host browser creates + retry targetId resolve (shared-host burst-render)#5
wenkaifan0720 merged 1 commit into
mainfrom
fix/shared-host-burst-render

Conversation

@wenkaifan0720

Copy link
Copy Markdown
Collaborator

Problem

When many browsers are created in a burst on one shared cef_host (multiple views on one named profile — the P2 multiplex), most render blank. Reproduced live in Campus: a 7-cefWebview burst on one shared host rendered only 1 of 7; agent-driving the rest returned empty.

Root cause

Each opCreateBrowser runs a blocking CreateBrowserSync on cef_host's single CEF UI thread. A burst hands the UI thread a pile of synchronous creates that serialize and contend the one shared GPU/Viz accelerated-surface handshake — later browsers get no surface and never paint (blank), and their dependent ops (resize-to-heal, targetId resolve) wedge behind the create backlog. 2-per-host always worked; 7-at-once is where it falls over. (The create/present path is unchanged since P2-step1, so this is a pre-existing multi-browser limit, not a step2 regression.)

Fix (Swift-side, CefProfileHost)

  • Per-host create pacingcreateSendQueue + pumpCreateQueue send opCreateBrowser one at a time, spaced 0.18s, so each browser's create + surface handshake completes before the next contends the shared GPU process.
  • resolveTargetId retry — the fire-once 5s probe missed pages that committed late under burst (empty webview snapshot); re-probe every 0.5s up to ~4.5s while still pending. Sibling of the 33858fb fix in the same targetId path.

Verification

Live, firebase-dev Campus build: a 7-cefWebview burst on one shared host now renders all 7 (was 1/7).

Known follow-up (not in this PR)

Concurrent multi-tile agent-driving still has a residual: only one tile per shared host resolves a drivable CDP page target ("No page found" for the 2nd+). Rendering is fixed; the relay-multiplex page-target exposure is tracked separately.

🤖 Generated with Claude Code

…red-host burst)

A burst of opCreateBrowser on one shared cef_host handed its single CEF UI
thread a pile of blocking CreateBrowserSync calls that serialized + contended
the one shared GPU/Viz accelerated-surface handshake — later browsers got no
surface and never painted (blank tile), and their targetId resolve wedged
behind the create backlog. Two Swift-side fixes (CefProfileHost):

- Per-host create pacing: createSendQueue + pumpCreateQueue send opCreateBrowser
  one at a time, spaced 0.18s, instead of all at once — each browser's create +
  surface handshake completes before the next contends the GPU process. Verified
  live: a 7-cefWebview burst on one shared host now renders all 7 (was 1/7).

- resolveTargetId retry: the fire-once 5s probe missed pages that committed late
  under burst (empty `webview snapshot`). Re-probe every 0.5s up to ~4.5s while
  still pending — a sibling of the 33858fb fix in the same targetId path.

Render is fixed; concurrent multi-tile agent-DRIVING still has a residual relay
issue (2nd+ tile's CDP page target not found) tracked separately.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@wenkaifan0720 wenkaifan0720 merged commit bb7fc98 into main Jun 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant