[task] Expose internal::GetCurrentTaskImportance() [chromium/src : main]

0 views
Skip to first unread message

Etienne Pierre-Doray (Gerrit)

unread,
Feb 10, 2026, 1:03:34 PM (2 days ago) Feb 10
to Scott Haseley, Francois Pierre Doray, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org
Attention needed from Francois Pierre Doray and Scott Haseley

Etienne Pierre-Doray added 3 comments

Patchset-level comments
File-level comment, Patchset 21 (Latest):
Etienne Pierre-Doray . resolved

PTAnL?

File base/task/task_runner.h
Line 62, Patchset 18: public:
Francois Pierre Doray . resolved

The comment refers to "this TaskRunner", but this is a static method, so it's not so clear what "this TaskRunner" means. It's definitely not the TaskRunner on which this is called in:

`task_runner->GetCurrentThreadType()`

To reduce confusion, I suggest making this a standalone function. Depending on where you plan to use this, it could be in the anonymous namespace?

Etienne Pierre-Doray

Done, moved to internal:: in base/task/thread_type.h

File third_party/blink/renderer/platform/scheduler/common/task_priority.cc
Line 54, Patchset 18:base::ThreadType ToThreadType(TaskPriority priority) {
Scott Haseley . unresolved

Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer, and is this the best fit for thread type (vs. UseCase)?

We use priority in blink a lot for relative ordering of various things, and I don't know how well that really matches thread priority. For example, during loading we:
- Run image loading tasks at extremely high priority so it happens before the next paint (i.e. this is coordinated with rendering priority), which helps prevent layout shift (by a good amount IIRC) and has a small LCP benefit (~1 frame max improvement).
- We periodically bump up rendering priority (to very high) to balance loading tasks and rendering.
- We also use very high priority internally for script continuation, e.g. to break up executing module scripts during loading, where we want input and maybe rendering to run, but not other things.

In all cases I don't know that the elevated priority implies a difference in thread priority compared to the other loading tasks (normal priority)? Some other recent features, e.g. [1], are using UseCase to determine drive performance settings, so I'm wondering if we should align this (assuming this will drive thread priority).

[1]https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc;l=1063-1078;drc=976a71ef2a509d4391d814b52b9f4700fdf35789;bpv=1;bpt=1?q=main_thread_scheduler_imp&ss=chromium%2Fchromium%2Fsrc

Etienne Pierre-Doray

Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer

To be clear, this won't be used to drive thread's OS priority. What this will be used for:

  • (short term) The immediate use case is to allow media tasks to post to ThreadPool from task queues > ThreadType::kDefault.
  • (short term) better identify "background" task queue (for disabling), the current impl simply pick the first one with the lowest priority
  • (short term) replace ScopedSetTaskPriorityForCurrentThread that works awkwardly for non-threadpool context.
  • (long term) prevent tasks from implicitly escalating priority when posted to the ThreadType, and inherit some kind of originating work importance when requested.
 is this the best fit for thread type (vs. UseCase)

In this context, ThreadType is use to describe "work importance" in a scheduler agnostic (and rather coarse) way, but I didn't want to depend on renaming ThreadType, nor introducing yet another concept of priority in base.
I want this to work outside of renderers or any particular scheduler though.
I guess another question is: is it a better fit to derive ThreadType from UseCase rather than derive from TaskPriority. (I think TaskPriority is more appropriate)

Open in Gerrit

Related details

Attention is currently required from:
  • Francois Pierre Doray
  • Scott Haseley
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I977fbc1a23c8eb8e02c1b9b00a45861e5ee86f79
Gerrit-Change-Number: 7521684
Gerrit-PatchSet: 21
Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
Gerrit-CC: Jerome Jiang <ji...@chromium.org>
Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
Gerrit-CC: Peter Beverloo <pe...@chromium.org>
Gerrit-CC: Scott Haseley <shas...@chromium.org>
Gerrit-Attention: Scott Haseley <shas...@chromium.org>
Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Comment-Date: Tue, 10 Feb 2026 18:02:11 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Scott Haseley <shas...@chromium.org>
Comment-In-Reply-To: Francois Pierre Doray <fdo...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Scott Haseley (Gerrit)

unread,
Feb 11, 2026, 2:58:40 PM (17 hours ago) Feb 11
to Etienne Pierre-Doray, Francois Pierre Doray, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org
Attention needed from Etienne Pierre-Doray and Francois Pierre Doray

Scott Haseley added 1 comment

File third_party/blink/renderer/platform/scheduler/common/task_priority.cc
Line 54, Patchset 18:base::ThreadType ToThreadType(TaskPriority priority) {
Scott Haseley . unresolved

Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer, and is this the best fit for thread type (vs. UseCase)?

We use priority in blink a lot for relative ordering of various things, and I don't know how well that really matches thread priority. For example, during loading we:
- Run image loading tasks at extremely high priority so it happens before the next paint (i.e. this is coordinated with rendering priority), which helps prevent layout shift (by a good amount IIRC) and has a small LCP benefit (~1 frame max improvement).
- We periodically bump up rendering priority (to very high) to balance loading tasks and rendering.
- We also use very high priority internally for script continuation, e.g. to break up executing module scripts during loading, where we want input and maybe rendering to run, but not other things.

In all cases I don't know that the elevated priority implies a difference in thread priority compared to the other loading tasks (normal priority)? Some other recent features, e.g. [1], are using UseCase to determine drive performance settings, so I'm wondering if we should align this (assuming this will drive thread priority).

[1]https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc;l=1063-1078;drc=976a71ef2a509d4391d814b52b9f4700fdf35789;bpv=1;bpt=1?q=main_thread_scheduler_imp&ss=chromium%2Fchromium%2Fsrc

Etienne Pierre-Doray

Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer

To be clear, this won't be used to drive thread's OS priority. What this will be used for:

  • (short term) The immediate use case is to allow media tasks to post to ThreadPool from task queues > ThreadType::kDefault.
  • (short term) better identify "background" task queue (for disabling), the current impl simply pick the first one with the lowest priority
  • (short term) replace ScopedSetTaskPriorityForCurrentThread that works awkwardly for non-threadpool context.
  • (long term) prevent tasks from implicitly escalating priority when posted to the ThreadType, and inherit some kind of originating work importance when requested.
 is this the best fit for thread type (vs. UseCase)

In this context, ThreadType is use to describe "work importance" in a scheduler agnostic (and rather coarse) way, but I didn't want to depend on renaming ThreadType, nor introducing yet another concept of priority in base.
I want this to work outside of renderers or any particular scheduler though.
I guess another question is: is it a better fit to derive ThreadType from UseCase rather than derive from TaskPriority. (I think TaskPriority is more appropriate)

Scott Haseley

Got it, thanks for the context!

In this context, ThreadType is use to describe "work importance" in a scheduler agnostic (and rather coarse) way, but I didn't want to depend on renaming ThreadType, nor introducing yet another concept of priority in base.

Ah, I see. I understand not wanting to introduce another priority concept -- there are already a bunch of overloaded things. Case in point: blink::ThreadType vs base::ThreadType! I think that's partially where my confusion is coming from, as I think of thread type more as an (usually) immutable property of the thread, which has little if any correlation to how work on that thread is arranged. I guess something like (Task)PriorityGroup also matches the intent here?

I want this to work outside of renderers or any particular scheduler though.
I guess another question is: is it a better fit to derive ThreadType from UseCase rather than derive from TaskPriority. (I think TaskPriority is more appropriate)

From the use cases you're describing, yes, TaskPriority is more appropriate -- although it's hard to tell if this is the correct mapping without seeing if and how it will affect the main/worker threads. For example, requestIdleCallback() can escalate priority by calling setTimeout() or a number of other APIs, so I don't think this works in the 4th case (if applied globally on the main thread). You could also consider not creating a mapping here if it isn't needed (yet?) for the main/web-worker threads?

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
  • Francois Pierre Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement is not satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • requirement is not satisfiedNo-Unresolved-Comments
  • requirement is not satisfiedReview-Enforcement
Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
Gerrit-MessageType: comment
Gerrit-Project: chromium/src
Gerrit-Branch: main
Gerrit-Change-Id: I977fbc1a23c8eb8e02c1b9b00a45861e5ee86f79
Gerrit-Change-Number: 7521684
Gerrit-PatchSet: 23
Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
Gerrit-CC: Jerome Jiang <ji...@chromium.org>
Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
Gerrit-CC: Peter Beverloo <pe...@chromium.org>
Gerrit-CC: Scott Haseley <shas...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Comment-Date: Wed, 11 Feb 2026 19:58:31 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Scott Haseley <shas...@chromium.org>
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Francois Pierre Doray (Gerrit)

unread,
Feb 11, 2026, 4:38:02 PM (16 hours ago) Feb 11
to Etienne Pierre-Doray, Scott Haseley, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org
Attention needed from Etienne Pierre-Doray

Francois Pierre Doray voted and added 11 comments

Votes added by Francois Pierre Doray

Code-Review+1

11 comments

Patchset-level comments
Francois Pierre Doray . resolved

LGTM with comments

File base/task/sequence_manager/sequence_manager.h
Line 114, Patchset 23 (Latest): ThreadTypeMapping thread_type_mapping_ = &DefaultTaskPriorityToThreadType;
Francois Pierre Doray . unresolved

This is always overridden I believe, see https://chromium-review.googlesource.com/c/chromium/src/+/7521684/23/base/task/sequence_manager/sequence_manager.cc#39?


Set the initial value to `nullptr`, so it's more straightforward what code path sets this, and avoid having different code paths that evolve differently in the future.

Line 103, Patchset 23 (Latest):
Francois Pierre Doray . unresolved

Add a comment explaining that this returns the ThreadType corresponding to `priority`, using the mapping provided via SetThreadTypeMapping if applicable.

Reason: Improve readability. The reader can understand the method without reading the implementation.

Line 96, Patchset 23 (Latest): // will be returned by SingleThreadTaskRunner::GetCurrentThreadType().
Francois Pierre Doray . unresolved

Update this comment.

File base/task/sequence_manager/thread_controller_with_message_pump_impl.cc
Line 457, Patchset 23 (Latest):
Francois Pierre Doray . unresolved

Move this to line 470.

Reason: There is code that posts tasks in unexpected places (for example on ChromeOS there is code that posts a task the first time the state of a feature is accessed). We don't want to modify the task importance for tasks posted outside of the callback (e.g. in SequenceManager code), so we should set the CurrentTaskImportance for the narrowest scope possible.

File base/task/thread_pool/task_tracker.h
Line 158, Patchset 23 (Latest): // after doing so.
Francois Pierre Doray . unresolved

Document the `thread_type` argument.

File base/task/thread_type.h
Line 57, Patchset 23 (Latest):// task. This will be equal or lower than the current thread's ThreadType
Francois Pierre Doray . unresolved

```suggestion
// task. This will be equal to or lower than the current thread's ThreadType
```

File content/browser/scheduler/browser_task_priority.cc
Line 46, Patchset 23 (Latest): switch (priority) {
Francois Pierre Doray . unresolved

Same comment as https://chromium-review.googlesource.com/c/chromium/src/+/7521684/23/services/network/public/cpp/network_service_task_priority.cc: it's possible to group `case` statements to make it easier to identify TaskPriorities that map to the same ThreadType.

File services/network/public/cpp/network_service_task_priority.cc
Line 53, Patchset 23 (Latest): case NetworkServiceTaskPriority::kLowestPriority:
return base::ThreadType::kBackground;
case NetworkServiceTaskPriority::kIdlePriority:
return base::ThreadType::kBackground;
case NetworkServiceTaskPriority::kThrottledPriority:
return base::ThreadType::kBackground;
Francois Pierre Doray . unresolved

Optional nit:

Can be rewritten like this for clarity:
```suggestion
case NetworkServiceTaskPriority::kLowestPriority:
case NetworkServiceTaskPriority::kIdlePriority:
case NetworkServiceTaskPriority::kThrottledPriority:
return base::ThreadType::kBackground;
```

I find that it makes it easier to realize that multiple NetworkServiceTaskPriority map to the same ThreadType.

File third_party/blink/renderer/platform/scheduler/common/task_priority.cc
Line 54, Patchset 18:base::ThreadType ToThreadType(TaskPriority priority) {
Scott Haseley . unresolved

Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer, and is this the best fit for thread type (vs. UseCase)?

We use priority in blink a lot for relative ordering of various things, and I don't know how well that really matches thread priority. For example, during loading we:
- Run image loading tasks at extremely high priority so it happens before the next paint (i.e. this is coordinated with rendering priority), which helps prevent layout shift (by a good amount IIRC) and has a small LCP benefit (~1 frame max improvement).
- We periodically bump up rendering priority (to very high) to balance loading tasks and rendering.
- We also use very high priority internally for script continuation, e.g. to break up executing module scripts during loading, where we want input and maybe rendering to run, but not other things.

In all cases I don't know that the elevated priority implies a difference in thread priority compared to the other loading tasks (normal priority)? Some other recent features, e.g. [1], are using UseCase to determine drive performance settings, so I'm wondering if we should align this (assuming this will drive thread priority).

[1]https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc;l=1063-1078;drc=976a71ef2a509d4391d814b52b9f4700fdf35789;bpv=1;bpt=1?q=main_thread_scheduler_imp&ss=chromium%2Fchromium%2Fsrc

Etienne Pierre-Doray

Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer

To be clear, this won't be used to drive thread's OS priority. What this will be used for:

  • (short term) The immediate use case is to allow media tasks to post to ThreadPool from task queues > ThreadType::kDefault.
  • (short term) better identify "background" task queue (for disabling), the current impl simply pick the first one with the lowest priority
  • (short term) replace ScopedSetTaskPriorityForCurrentThread that works awkwardly for non-threadpool context.
  • (long term) prevent tasks from implicitly escalating priority when posted to the ThreadType, and inherit some kind of originating work importance when requested.
 is this the best fit for thread type (vs. UseCase)

In this context, ThreadType is use to describe "work importance" in a scheduler agnostic (and rather coarse) way, but I didn't want to depend on renaming ThreadType, nor introducing yet another concept of priority in base.
I want this to work outside of renderers or any particular scheduler though.
I guess another question is: is it a better fit to derive ThreadType from UseCase rather than derive from TaskPriority. (I think TaskPriority is more appropriate)

Francois Pierre Doray

+1 to EtienneP's response. I think we could clarify on the comment for GetCurrentTaskImportance() that this is used to influence the priority of tasks posted from the current task, but not to influence Thread Priority of the current task.

Line 55, Patchset 23 (Latest): switch (priority) {
Francois Pierre Doray . unresolved

Same comment as https://chromium-review.googlesource.com/c/chromium/src/+/7521684/23/services/network/public/cpp/network_service_task_priority.cc: it's possible to group `case` statements to make it easier to identify TaskPriorities that map to the same ThreadType.

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not satisfiedCode-Owners
    • requirement satisfiedCode-Review
    • requirement is not satisfiedNo-Unresolved-Comments
    • requirement satisfiedReview-Enforcement
    Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
    Gerrit-MessageType: comment
    Gerrit-Project: chromium/src
    Gerrit-Branch: main
    Gerrit-Change-Id: I977fbc1a23c8eb8e02c1b9b00a45861e5ee86f79
    Gerrit-Change-Number: 7521684
    Gerrit-PatchSet: 23
    Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
    Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
    Gerrit-CC: Jerome Jiang <ji...@chromium.org>
    Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
    Gerrit-CC: Peter Beverloo <pe...@chromium.org>
    Gerrit-CC: Scott Haseley <shas...@chromium.org>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Wed, 11 Feb 2026 21:37:57 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: Yes
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Feb 11, 2026, 5:03:26 PM (15 hours ago) Feb 11
    to Kenichi Ishibashi, Francois Pierre Doray, Scott Haseley, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org
    Attention needed from Kenichi Ishibashi and Scott Haseley

    Etienne Pierre-Doray added 13 comments

    Patchset-level comments
    Etienne Pierre-Doray . resolved

    +bashi@ for services/network

    File base/task/sequence_manager/sequence_manager.h
    Line 114, Patchset 23 (Latest): ThreadTypeMapping thread_type_mapping_ = &DefaultTaskPriorityToThreadType;
    Francois Pierre Doray . resolved

    This is always overridden I believe, see https://chromium-review.googlesource.com/c/chromium/src/+/7521684/23/base/task/sequence_manager/sequence_manager.cc#39?


    Set the initial value to `nullptr`, so it's more straightforward what code path sets this, and avoid having different code paths that evolve differently in the future.

    Etienne Pierre-Doray

    There are many PrioritySettings in tests that don't go through PrioritySettings::CreateDefault(), so this turned out to be easier.
    I removed the redundant SetThreadTypeMapping() in CreateDefault() though.

    Francois Pierre Doray . resolved

    Add a comment explaining that this returns the ThreadType corresponding to `priority`, using the mapping provided via SetThreadTypeMapping if applicable.

    Reason: Improve readability. The reader can understand the method without reading the implementation.

    Etienne Pierre-Doray

    Done

    Line 96, Patchset 23 (Latest): // will be returned by SingleThreadTaskRunner::GetCurrentThreadType().
    Francois Pierre Doray . resolved

    Update this comment.

    Etienne Pierre-Doray

    Done

    Line 96, Patchset 23 (Latest): // will be returned by SingleThreadTaskRunner::GetCurrentThreadType().
    Francois Pierre Doray . resolved

    Update this comment.

    Etienne Pierre-Doray

    Done

    File base/task/sequence_manager/thread_controller_with_message_pump_impl.cc
    Francois Pierre Doray . resolved

    Move this to line 470.

    Reason: There is code that posts tasks in unexpected places (for example on ChromeOS there is code that posts a task the first time the state of a feature is accessed). We don't want to modify the task importance for tasks posted outside of the callback (e.g. in SequenceManager code), so we should set the CurrentTaskImportance for the narrowest scope possible.

    Etienne Pierre-Doray

    Done

    File base/task/thread_pool/task_tracker.h
    Francois Pierre Doray . resolved

    Document the `thread_type` argument.

    Etienne Pierre-Doray

    Done

    Francois Pierre Doray . resolved

    Document the `thread_type` argument.

    Etienne Pierre-Doray

    Done

    File base/task/thread_type.h
    Line 57, Patchset 23 (Latest):// task. This will be equal or lower than the current thread's ThreadType
    Francois Pierre Doray . resolved

    ```suggestion
    // task. This will be equal to or lower than the current thread's ThreadType
    ```

    Etienne Pierre-Doray

    Done

    File content/browser/scheduler/browser_task_priority.cc
    Line 46, Patchset 23 (Latest): switch (priority) {
    Francois Pierre Doray . resolved

    Same comment as https://chromium-review.googlesource.com/c/chromium/src/+/7521684/23/services/network/public/cpp/network_service_task_priority.cc: it's possible to group `case` statements to make it easier to identify TaskPriorities that map to the same ThreadType.

    Etienne Pierre-Doray

    Done

    File services/network/public/cpp/network_service_task_priority.cc
    Line 53, Patchset 23 (Latest): case NetworkServiceTaskPriority::kLowestPriority:
    return base::ThreadType::kBackground;
    case NetworkServiceTaskPriority::kIdlePriority:
    return base::ThreadType::kBackground;
    case NetworkServiceTaskPriority::kThrottledPriority:
    return base::ThreadType::kBackground;
    Francois Pierre Doray . resolved

    Optional nit:

    Can be rewritten like this for clarity:
    ```suggestion
    case NetworkServiceTaskPriority::kLowestPriority:
    case NetworkServiceTaskPriority::kIdlePriority:
    case NetworkServiceTaskPriority::kThrottledPriority:
    return base::ThreadType::kBackground;
    ```

    I find that it makes it easier to realize that multiple NetworkServiceTaskPriority map to the same ThreadType.

    Etienne Pierre-Doray

    Done

    File third_party/blink/renderer/platform/scheduler/common/task_priority.cc
    Line 54, Patchset 18:base::ThreadType ToThreadType(TaskPriority priority) {
    Scott Haseley . resolved

    Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer, and is this the best fit for thread type (vs. UseCase)?

    We use priority in blink a lot for relative ordering of various things, and I don't know how well that really matches thread priority. For example, during loading we:
    - Run image loading tasks at extremely high priority so it happens before the next paint (i.e. this is coordinated with rendering priority), which helps prevent layout shift (by a good amount IIRC) and has a small LCP benefit (~1 frame max improvement).
    - We periodically bump up rendering priority (to very high) to balance loading tasks and rendering.
    - We also use very high priority internally for script continuation, e.g. to break up executing module scripts during loading, where we want input and maybe rendering to run, but not other things.

    In all cases I don't know that the elevated priority implies a difference in thread priority compared to the other loading tasks (normal priority)? Some other recent features, e.g. [1], are using UseCase to determine drive performance settings, so I'm wondering if we should align this (assuming this will drive thread priority).

    [1]https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc;l=1063-1078;drc=976a71ef2a509d4391d814b52b9f4700fdf35789;bpv=1;bpt=1?q=main_thread_scheduler_imp&ss=chromium%2Fchromium%2Fsrc

    Etienne Pierre-Doray

    Hi, sorry for the drive-by, but I have a question about this: how will this be used in the renderer

    To be clear, this won't be used to drive thread's OS priority. What this will be used for:

    • (short term) The immediate use case is to allow media tasks to post to ThreadPool from task queues > ThreadType::kDefault.
    • (short term) better identify "background" task queue (for disabling), the current impl simply pick the first one with the lowest priority
    • (short term) replace ScopedSetTaskPriorityForCurrentThread that works awkwardly for non-threadpool context.
    • (long term) prevent tasks from implicitly escalating priority when posted to the ThreadType, and inherit some kind of originating work importance when requested.
     is this the best fit for thread type (vs. UseCase)

    In this context, ThreadType is use to describe "work importance" in a scheduler agnostic (and rather coarse) way, but I didn't want to depend on renaming ThreadType, nor introducing yet another concept of priority in base.
    I want this to work outside of renderers or any particular scheduler though.
    I guess another question is: is it a better fit to derive ThreadType from UseCase rather than derive from TaskPriority. (I think TaskPriority is more appropriate)

    Francois Pierre Doray

    +1 to EtienneP's response. I think we could clarify on the comment for GetCurrentTaskImportance() that this is used to influence the priority of tasks posted from the current task, but not to influence Thread Priority of the current task.

    Etienne Pierre-Doray

    Done

    Line 55, Patchset 23 (Latest): switch (priority) {
    Francois Pierre Doray . resolved

    Same comment as https://chromium-review.googlesource.com/c/chromium/src/+/7521684/23/services/network/public/cpp/network_service_task_priority.cc: it's possible to group `case` statements to make it easier to identify TaskPriorities that map to the same ThreadType.

    Etienne Pierre-Doray

    Done

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Kenichi Ishibashi
    • Scott Haseley
    Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement is not satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I977fbc1a23c8eb8e02c1b9b00a45861e5ee86f79
      Gerrit-Change-Number: 7521684
      Gerrit-PatchSet: 23
      Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: Jerome Jiang <ji...@chromium.org>
      Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
      Gerrit-CC: Peter Beverloo <pe...@chromium.org>
      Gerrit-CC: Scott Haseley <shas...@chromium.org>
      Gerrit-Attention: Scott Haseley <shas...@chromium.org>
      Gerrit-Attention: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-Comment-Date: Wed, 11 Feb 2026 22:03:19 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: No
      Comment-In-Reply-To: Scott Haseley <shas...@chromium.org>
      Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Kenichi Ishibashi (Gerrit)

      unread,
      Feb 11, 2026, 7:11:01 PM (13 hours ago) Feb 11
      to Etienne Pierre-Doray, Hayato Ito, Francois Pierre Doray, Scott Haseley, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org
      Attention needed from Etienne Pierre-Doray

      Kenichi Ishibashi voted and added 1 comment

      Votes added by Kenichi Ishibashi

      Code-Review+1

      1 comment

      Patchset-level comments
      Kenichi Ishibashi . resolved

      //services/network lgtm

      hayato@: FYI

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Etienne Pierre-Doray
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I977fbc1a23c8eb8e02c1b9b00a45861e5ee86f79
      Gerrit-Change-Number: 7521684
      Gerrit-PatchSet: 23
      Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: Hayato Ito <hay...@chromium.org>
      Gerrit-CC: Jerome Jiang <ji...@chromium.org>
      Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
      Gerrit-CC: Peter Beverloo <pe...@chromium.org>
      Gerrit-CC: Scott Haseley <shas...@chromium.org>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Thu, 12 Feb 2026 00:10:33 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Hayato Ito (Gerrit)

      unread,
      Feb 11, 2026, 11:10:05 PM (9 hours ago) Feb 11
      to Etienne Pierre-Doray, Kenichi Ishibashi, Francois Pierre Doray, Scott Haseley, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org
      Attention needed from Etienne Pierre-Doray

      Hayato Ito voted Code-Review+1

      Code-Review+1
      Open in Gerrit

      Related details

      Attention is currently required from:
      • Etienne Pierre-Doray
      Submit Requirements:
      • requirement satisfiedCode-Coverage
      • requirement satisfiedCode-Owners
      • requirement satisfiedCode-Review
      • requirement satisfiedReview-Enforcement
      Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
      Gerrit-MessageType: comment
      Gerrit-Project: chromium/src
      Gerrit-Branch: main
      Gerrit-Change-Id: I977fbc1a23c8eb8e02c1b9b00a45861e5ee86f79
      Gerrit-Change-Number: 7521684
      Gerrit-PatchSet: 23
      Gerrit-Owner: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
      Gerrit-Reviewer: Hayato Ito <hay...@chromium.org>
      Gerrit-Reviewer: Kenichi Ishibashi <ba...@chromium.org>
      Gerrit-CC: Enterprise Policy Reviews <enterprise-p...@google.com>
      Gerrit-CC: Jerome Jiang <ji...@chromium.org>
      Gerrit-CC: Mirko Bonadei <mbon...@chromium.org>
      Gerrit-CC: Peter Beverloo <pe...@chromium.org>
      Gerrit-CC: Scott Haseley <shas...@chromium.org>
      Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Thu, 12 Feb 2026 04:09:30 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy

      Etienne Pierre-Doray (Gerrit)

      unread,
      7:29 AM (1 hour ago) 7:29 AM
      to Hayato Ito, Kenichi Ishibashi, Francois Pierre Doray, Scott Haseley, Jerome Jiang, Mirko Bonadei, Enterprise Policy Reviews, Peter Beverloo, Chromium LUCI CQ, AyeAye, chromium...@chromium.org, fdoray...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, gab+...@chromium.org, mar...@chromium.org, jz...@chromium.org, mfoltz+wa...@chromium.org, fgal...@chromium.org, permissio...@chromium.org, zackha...@chromium.org, druber...@chromium.org, mercer...@google.com, xinghui...@chromium.org, lens-chrome...@google.com, vakh+safe_br...@chromium.org, nwoked...@chromium.org, stanfie...@google.com, andysjl...@chromium.org, chrome-intell...@chromium.org, penghuan...@chromium.org, feature-me...@chromium.org, devtools...@chromium.org, net-r...@chromium.org, cblume...@chromium.org, chrome-intelligence-te...@google.com, kinuko...@chromium.org, blink-...@chromium.org, scheduler-...@chromium.org, chikamu...@chromium.org, scheduler-b...@chromium.org, network-ser...@chromium.org, scheduler...@chromium.org

      Etienne Pierre-Doray voted Commit-Queue+2

      Commit-Queue+2
      Open in Gerrit

      Related details

      Attention set is empty
      Gerrit-Comment-Date: Thu, 12 Feb 2026 12:29:48 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages