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

Conversation

blasten
Copy link

@blasten blasten commented Jun 1, 2020

This PR refactors the ExternalViewEmbedder interface, such that SubmitFrame takes a SurfaceFrame instead of just the surface's SkCanvas. As the name implies, SubmitFrame should be responsible for submitting the frame.

After taking this direction, I realized that FinishFrame can be removed, since the use case (submitting CATransitions) be handled in SubmitFrame.

This is required for hybrid composition on Android.

Fixes flutter/flutter#58286

@blasten blasten marked this pull request as ready for review June 1, 2020 19:36
@auto-assign auto-assign bot requested a review from cbracken June 1, 2020 19:37
Copy link
Member

@chinmaygarde chinmaygarde left a comment

Choose a reason for hiding this comment

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

Other than the use-after-move in the assertion, looks good.

external_view_embedder->FinishFrame();
std::move(frame));
// The frame must be submitted at this point.
FML_DCHECK(frame->IsSubmitted());
Copy link
Member

Choose a reason for hiding this comment

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

This is a use after move. This check is passing because of undefined behavior.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

SurfaceFrame::SurfaceFrame(sk_sp<SkSurface> surface,
bool supports_readback,
const SubmitCallback& submit_callback)
: submitted_(false),
Copy link
Member

Choose a reason for hiding this comment

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

Initialize these in the header please. That way, if/when new ctors are added, they don't all have to remember to initialize all ivars.

Copy link
Member

Choose a reason for hiding this comment

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

I see you just moved this TU. I bet this is an old TU. I'd recommend updating it nonetheless.

Copy link
Author

Choose a reason for hiding this comment

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

Done.

@@ -141,6 +142,18 @@ source_set("common") {
public_configs = [ "//flutter:config" ]
}

source_set("surface_frame") {
Copy link
Member

Choose a reason for hiding this comment

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

Why is this in its own target? The only place this is being included (flow) also includes common.

Copy link
Author

Choose a reason for hiding this comment

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

To workaround a circular dependency. :common depends on //flutter/flow, but //flutter/flow depends on :surface_frame.

@blasten blasten requested a review from chinmaygarde June 1, 2020 21:10
@blasten blasten force-pushed the refactor_external_view_embedder branch from f2be027 to 0fc6235 Compare June 2, 2020 04:10
@blasten blasten merged commit 243bb59 into flutter:master Jun 3, 2020
@blasten blasten deleted the refactor_external_view_embedder branch June 3, 2020 04:59
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 3, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 4, 2020
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Jun 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

SubmitFrame() should take the root surface frame instead of the Skia canvas
3 participants