Currently, tasks on worker threads are able to run even while a parent document is suspended. To stop them, we may need a simple task throttling mechanism for workers.
Random ideas:
- Maybe 2 task types are necessary: (1) THROTTLED for regular tasks, UNTHROTTLED for DevTools tasks and thread control tasks.
- THROTTLED tasks are suspended while a parent document is suspended.
- UNTHROTTLED tasks are running even while a parent document is suspended.
- This mechanism should work only for tasks of DedicatedWorkers and Worklets. Tasks of SharedWorkers and ServiceWorkers shouldn't be throttled because they don't have the concept of parent documents and should continue running even after one of connecting/controlling documents is suspended.
- We could extend existing WorkerScheduler class (third_party/WebKit/Source/platform/scheduler/child/worker_scheduler.cc)
Comment 1 by haraken@chromium.org
, Dec 2 2016