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

Conversation

@guoguo338
Copy link
Contributor

@guoguo338 guoguo338 commented Aug 17, 2022

func LoadDartDeferredLibraryError() and UpdateAssetResolverByType in shell.cc should be post to run in UI thread.

Fixed the issue flutter/flutter#109762

Pre-launch Checklist

  • I read the Contributor Guide and followed the process outlined there for submitting PRs.
  • I read the Tree Hygiene wiki page, which explains my responsibilities.
  • I read and followed the Flutter Style Guide and the C++, Objective-C, Java style guides.
  • I listed at least one issue that this PR fixes in the description above.
  • I added new tests to check the change I am making or feature I am adding, or Hixie said the PR is test-exempt. See testing the engine for instructions on
    writing and running engine tests.
  • I updated/added relevant documentation (doc comments with ///).
  • I signed the CLA.
  • All existing and new tests are passing.

If you need help, consider asking for advice on the #hackers-new channel on Discord.

@dnfield
Copy link
Contributor

dnfield commented Aug 17, 2022

Can you please file an issue for this and link to it here?

I think this change is sane but would like to better understand the failures you're seeing without it.

bool transient) {
engine_->LoadDartDeferredLibraryError(loading_unit_id, error_message,
transient);
task_runners_.GetUITaskRunner()->PostTask(
Copy link
Contributor

Choose a reason for hiding this comment

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

Consider using fml::TaskRunner::RunNowOrPostTask( here and below.

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

TaskRunners task_runners("test", task_runner, task_runner, task_runner,
task_runner);
auto shell = CreateShell(std::move(settings), task_runners);
auto shell = CreateShell(std::move(settings));
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 we still want this test to pass as is. Instead of modifying the threading configuration here, can you add a new test?

If you use RunNowOrPostTask this test should be fine (although it may need to update some expectations below).

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 have modified based on your comments, but I still have a question for this test case, since it is not real that the four flutter threads(UI/raster/IO/Platform) run in just one thread, why not create four threads for each?

Copy link
Contributor

Choose a reason for hiding this comment

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

An embedder can choose to run single threaded, and even in "normal" Flutter applications threads might get merged (although not normally the UI thread).

@dnfield
Copy link
Contributor

dnfield commented Aug 18, 2022

@GaryQian can you provide a secondary review?

@dnfield dnfield added the autosubmit Merge PR when tree becomes green via auto submit App label Aug 18, 2022
@auto-submit auto-submit bot merged commit b8603c0 into flutter:main Aug 18, 2022
Copy link
Contributor

@GaryQian GaryQian left a comment

Choose a reason for hiding this comment

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

The changes themseves lgtm, but I'm still not clear what problem this fixes. The dart loadLibrary call needs to be on UI thread, but these error messages and asset loading are already performed async and it's not clear to me why they need to be on specifically the UI thread. If there is something not working, I'd love to know where.

In any case, this shouldn't hurt, if only for consistency sake where all deferred components tasks are on the UI thread.

@guoguo338
Copy link
Contributor Author

problem

Yes, as Gary mentioned, no issue is encountered by us, this PR is for consistency sake.

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

Labels

autosubmit Merge PR when tree becomes green via auto submit App

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants