Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Conversation

@harryterkelsen
Copy link
Contributor

Only have one additional queued frame. If more than one frame is requested while the current frame is rendering, only the last frame is queued.

Fixes flutter/flutter#140981

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or the PR is test-exempt. See testing the engine for instructions on writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

Only have one additional queued frame. If more than one frame is
requested while the current frame is rendering, only the last frame
is queued.
@github-actions github-actions bot added the platform-web Code specifically for the web engine label Jan 25, 2024
@harryterkelsen harryterkelsen changed the title [web] Only render one frame at a time. [CanvasKit] Only render one frame at a time. Jan 29, 2024
@harryterkelsen harryterkelsen marked this pull request as ready for review January 29, 2024 22:40
ui.Scene scene,
ui.FlutterView view,
Completer<void> completer
})? _nextRender;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the record definition be moved into a typedef? Not only would that dedupe the definitions, but it would also allow the record structure to be documented. Example.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ooo! Records

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

if (_currentRender != null) {
// If a scene is already queued up, drop it and queue this one up instead
// so that the scene view always displays the most recently requested scene.
_nextRender?.completer.complete();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this break multi-view? The framework may render multiple Scene objects into different views, all in the same frame (e.g. every view contains an animation). That would queue up multiple renders in the same frame.

If this is indeed an issue, we could store the currentRender and nextRender on the FlutterView object instead (or on the ViewRasterizer). This way, every view has its own queue that doesn't interfere with other views.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch. I'll make the queues per-view and add a test.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done.

Copy link
Contributor

@eyebrowsoffire eyebrowsoffire left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@harryterkelsen
Copy link
Contributor Author

Thanks! PTAL @yjbanov

CkParagraphBuilder(style);

final Map<ui.FlutterView, _RenderQueue> _renderQueues =
<ui.FlutterView, _RenderQueue>{};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there an advantage in putting the _RenderQueue in a map, compared to making it a field on ViewRasterizer (or FlutterView)? It seems the map requires that we handle more states than we need. For example, when nothing is rendering we can express it as _RenderQueue.current == null, but Map can also be in _renderQueues.contains(view) == false state, which also means the same thing. We also need to remember to remove the view after it's been disposed of (in fact, I don't see any code that does that).

This comment is non-blocking. Just trying to see if we can simplify it a bit.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good idea. This simplifies things quite a bit and lets us get away with not storing the view in the render request anymore, since it is already known by the view rasterizer.

@harryterkelsen harryterkelsen merged commit 2b61010 into flutter:main Jan 31, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jan 31, 2024
auto-submit bot pushed a commit to flutter/flutter that referenced this pull request Feb 1, 2024
…142662)

flutter/engine@c83617e...c4247c5

2024-01-31 [email protected] Make screen reader announcement append a non-breaking space every other message. (flutter/engine#50151)
2024-01-31 [email protected] Roll Skia from 0ad5b2a9cebd to 19e5e8f089b2 (3 revisions) (flutter/engine#50214)
2024-01-31 [email protected] [CanvasKit] Only render one frame at a time. (flutter/engine#50055)

If this roll has caused a breakage, revert this CL and stop the roller
using the controls here:
https://autoroll.skia.org/r/flutter-engine-flutter-autoroll
Please CC [email protected],[email protected],[email protected] on the revert to ensure that a human
is aware of the problem.

To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

platform-web Code specifically for the web engine

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Web app with multiple platform views overlayed with Flutter widgets failing on Firefox

4 participants