-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS] Skip unnecessary canvas operations #21863
Conversation
|
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. |
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 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).
shell/platform/darwin/ios/framework/Source/FlutterPlatformViews.mm
Outdated
Show resolved
Hide resolved
| SkRect joined_rect; | ||
| for (const SkRect& rect : intersection_rects) { | ||
| joined_rect.join(rect); | ||
| if (num_platform_views > 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.
cool. Android has this check too. Any chance we add a 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.
No idea about how to add a test. :)
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.
@blasten Can you answer this query so progress is unblocked here?
|
#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. |
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. |
Description
After #20671 merged,
ExternalViewEmbedderalways has value,engine/shell/common/rasterizer.cc
Lines 472 to 474 in b22809b
so we always call platform_views_controller_'s
SubmitFrameeven if not exit platform view, we need to bypass these unnecessary operations.engine/shell/platform/darwin/ios/ios_external_view_embedder.mm
Line 79 in b22809b
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.Reviewer Checklist
Breaking Change
Did any tests fail when you ran them? Please read handling breaking changes.