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

Conversation

@zhongwuzw
Copy link
Member

Description

After #20671 merged, ExternalViewEmbedder always has value,

if (external_view_embedder != nullptr) {
FML_DCHECK(!frame->IsSubmitted());
external_view_embedder->SubmitFrame(surface_->GetContext(),

so we always call platform_views_controller_'s SubmitFrame even if not exit platform view, we need to bypass these unnecessary operations.
platform_views_controller_->SubmitFrame(std::move(context), ios_context_, std::move(frame));

Related Issues

#20671 cc @cyanglaz .

Tests

I added the following tests:

N/A.

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.

  • I read the contributor guide and followed the process outlined there for submitting PRs.
  • I signed the CLA.
  • I read and followed the C++, Objective-C, Java style guides for the engine.
  • I read the tree hygiene wiki page, which explains my responsibilities.
  • I updated/added relevant documentation.
  • All existing and new tests are passing.
  • I am willing to follow-up on review comments in a timely manner.

Reviewer Checklist

Breaking Change

Did any tests fail when you ran them? Please read handling breaking changes.

@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.

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 Oct 15, 2020
@zhongwuzw zhongwuzw changed the title Skip unnecessary canvas operations [iOS] Skip unnecessary canvas operations Oct 19, 2020
Copy link
Member

@gaaclarke gaaclarke left a comment

Choose a reason for hiding this comment

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

This looks good to me. @blasten or @cyanglaz do you want to verify? The diff is really weird for this PR but more simply put it moves the following calls under a if (num_platform_views > 0) check:

    SkCanvas* background_canvas = frame->SkiaCanvas();

    // Resolve all pending GPU operations before allocating a new surface.
    background_canvas->flush();
    // Clipping the background canvas before drawing the picture recorders requires to
    // save and restore the clip context.
    SkAutoCanvasRestore save(background_canvas, /*doSave=*/true);

I verified that the failures in CI below were infra flakes and I've filed them with the form.

I was doing performance checks last week and was surprised to find platform channels showing up in my evaluations despite having none so this is a real problem (cc @xster you probably saw this, too).

SkRect joined_rect;
for (const SkRect& rect : intersection_rects) {
joined_rect.join(rect);
if (num_platform_views > 0) {
Copy link

Choose a reason for hiding this comment

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

cool. Android has this check too. Any chance we add a test for this?

Copy link
Member Author

Choose a reason for hiding this comment

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

No idea about how to add a test. :)

Copy link
Member

Choose a reason for hiding this comment

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

@blasten Can you answer this query so progress is unblocked here?

@gaaclarke
Copy link
Member

#22275 will alleviate some of the problems this PR addresses since we won't be going into this code if we don't have merged raster/platform threads. There probably aren't many clients that have merged raster/platform threads and don't have platform views I'd imagine. You can check out that PR for examples on adding tests for platform views as well.

@chinmaygarde
Copy link
Member

There probably aren't many clients that have merged raster/platform threads and don't have platform views I'd imagine.

Correct. There are some platforms that use the embedder API but that is not relevant to this commit. I agree that #22275 is the right way of going about achieve this.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants