[task] Introduce inheriting ThreadType TaskTraits [chromium/src : main]

0 views
Skip to first unread message

Etienne Pierre-Doray (Gerrit)

unread,
Feb 10, 2026, 5:17:08 PM (11 days ago) Feb 10
to Francois Pierre Doray, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, scheduler-b...@chromium.org, fdoray...@chromium.org, gab+...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, scheduler...@chromium.org
Attention needed from Francois Pierre Doray

Etienne Pierre-Doray voted and added 1 comment

Votes added by Etienne Pierre-Doray

Commit-Queue+1

1 comment

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

PTAL

Open in Gerrit

Related details

Attention is currently required from:
  • Francois Pierre Doray
Submit Requirements:
  • requirement satisfiedCode-Coverage
  • requirement satisfiedCode-Owners
  • requirement is not satisfiedCode-Review
  • 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: I5501f2289d7ba27911cd08f8f806d84912241d2c
Gerrit-Change-Number: 7515535
Gerrit-PatchSet: 16
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-Attention: Francois Pierre Doray <fdo...@chromium.org>
Gerrit-Comment-Date: Tue, 10 Feb 2026 22:17:03 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: Yes
satisfied_requirement
unsatisfied_requirement
open
diffy

Francois Pierre Doray (Gerrit)

unread,
Feb 12, 2026, 3:33:22 PM (9 days ago) Feb 12
to Etienne Pierre-Doray, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, scheduler-b...@chromium.org, fdoray...@chromium.org, gab+...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, scheduler...@chromium.org
Attention needed from Etienne Pierre-Doray

Francois Pierre Doray added 11 comments

File base/task/task_traits.h
Line 341, Patchset 19 (Latest):
Francois Pierre Doray . unresolved

Add documentation

Line 337, Patchset 19 (Latest):
Francois Pierre Doray . unresolved

Add documentation

Line 295, Patchset 19 (Latest): : thread_type_(
Francois Pierre Doray . unresolved

This contains the MaxThreadType, and not the actually inherited thread type? Add documentation.

Line 198, Patchset 19 (Latest): constexpr explicit MaxThreadType(ThreadType max_thread_Type)
Francois Pierre Doray . unresolved
```suggestion
constexpr explicit MaxThreadType(ThreadType max_thread_type)
```
Line 196, Patchset 19 (Latest):
Francois Pierre Doray . unresolved

Add documentation

Line 194, Patchset 19 (Latest):
Francois Pierre Doray . unresolved

Add documentation

Line 37, Patchset 19 (Latest):constexpr TaskTraits traits6 = {TaskShutdownBehavior::BLOCK_SHUTDOWN, true}; // expected-error@*:* {{no matching constructor for initialization}}
Francois Pierre Doray . unresolved

Add no compile tests which specify the new traits (e.g. cannot use InheritThreadType + explicit TaskPriority).

File base/task/thread_pool/job_task_source_unittest.cc
Line 279, Patchset 19 (Latest): FROM_HERE, TaskTraits(), ThreadType::kDefault,
Francois Pierre Doray . unresolved

Add an EXPECT statement to verify that this is plumbed correctly.

File base/task/thread_pool/pooled_parallel_task_runner.cc
Line 31, Patchset 19 (Latest): GetCurrentTaskImportance());
Francois Pierre Doray . unresolved

We should have unit tests that exercise this code, i.e. post to a PooledParallelTaskRunner with ThreadType inheritance and verify that this results in running the correct ThreadGroup.

File base/task/thread_pool/pooled_sequenced_task_runner.cc
Line 20, Patchset 19 (Latest): GetCurrentTaskImportance())) {}
Francois Pierre Doray . unresolved

This is tricky... If the SequencedTaskRunner is created on a high priority thread and them plumbed to a low priority thread, the PostTasks will still be high priority. I suspect that this isn't the desired behavior.

Should we have a CHECK that the CurrentTaskImportance at PostTask time == the creation CurrentTaskImportance, until we figure out something better for this use case? i.e. for now don't allow using ThreadType inheritance and then passing the SequencedTaskRunner to a different ThreadType?

File base/task/thread_pool/thread_pool_impl.cc
Line 264, Patchset 19 (Latest): GetCurrentTaskImportance()));
Francois Pierre Doray . unresolved

We should have unit tests that exercise this code, i.e. post to ThreadPool with ThreadType inheritance and verify that this results in running the correct ThreadGroup.

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I5501f2289d7ba27911cd08f8f806d84912241d2c
    Gerrit-Change-Number: 7515535
    Gerrit-PatchSet: 19
    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-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Thu, 12 Feb 2026 20:33:18 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Feb 19, 2026, 3:05:53 PM (3 days ago) Feb 19
    to Francois Pierre Doray, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, scheduler-b...@chromium.org, fdoray...@chromium.org, gab+...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, scheduler...@chromium.org
    Attention needed from Francois Pierre Doray

    Etienne Pierre-Doray added 12 comments

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

    PTAnL?

    File base/task/task_traits.h
    Line 341, Patchset 19:
    Francois Pierre Doray . resolved

    Add documentation

    Etienne Pierre-Doray

    Done

    Line 337, Patchset 19:
    Francois Pierre Doray . resolved

    Add documentation

    Etienne Pierre-Doray

    Done

    Line 295, Patchset 19: : thread_type_(
    Francois Pierre Doray . resolved

    This contains the MaxThreadType, and not the actually inherited thread type? Add documentation.

    Etienne Pierre-Doray

    Done

    Line 198, Patchset 19: constexpr explicit MaxThreadType(ThreadType max_thread_Type)
    Francois Pierre Doray . resolved
    ```suggestion
    constexpr explicit MaxThreadType(ThreadType max_thread_type)
    ```
    Etienne Pierre-Doray

    Done

    Line 196, Patchset 19:
    Francois Pierre Doray . resolved

    Add documentation

    Etienne Pierre-Doray

    Done

    Line 194, Patchset 19:
    Francois Pierre Doray . resolved

    Add documentation

    Etienne Pierre-Doray

    Done

    Line 37, Patchset 19:constexpr TaskTraits traits6 = {TaskShutdownBehavior::BLOCK_SHUTDOWN, true}; // expected-error@*:* {{no matching constructor for initialization}}
    Francois Pierre Doray . resolved

    Add no compile tests which specify the new traits (e.g. cannot use InheritThreadType + explicit TaskPriority).

    Etienne Pierre-Doray

    Done

    File base/task/thread_pool/job_task_source_unittest.cc
    Line 279, Patchset 19: FROM_HERE, TaskTraits(), ThreadType::kDefault,
    Francois Pierre Doray . resolved

    Add an EXPECT statement to verify that this is plumbed correctly.

    Etienne Pierre-Doray

    I added a new test with InheritThreadType for this.

    File base/task/thread_pool/pooled_parallel_task_runner.cc
    Line 31, Patchset 19: GetCurrentTaskImportance());
    Francois Pierre Doray . resolved

    We should have unit tests that exercise this code, i.e. post to a PooledParallelTaskRunner with ThreadType inheritance and verify that this results in running the correct ThreadGroup.

    Etienne Pierre-Doray

    Added test through GetTraitsExecutionModePairsToCoverAllSchedulingOptions()

    File base/task/thread_pool/pooled_sequenced_task_runner.cc
    Line 20, Patchset 19: GetCurrentTaskImportance())) {}
    Francois Pierre Doray . unresolved

    This is tricky... If the SequencedTaskRunner is created on a high priority thread and them plumbed to a low priority thread, the PostTasks will still be high priority. I suspect that this isn't the desired behavior.

    Should we have a CHECK that the CurrentTaskImportance at PostTask time == the creation CurrentTaskImportance, until we figure out something better for this use case? i.e. for now don't allow using ThreadType inheritance and then passing the SequencedTaskRunner to a different ThreadType?

    Etienne Pierre-Doray

    From use cases, I don't think we can expect the task runner to never be used from a lower priority context; but this requires the higher priority task to willingly "share" its task runner.
    But I think we can expect it will never be used in a context that would give it higher priority (taking into account the MaxThreadType)
    So I added a DCHECK for that.

    File base/task/thread_pool/thread_pool_impl.cc
    Line 264, Patchset 19: GetCurrentTaskImportance()));
    Francois Pierre Doray . resolved

    We should have unit tests that exercise this code, i.e. post to ThreadPool with ThreadType inheritance and verify that this results in running the correct ThreadGroup.

    Etienne Pierre-Doray

    Added tests through GetTraitsExecutionModePairsToCoverAllSchedulingOptions()

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Francois Pierre Doray
    Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement 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: I5501f2289d7ba27911cd08f8f806d84912241d2c
    Gerrit-Change-Number: 7515535
    Gerrit-PatchSet: 22
    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-Attention: Francois Pierre Doray <fdo...@chromium.org>
    Gerrit-Comment-Date: Thu, 19 Feb 2026 20:05:48 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    Comment-In-Reply-To: Francois Pierre Doray <fdo...@chromium.org>
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Francois Pierre Doray (Gerrit)

    unread,
    Feb 20, 2026, 10:52:38 AM (2 days ago) Feb 20
    to Etienne Pierre-Doray, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, scheduler-b...@chromium.org, fdoray...@chromium.org, gab+...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, scheduler...@chromium.org
    Attention needed from Etienne Pierre-Doray

    Francois Pierre Doray voted and added 2 comments

    Votes added by Francois Pierre Doray

    Code-Review+1

    2 comments

    Patchset-level comments
    Francois Pierre Doray . resolved

    LGTM, but tests are failing

    File base/task/thread_pool/pooled_sequenced_task_runner.cc
    Line 20, Patchset 19: GetCurrentTaskImportance())) {}
    Francois Pierre Doray . resolved

    This is tricky... If the SequencedTaskRunner is created on a high priority thread and them plumbed to a low priority thread, the PostTasks will still be high priority. I suspect that this isn't the desired behavior.

    Should we have a CHECK that the CurrentTaskImportance at PostTask time == the creation CurrentTaskImportance, until we figure out something better for this use case? i.e. for now don't allow using ThreadType inheritance and then passing the SequencedTaskRunner to a different ThreadType?

    Etienne Pierre-Doray

    From use cases, I don't think we can expect the task runner to never be used from a lower priority context; but this requires the higher priority task to willingly "share" its task runner.
    But I think we can expect it will never be used in a context that would give it higher priority (taking into account the MaxThreadType)
    So I added a DCHECK for that.

    Francois Pierre Doray

    Acknowledged

    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: I5501f2289d7ba27911cd08f8f806d84912241d2c
      Gerrit-Change-Number: 7515535
      Gerrit-PatchSet: 22
      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-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Fri, 20 Feb 2026 15:52:32 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
      satisfied_requirement
      open
      diffy

      Francois Pierre Doray (Gerrit)

      unread,
      Feb 20, 2026, 3:20:31 PM (2 days ago) Feb 20
      to Etienne Pierre-Doray, AyeAye, Chromium LUCI CQ, chromium...@chromium.org, scheduler-b...@chromium.org, fdoray...@chromium.org, gab+...@chromium.org, jessemcke...@google.com, roblia...@chromium.org, scheduler...@chromium.org
      Attention needed from Etienne Pierre-Doray

      Francois Pierre Doray 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: I5501f2289d7ba27911cd08f8f806d84912241d2c
      Gerrit-Change-Number: 7515535
      Gerrit-PatchSet: 24
      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-Attention: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Comment-Date: Fri, 20 Feb 2026 20:20:26 +0000
      Gerrit-HasComments: No
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      open
      diffy
      Reply all
      Reply to author
      Forward
      0 new messages