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

Conversation

@gaaclarke
Copy link
Member

@gaaclarke gaaclarke commented Nov 1, 2021

fixes flutter/flutter#92858

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.

@gaaclarke
Copy link
Member Author

@dnfield I read through the code and I think this is what we want. Do I need to make a separate injector field for this you think? We might have to add the TaskQueueFactory to the injector but this should solve all of our current cases. Let me know if you want to see me pull this out so we can run extra tests on it. Let me know what you think.

cc @xster

@gaaclarke gaaclarke force-pushed the task-queue-injector branch from 0572d81 to 3cfbb23 Compare November 2, 2021 18:37
@gaaclarke gaaclarke force-pushed the task-queue-injector branch from 3cfbb23 to 31f35c3 Compare November 2, 2021 18:42
@gaaclarke gaaclarke marked this pull request as ready for review November 2, 2021 18:44
@gaaclarke gaaclarke requested a review from dnfield November 2, 2021 18:44
@gaaclarke
Copy link
Member Author

Okay, added a test and cleaned up the docstrings. Ready for review.

try {
@Nullable Runnable runnable = queue.poll();
if (runnable != null) {
runnable.run();
Copy link
Contributor

Choose a reason for hiding this comment

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

Why not just flush the whole queue from here? What's the advantage of resubmitting to the executor for each task?

Copy link
Member Author

Choose a reason for hiding this comment

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

We could. This is more fair to allow other tasks to execute so one TaskQueue can't dominate a whole thread.

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok. I think that makes sense. This may be something to revisit as we look at more traces/benchmarks - particularly in cases on devices with few cores.

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. I think we may want to revisit which executorService we use, and whether flutterinjector needs more than one, but for now this is good.

@gaaclarke gaaclarke merged commit b3b3cd6 into flutter:master Nov 2, 2021
engine-flutter-autoroll added a commit to engine-flutter-autoroll/flutter that referenced this pull request Nov 3, 2021
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.

Create mechanism to share thread pools between background platform channels and the host app

3 participants