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

Conversation

@flar
Copy link
Contributor

@flar flar commented Sep 5, 2024

Fixes flutter/flutter#144070

There is a mechanism by which you can access a DisplayListBuilder as if it were a DlOpReceiver for dispatching one DisplayList into another.

This mechanism also resembles the legacy way in which one would write graphics snippets prior to the creation of the DlCanvas interface and so we have dozens of old unit tests which were written to test the Builder class by filling it with commands in the Receiver/Dispatcher format. This type of access is obsolete and maintaining the ability for arbitrary code to talk to a Builder in that manner is getting in the way of future work.

This PR rewrites over 100 of such unit tests to use the standard DlCanvas-style interface to record operations into a Builder, leaving only a dozen or so cases of internal state tests that still inject ops directly to test the internal state keeping.

Copy link
Contributor

@jonahwilliams jonahwilliams left a comment

Choose a reason for hiding this comment

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

LGTM!

Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

Nice, can we hide that API? maybe only give it access to a friend?

@flar
Copy link
Contributor Author

flar commented Sep 5, 2024

Nice, can we hide that API? maybe only give it access to a friend?

It is already only accessible via friend and has been for some time - that's what the deleted ToReceiver() calls did (dug out a reference via a friend accessor). The couple of remaining uses are fairly esoteric and revolve around "make sure every type of record can be recorded without overwriting each other and undergo Equals comparison correctly".

It's just that we had 100+ unit tests written from before DlCanvas existed and which were using it because of "laziness" rather than "necessity". I was having to modify them all when I edited DlOpReceiver to use DL/Impeller objects and asked myself why I was updating them rather than moving them to DlBuilder/Canvas. Some of that work is just being punted down the road here because I will eventually de-skia-fy DlCanvas anyway, but in that case I will be doing it incrementally - DlOpReceiver I want to just do in one fell swoop.

@flar flar added the autosubmit Merge PR when tree becomes green via auto submit App label Sep 5, 2024
@auto-submit auto-submit bot merged commit e042ff5 into flutter:main Sep 5, 2024
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Sep 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

DisplayList unit tests should avoid using the private DlOpReceiver interface

3 participants