-
Notifications
You must be signed in to change notification settings - Fork 6k
Stopped calling 'ExternalViewEmbedder::EndFrame' when pipeline is empty #31546
Conversation
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking at the issue, should we just fix it on the android side? It seems to be an issue with the android EndFrame implementation, rather than an issue with calling EndFrame.
The doc of EndFrame says:
// This method provides the embedder a way to do additional tasks after
// |SubmitFrame|. For example, merge task runners if `should_resubmit_frame`
// is true.
So EndFrame is pretty general, the invocation of EndFrame shouldn't depend on the value of the layer_tree. Rendering (or not rendering) an empty layer tree is still a frame.
This is currently hard for implementers to know this when implementing EndFrame. To make it better, maybe we can think of a way for the implementers to be aware of this. Maybe through documentation and tests to prevent future mistakes.
|
@cyanglaz Then let's take a look at the call stacks of following scenarios.
From the above scenarios, It seems that Calling |
|
@ColdPaleLight Ok, sounds good to me. |
cyanglaz
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. please wait until @dnfield's comment to be resolved before merging.
|
Another way to fix this issue is to pass I think conditionally calling methods like this can be harder to reason about a few years from now. I'd definitely prefer something more explicit. |
|
@blasten For this scene of the empty layer tree, I think we should do the same thing as the scene where Rasterizer::surface_ does not exist. Because in this scenario, the Rasterizer::Draw method actually does nothing except call EndFrame. I think the current implementation itself is incorrect. |
|
@ColdPaleLight actually, looking at the pattern when |
If we are sure that BeginFrame and EndFrame should be paired. Maybe we can set a flag when BeginFrame is called, and then only call EndFrame when this flag is set. |
Yes, that's what the pattern you listed tells me and that's what I think we should do. |
|
Yes I have approved this PR from my end! ;) |
dnfield
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
When the layer tree pipeline is empty, we should early return with
RasterStatus::kFailedand should not callExternalViewEmbedder::EndFrame, otherwise there will be side effects.fix issue: flutter/flutter#98824
Pre-launch Checklist
writing and running engine tests.
///).