Repository navigation
Conversation
This was referenced Oct 22, 2026
yexuan910812
pushed a commit
to yexuan910812/flutter
that referenced
this pull request
Oct 30, 2026
…188628) Related: flutter#187660. Part 1 of 5 from the original hybrid-rasterizer change. This PR is now limited to the independent benchmark instrumentation. Adds `presentation_duration` around preparation and frame submission, including asynchronous raster work, and records it in the web benchmark harness. The timer stops before reporting, and benchmark listeners are cleaned up even when startup fails. The existing profile JSON schema is unchanged. Verified locally: two engine timing tests cover enabled/disabled profiling and delayed preparation/rasterization; a browser regression test covers listener cleanup after synchronous startup failures. Static analysis and formatting pass. This change is independent of the hybrid rasterizer. The remaining pieces are separate drafts: - flutter#195103: native callback IDs and optional bitmap capture. - flutter#195104: platform-view DOM commit after rasterization. - flutter#195105: opt-in hybrid presentation, depending on the two changes above. - flutter#195106: desktop default policy and benchmark results, depending on the opt-in implementation. The duplicate semaphore and codec changes were dropped on rebase because master already includes flutter#194139 and flutter#193187. ## Pre-launch Checklist - [ ] I read the [Contributor Guide] and followed the process outlined there for submitting PRs. - [ ] I read the [AI contribution guidelines] and understand my responsibilities, or I am not using AI tools. - [ ] I read the [Tree Hygiene] wiki page, which explains my responsibilities. - [ ] I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement]. - [ ] I signed the [CLA]. - [ ] I listed at least one issue that this PR fixes in the description above. - [ ] I updated/added relevant in-code documentation (doc comments with `///`). - [ ] If this PR introduces a new feature or capability, I created and linked a website documentation issue or PR in [flutter/website] (or verified none is needed). - [ ] I added new tests to check the change I am making, or this PR is [test-exempt]. - [ ] I followed the [breaking change policy] and added [Data Driven Fixes] where supported. - [ ] All existing and new tests are passing. If you need help, consider asking for advice on the #hackers-new channel on [Discord]. If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance. **Note**: The Flutter team is currently trialing the use of [Gemini Code Assist for GitHub](https://developers.google.com/gemini-code-assist/docs/review-github-code). Comments from the `gemini-code-assist` bot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed. <!-- Links --> [Contributor Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#overview [AI contribution guidelines]: https://github.com/flutter/flutter/blob/main/CONTRIBUTING.ai.md [Tree Hygiene]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md [test-exempt]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#tests [Flutter Style Guide]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md [Features we expect every widget to implement]: https://github.com/flutter/flutter/blob/main/docs/contributing/Style-guide-for-Flutter-repo.md#features-we-expect-every-widget-to-implement [CLA]: https://cla.developers.google.com/ [flutter/tests]: https://github.com/flutter/tests [flutter/website]: https://github.com/flutter/website [breaking change policy]: https://github.com/flutter/flutter/blob/main/docs/contributing/Tree-hygiene.md#handling-breaking-changes [Discord]: https://github.com/flutter/flutter/blob/main/docs/contributing/Chat.md [Data Driven Fixes]: https://github.com/flutter/flutter/blob/main/docs/contributing/Data-driven-Fixes.md
Zero marks an unset context-loss callback. Skip it when the shared uint32_t callback sequence wraps so context-loss notifications remain registered.
Keep canvases alive until pending rasterization finishes and clean up partially prepared frames. Handle platform-view removal during rasterization and keep staged presentation hooks with the hybrid rasterizer.
Merge current master while preserving disposed-frame cancellation and timing guards. Pass each queued render size through the rasterizer and update the platform-view regression helper for the required size argument.
Integrate upstream render sizes and deferred platform-view publication. Verify placeholder pixels independently of animation callbacks, clear stale readback pixels, and release GPU resources in their owning contexts. Dispatch context-loss notifications without dereferencing a disposed surface. Add regression coverage for unavailable placeholders, delayed animation callbacks, context disposal, and explicit DPR in platform-view coordinate tests.
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.
Related: #187660. Part 4 of 5, split from #188628. Depends on #195103 and #195104; this draft includes those prerequisite commits. The hybrid implementation is e0773adebdaa. It stays draft until the prerequisites land and the matching engine prebuilts are available.
With
skwasmUseHybridRasterizer: true, stable single-canvas scenes use a transferred onscreen canvas; multi-canvas compositions use bitmap export. A separate export surface preserves the visible frame during exit, and entry checks the placeholder against an independently exported frame. Unset configuration keeps bitmap rendering on every platform.Offscreen and onscreen Skwasm surfaces have separate typed implementations over a shared lifecycle. Context-recovery errors reach pending render operations; continuous resize and unavailable 2D contexts retain bitmap presentation. The semaphore and codec implementations already covered by #194139 and #193187 are omitted.
Verified locally with the prerequisites: transition, resize, context-loss, callback, image and shader regressions across Chrome, Safari, Firefox and Wimp in ST/MT, with two known Wimp shader skips (#175431). Actual-display recordings cover 288 directional transitions with no invalid, missing or regressing scene frames. Five of six configurations passed the 60 Hz clock calibration; Safari MT retained all scene frames but its clock calibration remains inconclusive.
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.
If this change needs to override an active code freeze, provide a comment explaining why. The code freeze workflow can be overridden by code reviewers. See pinned issues for any active code freezes with guidance.
Note: The Flutter team is currently trialing the use of Gemini Code Assist for GitHub. Comments from the
gemini-code-assistbot should not be taken as authoritative feedback from the Flutter team. If you find its comments useful you can update your code accordingly, but if you are unsure or disagree with the feedback, please feel free to wait for a Flutter team member's review for guidance on which automated comments should be addressed.