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

Conversation

@gw280
Copy link
Contributor

@gw280 gw280 commented Nov 11, 2019

This fixes the failed assertion that the WeakPtr is being used on the wrong thread.

Issue: flutter/flutter#44480

@iskakaushik
Copy link
Contributor

can we write a test for this?

@gw280
Copy link
Contributor Author

gw280 commented Nov 11, 2019

It should be covered by the existing Shell unittests, we just don't run them yet on Fuchsia (currently on the roadmap)

@gw280
Copy link
Contributor Author

gw280 commented Nov 11, 2019

Oh my bad, Shell unittests use their own implementation of VsyncWaiter for the test harness. I'll have a think about how best to do this but it may end up being put on the tail end of a long list of Fuchsia testing-related items as it'll likely need other work to be completed first (I'm thinking we can probably piggyback off the flutter_runner test harness work).

@iskakaushik
Copy link
Contributor

@gw280 given that you have some subset of unittests already working on Fuchsia target device. How feasible is it to add a test to a new test suite that leverages this behavior.

@iskakaushik iskakaushik self-requested a review November 11, 2019 22:08
@gw280
Copy link
Contributor Author

gw280 commented Nov 11, 2019

@gw280 given that you have some subset of unittests already working on Fuchsia target device. How feasible is it to add a test to a new test suite that leverages this behavior.

The unittests I'm currently looking at are only exercising the cross-platform code with stub implementations of things like VsyncWaiter so they unfortunately won't cover them.

Luckily though, @dnfield already did some work to add a11y tests at the flutter_runner layer (which this test would need to live in) and it does actually build the Fuchsia VsyncWaiter so it might not be too hard to add the test to that harness. I'll look into that now.

@gw280
Copy link
Contributor Author

gw280 commented Nov 12, 2019

@iskakaushik unit test written and seems to work locally!

@chinmaygarde I wasn't thinking straight yesterday, I've updated the changes today and fixed a couple of issues (notably: i was constructing the UI thread's WeakPtrFactory inside a closure instead of the ctor itself, and I was dereffing the WeakPtrFactory on the platform thread in the lambda capture instead of on the UI thread). This has now been resolved and the test passes.

Copy link
Contributor

@iskakaushik iskakaushik left a comment

Choose a reason for hiding this comment

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

LGTM

// thread so we have ordering guarantees (see ::AwaitVSync())
fml::TaskRunner::RunNowOrPostTask(
task_runners_.GetUITaskRunner(), fml::MakeCopyable([this]() mutable {
this->weak_factory_ui_ =
Copy link
Contributor

Choose a reason for hiding this comment

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

@chinmaygarde should we block this call. I think its ok to not block but jut want to confirm.

Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine because of the reason mentioned in the comment.

// thread so we have ordering guarantees (see ::AwaitVSync())
fml::TaskRunner::RunNowOrPostTask(
task_runners_.GetUITaskRunner(), fml::MakeCopyable([this]() mutable {
this->weak_factory_ui_ =
Copy link
Member

Choose a reason for hiding this comment

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

I think this is fine because of the reason mentioned in the comment.

engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2019
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 13, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants