-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Fully inplement TaskRunner for UWP (flutter/flutter#70890) #28013
Fully inplement TaskRunner for UWP (flutter/flutter#70890) #28013
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. If you are not sure if you need tests, consider this rule of thumb: the purpose of a test is to make sure someone doesn't accidentally revert the fix. Ask yourself, is there anything in your PR that you feel it is important we not accidentally revert back to how it was before your fix? Reviewers: Read the Tree Hygiene page and make sure this patch meets those guidelines before LGTMing. |
I am not familiar with Windows APIs but creating a timer object per task seems extremely heavyweight. cc @iskakaushik for a detailed review. |
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.
I have to agree with Chinmay here. Creating a timer for each task seems heavy-weight. Can we do something similar to what is being done on other platforms? We only need to keep track of the wake-up time per task, and wake up at the next-top-time. See: task_runner_win32.cc
for some ideas.
dce758a
to
6c2ca13
Compare
Sorry for the delay. I found that by using DispatcherQueue, I am able to reuse timer, and make almost all the code for TaskRunner the same between win32 and winuwp, so I moved task queueing behavior from TaskRunnerWin32 to TaskRunner, and create abstract TaskRunnerTimer for win32/winuwp. |
cc @iskakaushik Are you familiar with these APIs? If not, I am comfortable reviewing the embedder API bits but it will take me longer to lookup the Windows stuff. |
Sorry, I was out of the office last week. This is in my review queue, will be able to get to this in the next couple of days. |
The implementation itself looks solid. Other than the 1 comment I left, Would it be possible to add some unit tests for these task runner implementations to ensure the tasks are executed in the right order? These could be in Thanks |
shell/platform/windows/task_runner.h
Outdated
public: | ||
class Delegate { | ||
public: | ||
virtual std::chrono::nanoseconds ProcessTasks() = 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.
Please add some docs for this method and the other interface methods below. Also any reason for creating this base class rather than have these virtual methods exist on TaskRunner
itself? As it stands right now, TaskRunnerTimer
(which reads like a timer), has methods which aren't typically on timers, e.g. WakeUp
and RunsOnCurrentThread
. If these methods were to be on TaskRunner
base class itself, and have TaskRunnerWin32
and TaskRunnerWinUwp
implement this, it would make more sense IMO.
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.
I'll add the docs soon.
I wanted to clarify the callback in TaskRunnerTimer
, but I also agree that it seems not like timer.
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.
done
Thanks for your reviewing. I'll add the test. |
I made |
Could you please rebase on top of master and push? |
0498428
to
3cd8493
Compare
I rebased on ToT and fixed the conflicts. |
could you also fix the licenses? :) |
af355f6
to
aadfef5
Compare
aadfef5
to
665b8f7
Compare
I fixed them. |
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.
LGTM cc: @cbracken
Thanks -- will give a quick pass through today! |
@cbracken: Should we land this right away? It looks like this has Kaushik's LGTM. |
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.
LGTM
This PR adds an implementation to process tasks' target time to TaskRunner for UWP.
Fixes: flutter/flutter#70890
No changes in
flutter/tests
.Pre-launch Checklist
writing and running engine tests.
///
).