Skip to content

[web] Fix multi-view sizing race condition (State isolation approach) - #185624

Closed
mdebbar wants to merge 1 commit into
flutter:masterfrom
mdebbar:multiview_isolation
Closed

mdebbar wants to merge 1 commit into
flutter:masterfrom
mdebbar:multiview_isolation

Conversation

@mdebbar

@mdebbar mdebbar commented Apr 27, 2026 •

Copy link
Copy Markdown
Contributor

Summary

This PR resolves the multi-view sizing regression reported in #185034. The issue stemmed from multiple views sharing a single OffscreenSurface instance. Concurrent or interleaved rendering calls would cause the surface to be resized for one view while another view was still expecting its own dimensions.

Design

This approach isolates the rendering state by giving every OffscreenCanvasViewRasterizer its own dedicated OffscreenSurface. By moving the surface ownership from the Rasterizer (singleton-like) to the ViewRasterizer (per-view), we eliminate contention and the possibility of cross-view interference.

Pros:

  • Better performance as views do not need to wait for each other to render.
  • Architecturally cleaner state management for multi-view.

Cons/Risks:

  • Increased memory usage per view.
  • Risk of hitting browser WebGL context limits if the user opens a large number of views (e.g., >10).

Testing

  • Verified via new test engine/src/flutter/lib/web_ui/test/ui/multi_view_sizing_test.dart.

@mdebbar mdebbar added the CICD Run CI/CD label Apr 27, 2026
@github-actions github-actions Bot added engine flutter/engine related. See also e: labels. platform-web Web applications specifically labels Apr 27, 2026
@Piinks

Piinks commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Greetings from stale PR triage! 👋
Is this change still on your radar?

@mdebbar mdebbar closed this Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CICD Run CI/CD engine flutter/engine related. See also e: labels. platform-web Web applications specifically

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants