-
Notifications
You must be signed in to change notification settings - Fork 6k
PlatformViewsController: clear composition_order_ in the beginning of each frame. #22574
Conversation
|
|
||
| void FlutterPlatformViewsController::SetFrameSize(SkISize frame_size) { | ||
| void FlutterPlatformViewsController::BeginFrame(SkISize frame_size) { | ||
| composition_order_.clear(); |
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.
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.
could we also have a unit test for this?
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.
could we make aReset() method, similar to Android? Why not also clearing picture_recorders_?
| - (CVPixelBufferRef)pixelBuffer | ||
| { | ||
| NSDictionary *options = @{ | ||
| (NSString*)kCVPixelBufferCGImageCompatibilityKey : @YES, |
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.
do you mind adding some comments explaining why this is all needed?
|
|
||
| @override | ||
| void onBeginFrame(Duration duration) { | ||
| print('begin frame'); |
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.
is this intentional?
| print('begin frame'); | ||
| final SceneBuilder builder = SceneBuilder(); | ||
|
|
||
| builder.pushOffset(0, 0); |
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.
nit: this is a noop
| } | ||
| } | ||
|
|
||
| /// A simple platform view for testing platform view with a continuous texture layer. |
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.
what does continuous texture mean? Does it mean a texture that simulates a video being played?
|
@blasten updated per comments. PTAL |
|
Folks, since this is a regression, let's try to get it in today to see whether we can land it internally by end of the week. It will be tight if at all possible. |
| std::make_unique<flutter::EmbeddedViewParams>(finalMatrix, SkSize::Make(300, 300), stack); | ||
| flutterPlatformViewsController->PrerollCompositeEmbeddedView(0, std::move(embeddedViewParams1)); | ||
| flutterPlatformViewsController->CompositeEmbeddedView(0); | ||
| XCTAssertEqual(flutterPlatformViewsController->GetCurrentCanvases().size(), (unsigned long)1); |
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.
does 1UL work here?
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.
yes, updated
| flutterPlatformViewsController->CompositeEmbeddedView(0); | ||
| XCTAssertEqual(flutterPlatformViewsController->GetCurrentCanvases().size(), (unsigned long)1); | ||
|
|
||
| flutterPlatformViewsController->Reset(); |
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.
Is this needed?
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.
no, removed
|
|
||
| // Second frame, |GetCurrentCanvases| should be empty at the start | ||
| flutterPlatformViewsController->BeginFrame(SkISize::Make(300, 300)); | ||
| XCTAssertEqual(flutterPlatformViewsController->GetCurrentCanvases().size(), (unsigned long)0); |
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.
nit: XCTAssertTrue(flutterPlatformViewsController->GetCurrentCanvases().empty())
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.
done!
|
|
||
| CGContextDrawImage(context, CGRectMake(0, 0, width, height), self.image.CGImage); | ||
| CGColorSpaceRelease(rgbColorSpace); | ||
| CGContextRelease(context); |
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.
What parts of this method are essential to test and why?
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.
This is not required. removed.
blasten
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
iskakaushik
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
…nning of each frame. (flutter/engine#22574)
…nning of each frame. (flutter/engine#22574)
… each frame. (#22574) (#22762) Co-authored-by: Chris Yang <[email protected]>
* PlatformViewsController: clear composition_order_ in the beginning of each frame. (#22574)
Description
We used to clear composition_order_ in the end of the frame. This caused an issue with a frame drawn by drawLastlayerTree, because the endFrame is not called in such a frame. This causes a crash where a texture layer is constantly updating on top of a platform view, due to the same view_id is pushed to composition_order_ multiple times. (Again, because composition_order_ is not cleared)
This PR moves the composition_order_.clear() to the beginning of each frame.
This PR also removed FlutterViewController::EndFrame as it is not used anymore.
Related Issues
Fixes flutter/flutter#70577
Tests
I added the following tests:
testPlatformViewWithContinuousTexture
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.