这是indexloc提供的服务,不要输入任何密码
Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

add flag to identify sub-trees with PlatformViewLayers and always paint them #25824

Merged
merged 4 commits into from
Apr 30, 2021

Conversation

flar
Copy link
Contributor

@flar flar commented Apr 28, 2021

This is a more targeted workaround for flutter/flutter#76097

The only down-sides to this workaround is that we will always paint down to a PlatformViewLayer even if it is not visible on the screen. This should have very little impact on performance as the rendering should not result in any work done (in particular, we won't paint leaf nodes like PictureLayer in these subtrees, only the intervening containers and the PVL itself).

This fix is only needed for the iOS embedder, but it will take effect on all platforms as the impact should be negligible. I've filed an issue against the iOS embedder to try to fix the underlying problem there. See flutter/flutter#81419

@flar flar added the embedder Related to the embedder API label Apr 28, 2021
@flar flar requested a review from chinmaygarde April 28, 2021 21:37
@flutter-dashboard
Copy link

It looks like this pull request may not have tests. Please make sure to add tests before merging. If you need an exemption to this rule, contact Hixie on the #hackers channel in Chat.

If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix?

Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing.

@google-cla google-cla bot added the cla: yes label Apr 28, 2021
@flar
Copy link
Contributor Author

flar commented Apr 28, 2021

I should sprinkle a bunch of checks for the flag in the various platform_view_layer_unittests as well as add a unit test targeted to this specific case (clipped out, but still gets paint called).

@flar
Copy link
Contributor Author

flar commented Apr 29, 2021

I've added a new MockViewEmbedder which does very little work for now, but lets the new test verify the proper flag behaviors when embedding is allegedly happening.

@blasten
Copy link

blasten commented Apr 29, 2021

public:
MockViewEmbedder(SkCanvas* root_canvas);

~MockViewEmbedder() = default;
Copy link
Member

Choose a reason for hiding this comment

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

Here and elsewhere, please mention the interface which contains the definition being overriden. In this case, // || ExternalViewEmbedder. Also, virtual's need to be OOL. So you could move the = default into the .cc file.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

SkCanvas* CompositeEmbeddedView(int view_id) override;

private:
SkCanvas* root_canvas_;
Copy link
Member

Choose a reason for hiding this comment

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

sk_sp<SkCanvas>? The the ownership of the root canvas is not clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I tried just returning nullptr again and it worked fine for current tests so I'll go with that.

namespace flutter {
namespace testing {

class MockViewEmbedder : public ExternalViewEmbedder {
Copy link
Member

Choose a reason for hiding this comment

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

Call this TestViewEmbedder perhaps? This isn't really mocking anything else. It is an actual ExternalViewEmbedder.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It's in the same space where we define other Mock objects that help with layer_unittests like mock_layer and mock_raster_cache and mock_texture. Over time it can provide more testing insights, but its first need is just to be a standin for having the view_embedder field of the context to be non-null.

@flar flar merged commit 72114da into flutter:master Apr 30, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Apr 30, 2021
gspencergoog pushed a commit to gspencergoog/engine that referenced this pull request May 5, 2021
christopherfujino added a commit that referenced this pull request May 7, 2021
…5954)

* add flag to identify sub-trees with PlatformViewLayers and always paint them (#25824)
* Roll Dart SDK to 2.13.0-211.14.beta
* Roll buildroot to pick up github.com/flutter/buildroot/pull/447
* explicitly call generate_winrt_headers.py with python3
* add third_party/expat to DEPS

Co-authored-by: Jim Graham <flar@google.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
cla: yes embedder Related to the embedder API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants