Implement unobstructed Platform Views on iOS#17049
Conversation
There was a problem hiding this comment.
I didn't review the tests yet. I did just a code review, not a design review. It's a bit big to grok in one reading.
edit: there is quite a few instances in this PR were we are indexing into a collection and there seems like there might be a possibility for out-of-bounds errors. Might be worth being a bit more defensive with those calls.
|
|
||
| layer = std::make_shared<FlutterPlatformViewLayer>( | ||
| std::move(overlay_view), std::move(ios_surface), std::move(surface)); | ||
| } else { |
There was a problem hiding this comment.
nit: there is a bit of copy-n-paste between these two branches, could be split out to a function.
There was a problem hiding this comment.
This is existing code. I just moved it to this method. I can definitely refactor this in a different PR.
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Show resolved
Hide resolved
cyanglaz
left a comment
There was a problem hiding this comment.
LGTM modulo nits. We should probably defer the decision making on the external_view_embedder->FinishFrame(); thingy to @amirh or @chinmaygarde
| frame->Submit(); | ||
| if (external_view_embedder != nullptr) { | ||
| external_view_embedder->SubmitFrame(surface_->GetContext()); | ||
| external_view_embedder->SubmitFrame(surface_->GetContext(), |
There was a problem hiding this comment.
I'm OK with this only considering iOS. I'm not sure what the best approach would be considering external embedder. Probably need more inputs from @amirh or @chinmaygarde
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Show resolved
Hide resolved
There was a problem hiding this comment.
Thanks for responding to last review, mostly looks good. I gave this PR a deeper reading this time and read through the tests and I'm feeling good about it. There are still a few nits. One thing I was thinking, don't you think golden tests would be good for this? I don't think they should be part of the PR but maybe we can throw down an issue to add golden tests.
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.h
Outdated
Show resolved
Hide resolved
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews_Internal.mm
Show resolved
Hide resolved
| sk_sp<RTree> rtree = platform_view_rtrees_[platform_view_id]; | ||
| sk_sp<SkPicture> picture = picture_recorders_[platform_view_id]->finishRecordingAsPicture(); |
There was a problem hiding this comment.
This is one of the places where there were unchecked indexing happening. How are you confident that this won't be a problem? Seems like we should at the minimum have a FML_DCHECK here.
There was a problem hiding this comment.
Every entry in composition_order_ always has an entry in picture_recorders_ and platform_view_rtrees_. This is currently tested in the scenario app.
|
@gaaclarke The scenario app has a few golden tests, so that cover the compositor. The ones I added are checking for the exact size of the overlay UIViews. |
|
I'm going to go ahead and merge this PR. @chinmaygarde @amirh Feel free to make any comments and I will address them. |
|
I'm trying to understand this change better and notice that http://go/flutter-hybrid-composition is not publicly accessible.. any chance it can be shared so the community outside google can see? |
|
@clarkezone I updated the link in the description. |
| return did_submit; | ||
| } | ||
| DetachUnusedLayers(); | ||
| active_composition_order_.clear(); |
There was a problem hiding this comment.
I realized this line was removed in this PR. Which caused active_composition_order_ never be cleaned up.
@blasten Let's fix this.
For context about how this is used, refer to https://flutter.dev/go/unobstructed-platform-views
The scenario app has been updated to test the size of the UIViews created by this implementation.