Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix stale platform view gr context on iOS #13469

Merged
merged 4 commits into from
Oct 31, 2019

Conversation

amirh
Copy link
Contributor

@amirh amirh commented Oct 31, 2019

When gr context is changed (this happens when sending the app to the background and then to the foreground) we need to update it for all the platform view overlay surfaces.

The update logic was caching the previous gr context to figure if it had to be updated, but after updating it for a given overlay we were updating the cached context. In apps with multiple platform views this will result in overlays with a stale gr context.

This fixes flutter/flutter#36437
And I believe it should fix flutter/flutter#36999 as well (though I don't have repro code to verify).

Copy link
Contributor

@dnfield dnfield left a comment

Choose a reason for hiding this comment

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

LGTM modulo generated files

@@ -0,0 +1,7 @@
// This is a generated file; do not edit or check into version control.
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you didn't mean to check this in

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

@@ -0,0 +1,8 @@
#!/bin/sh
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

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

@@ -0,0 +1,14 @@
//
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

@@ -0,0 +1,12 @@
//
Copy link
Contributor

Choose a reason for hiding this comment

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

Ditto

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

Copy link
Contributor

@cyanglaz cyanglaz left a comment

Choose a reason for hiding this comment

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

LGTM overall!

@@ -35,6 +35,29 @@ - (instancetype)initWithInvocation:(NSInvocation*)invocation {
}

- (void)testPlatformView {
//[self checkGolden];
Copy link
Contributor

Choose a reason for hiding this comment

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

remove

Comment on lines +39 to +42
[[XCUIDevice sharedDevice] pressButton:XCUIDeviceButtonHome];
[self.application activate];
[self checkGolden];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems we are also testing the background and foreground thingy here. Maybe we should rename the test to be more specific about it? (Like what is the difference between this test and the test below)
Or if you didn't mean to test the background and foreground here, you can remove the logic.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

🤦‍♂ this part should be reverted, I started by experimenting on this test. I'll followup in a new PR

}

- (void)testPlatformView {
[[XCUIDevice sharedDevice] pressButton:XCUIDeviceButtonHome];
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggestion:
It seems like we would encounter a false positive here if Flutter didn't draw the rectangle before going to the background.
We might want to add a golden check before going to the background just to be on the safe side?
Maybe add a new method checkGoldenWithName for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Isn't that covered by the other MultiPlatformViews test (which is drawing a circle on top of the platform views)?

@amirh amirh merged commit 8997f34 into flutter:master Oct 31, 2019
@amirh
Copy link
Contributor Author

amirh commented Oct 31, 2019

@cyanglaz I missed your comments before merging, I'll follow up in a separate PR

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants