Currently BACKGROUND tasks are executing in a background worker pool. Unfortunately not all platforms support proper background thread priority [1].
On those platforms TaskScheduler needs to more aggressively throttle BACKGROUND tasks by moving everything into one pool and having a quota on how many workers BACKGROUND tasks can use even when idle (to avoid having a starved pool when foreground work comes in).
Step #1 is to resolve issue 831835 to ensure no BACKGROUND work is required to startup + navigate.
In parallel with step #1 we can strip the background pool on platforms that don't support background threads.
Then:
- Add ScopedNoBackgroundTasks() for max responsiveness situations like startup or incoming-scroll.
- Enable aggressive backgrounding.
[1]
ThreadPriority SchedulerWorker::GetDesiredThreadPriority() const {
// All threads have a NORMAL priority when Lock doesn't handle multiple thread
// priorities.
if (!Lock::HandlesMultipleThreadPriorities())
return ThreadPriority::NORMAL;
...
}
As of today Lock::HandlesMultipleThreadPriorities() is only true on Mac/Windows (i.e. not Android/Linux/etc.).
Comment 1 by gab@chromium.org
, May 3 2018