PlatformThread: implement a lease system for thread types [chromium/src : main]

0 views
Skip to first unread message

Etienne Pierre-Doray (Gerrit)

unread,
Feb 3, 2026, 5:28:24 PMFeb 3
to Markus Handell, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
Attention needed from Markus Handell

Etienne Pierre-Doray added 3 comments

File base/threading/platform_thread.cc
Line 36, Patchset 10 (Latest):std::ostream& operator<<(std::ostream& os, ThreadType type) {
Etienne Pierre-Doray . unresolved

operator<< is only for tests? If so let's move this function to platform_thread_unittest.cc.
I think it will be useful to have ThreadTypeToString() here though (that operator<< can reuse), because I will need this for thread pool changes.

Line 161, Patchset 10 (Latest): bool may_change_affinity = inhibit_affinity_count_ == 0;
Etienne Pierre-Doray . unresolved

If find this quite confusing: what if there's

  • kPresentation with may_change_affinity = false
  • kAudioProcessing with may_change_affinity = true

Then we wouldn't change affinity but the intention was probably to change it.
Since may_change_affinity is only used for ScopedBoostPriority, I'm trying something here: https://chromium-review.googlesource.com/c/chromium/src/+/7539489
That will make ScopedBoostPriority/ScopedBoostablePriority quite similar, and we should just forbid creating a lease under a ScopedBoostPriority.

File third_party/blink/public/platform/scheduler/web_thread_scheduler.h
Line 77, Patchset 10 (Latest): virtual void DonateThreadTypeLease(
Etienne Pierre-Doray . unresolved

Discussed in chat, it might be possible to just have MTSI create its own lease.

Open in Gerrit

Related details

Attention is currently required from:
  • Markus Handell
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: I5fe815b407320e21d0b7780baa3e9815f857a935
Gerrit-Change-Number: 7532481
Gerrit-PatchSet: 10
Gerrit-Owner: Markus Handell <hand...@google.com>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Markus Handell <hand...@google.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Markus Handell <hand...@google.com>
Gerrit-Comment-Date: Tue, 03 Feb 2026 22:28:19 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Markus Handell (Gerrit)

unread,
Feb 4, 2026, 6:57:00 AMFeb 4
to Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
Attention needed from Etienne Pierre-Doray

Markus Handell added 2 comments

File base/threading/platform_thread.cc
Line 36, Patchset 10:std::ostream& operator<<(std::ostream& os, ThreadType type) {
Etienne Pierre-Doray . resolved

operator<< is only for tests? If so let's move this function to platform_thread_unittest.cc.
I think it will be useful to have ThreadTypeToString() here though (that operator<< can reuse), because I will need this for thread pool changes.

Markus Handell

Done

Line 161, Patchset 10: bool may_change_affinity = inhibit_affinity_count_ == 0;
Etienne Pierre-Doray . unresolved

If find this quite confusing: what if there's

  • kPresentation with may_change_affinity = false
  • kAudioProcessing with may_change_affinity = true

Then we wouldn't change affinity but the intention was probably to change it.
Since may_change_affinity is only used for ScopedBoostPriority, I'm trying something here: https://chromium-review.googlesource.com/c/chromium/src/+/7539489
That will make ScopedBoostPriority/ScopedBoostablePriority quite similar, and we should just forbid creating a lease under a ScopedBoostPriority.

Markus Handell

Yeah I agree affinity is a strange beast to keep with thread type. What's implemented here is just that if any lease requires non-affinity-changing, then affinity will be inhibited.
So LMK when you've landed the other CL then?

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne 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: I5fe815b407320e21d0b7780baa3e9815f857a935
Gerrit-Change-Number: 7532481
Gerrit-PatchSet: 12
Gerrit-Owner: Markus Handell <hand...@google.com>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Markus Handell <hand...@google.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Comment-Date: Wed, 04 Feb 2026 11:56:43 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Markus Handell (Gerrit)

unread,
Feb 4, 2026, 6:57:14 AMFeb 4
to Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
Attention needed from Etienne Pierre-Doray

Markus Handell added 1 comment

File third_party/blink/public/platform/scheduler/web_thread_scheduler.h
Line 77, Patchset 10: virtual void DonateThreadTypeLease(
Etienne Pierre-Doray . resolved

Discussed in chat, it might be possible to just have MTSI create its own lease.

Markus Handell

Done

Gerrit-Comment-Date: Wed, 04 Feb 2026 11:57:00 +0000
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
Feb 5, 2026, 1:27:37 PMFeb 5
to Markus Handell, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
Attention needed from Markus Handell

Etienne Pierre-Doray added 3 comments

File base/threading/platform_thread.h
Line 538, Patchset 12 (Latest): void (*set_current_thread_type_impl_)(ThreadType, MessagePumpType, bool);
Etienne Pierre-Doray . unresolved

Nit: replacing this by a virtual SetCurrentThreadType() method seems like intrusive as a way to have test mocks.

Line 244, Patchset 12 (Latest): std::optional<ThreadType> thread_type() const {
Etienne Pierre-Doray . unresolved

It's not immediately clear why this is an optional. Looking at the impl it looks like the becomes nullopt if the object is std::move().
I couldn't find any usage though, so maybe we just remove it?
Or we could also disallow move constructor.

File base/threading/platform_thread.cc
Line 161, Patchset 10: bool may_change_affinity = inhibit_affinity_count_ == 0;
Etienne Pierre-Doray . unresolved

If find this quite confusing: what if there's

  • kPresentation with may_change_affinity = false
  • kAudioProcessing with may_change_affinity = true

Then we wouldn't change affinity but the intention was probably to change it.
Since may_change_affinity is only used for ScopedBoostPriority, I'm trying something here: https://chromium-review.googlesource.com/c/chromium/src/+/7539489
That will make ScopedBoostPriority/ScopedBoostablePriority quite similar, and we should just forbid creating a lease under a ScopedBoostPriority.

Markus Handell

Yeah I agree affinity is a strange beast to keep with thread type. What's implemented here is just that if any lease requires non-affinity-changing, then affinity will be inhibited.
So LMK when you've landed the other CL then?

Etienne Pierre-Doray

https://chromium-review.googlesource.com/c/chromium/src/+/7539489 landed
So we should be able to remove may_change_affinity

Open in Gerrit

Related details

Attention is currently required from:
  • Markus Handell
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: I5fe815b407320e21d0b7780baa3e9815f857a935
Gerrit-Change-Number: 7532481
Gerrit-PatchSet: 12
Gerrit-Owner: Markus Handell <hand...@google.com>
Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
Gerrit-Reviewer: Markus Handell <hand...@google.com>
Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
Gerrit-CC: Stephen Chenney <sche...@chromium.org>
Gerrit-Attention: Markus Handell <hand...@google.com>
Gerrit-Comment-Date: Thu, 05 Feb 2026 18:27:32 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Markus Handell <hand...@google.com>
Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
satisfied_requirement
unsatisfied_requirement
open
diffy

Etienne Pierre-Doray (Gerrit)

unread,
Feb 6, 2026, 7:43:26 AMFeb 6
to Markus Handell, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
Attention needed from Markus Handell

Etienne Pierre-Doray added 1 comment

File base/threading/scoped_thread_priority.cc
Line 80, Patchset 12 (Latest): return num_scoped_boostable_priority_instances > 0;
Etienne Pierre-Doray . unresolved

I landed a CL that keeps track of this as a linked list
https://chromium-review.googlesource.com/c/chromium/src/+/7545022
So this can be replaced by `current_boost_scope`
Nit: This could become `ScopedBoostPriorityBase::CurrentThreadHasScope()`

Gerrit-Comment-Date: Fri, 06 Feb 2026 12:43:21 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
satisfied_requirement
unsatisfied_requirement
open
diffy

Markus Handell (Gerrit)

unread,
Feb 9, 2026, 9:47:13 AM (13 days ago) Feb 9
to Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
Attention needed from Etienne Pierre-Doray

Markus Handell added 4 comments

File base/threading/platform_thread.h
Line 538, Patchset 12: void (*set_current_thread_type_impl_)(ThreadType, MessagePumpType, bool);
Etienne Pierre-Doray . resolved

Nit: replacing this by a virtual SetCurrentThreadType() method seems like intrusive as a way to have test mocks.

Markus Handell

Replaced with virtual method at the expense of slightly more complex usage due to not trivially destructible anymore.

Line 244, Patchset 12: std::optional<ThreadType> thread_type() const {
Etienne Pierre-Doray . resolved

It's not immediately clear why this is an optional. Looking at the impl it looks like the becomes nullopt if the object is std::move().
I couldn't find any usage though, so maybe we just remove it?
Or we could also disallow move constructor.

Markus Handell

It's used in the follow-up in the chain. Yes correct, used to disable moved objects. The follow-up CL doesn't make use of move leases anymore so I removed movability and am relaxing tests a bit.

File base/threading/platform_thread.cc
Line 161, Patchset 10: bool may_change_affinity = inhibit_affinity_count_ == 0;
Etienne Pierre-Doray . resolved

If find this quite confusing: what if there's

  • kPresentation with may_change_affinity = false
  • kAudioProcessing with may_change_affinity = true

Then we wouldn't change affinity but the intention was probably to change it.
Since may_change_affinity is only used for ScopedBoostPriority, I'm trying something here: https://chromium-review.googlesource.com/c/chromium/src/+/7539489
That will make ScopedBoostPriority/ScopedBoostablePriority quite similar, and we should just forbid creating a lease under a ScopedBoostPriority.

Markus Handell

Yeah I agree affinity is a strange beast to keep with thread type. What's implemented here is just that if any lease requires non-affinity-changing, then affinity will be inhibited.
So LMK when you've landed the other CL then?

Etienne Pierre-Doray

https://chromium-review.googlesource.com/c/chromium/src/+/7539489 landed
So we should be able to remove may_change_affinity

Markus Handell

Done

File base/threading/scoped_thread_priority.cc
Line 80, Patchset 12: return num_scoped_boostable_priority_instances > 0;
Etienne Pierre-Doray . resolved

I landed a CL that keeps track of this as a linked list
https://chromium-review.googlesource.com/c/chromium/src/+/7545022
So this can be replaced by `current_boost_scope`
Nit: This could become `ScopedBoostPriorityBase::CurrentThreadHasScope()`

Markus Handell

Done

Open in Gerrit

Related details

Attention is currently required from:
  • Etienne Pierre-Doray
Submit Requirements:
    • requirement satisfiedCode-Coverage
    • requirement is not 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: I5fe815b407320e21d0b7780baa3e9815f857a935
    Gerrit-Change-Number: 7532481
    Gerrit-PatchSet: 13
    Gerrit-Owner: Markus Handell <hand...@google.com>
    Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Reviewer: Markus Handell <hand...@google.com>
    Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
    Gerrit-CC: Stephen Chenney <sche...@chromium.org>
    Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
    Gerrit-Comment-Date: Mon, 09 Feb 2026 14:47:00 +0000
    Gerrit-HasComments: Yes
    Gerrit-Has-Labels: No
    satisfied_requirement
    unsatisfied_requirement
    open
    diffy

    Etienne Pierre-Doray (Gerrit)

    unread,
    Feb 9, 2026, 1:23:49 PM (13 days ago) Feb 9
    to Markus Handell, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
    Attention needed from Markus Handell

    Etienne Pierre-Doray voted and added 7 comments

    Votes added by Etienne Pierre-Doray

    Code-Review+1

    7 comments

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

    LGTM % comment
    I'm wondering about this call: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc;l=807;drc=e63596721df61bbc199c38c4a102597ad81ad154;bpv=1;bpt=1

    Landing this will effectively cancel the effect of SchedulingPolicy::Feature::kWebRTC AFAICT. This is desirable long term but I don't know if you intend to roll out this way.

    File base/threading/platform_thread.h
    Line 491, Patchset 14 (Latest): std::optional<ThreadType> effective_;
    Etienne Pierre-Doray . unresolved

    Nit: effective_thread_type_

    Line 490, Patchset 14 (Latest): std::optional<ThreadType> base_;
    Etienne Pierre-Doray . unresolved

    Nit: default_thread_type_

    Line 478, Patchset 14 (Latest): void SetCurrent(ThreadType type);
    Etienne Pierre-Doray . unresolved

    Nit: SetDefault()

    Line 196, Patchset 14 (Latest): // The `may_change_affinity` parameter determines whether this call can
    // change the thread CPU affinity on platforms where it is available. It
    // should only be used in cases where e.g. a temporary thread boost should
    // not change placement.
    Etienne Pierre-Doray . unresolved

    Nit: Remove stale comment.

    File base/threading/platform_thread.cc
    Line 44, Patchset 14 (Latest):void PlatformThreadBase::SetCurrentThreadType(ThreadType thread_type) {
    Etienne Pierre-Doray . unresolved

    Since GetCurrentThreadType() returns something different than this, I would rename SetDefaultThreadType() for less confusion. But this can be a follow-up that I do; maybe simply add a TODO at the declaration.

    Line 104, Patchset 14 (Latest): DCHECK(!(ScopedBoostablePriority::CurrentThreadHasScope() &&
    highest_lease.has_value()));
    Etienne Pierre-Doray . unresolved

    Can we do `DCHECK(!ScopedBoostablePriority::CurrentThreadHasScope())` in RaiseThreadTypeLease's constructor?
    That seems simpler than MaybeUpdate() that's called in other places.

    Open in Gerrit

    Related details

    Attention is currently required from:
    • Markus Handell
    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: I5fe815b407320e21d0b7780baa3e9815f857a935
      Gerrit-Change-Number: 7532481
      Gerrit-PatchSet: 14
      Gerrit-Owner: Markus Handell <hand...@google.com>
      Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
      Gerrit-Reviewer: Markus Handell <hand...@google.com>
      Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
      Gerrit-CC: Stephen Chenney <sche...@chromium.org>
      Gerrit-Attention: Markus Handell <hand...@google.com>
      Gerrit-Comment-Date: Mon, 09 Feb 2026 18:23:41 +0000
      Gerrit-HasComments: Yes
      Gerrit-Has-Labels: Yes
      satisfied_requirement
      unsatisfied_requirement
      open
      diffy

      Markus Handell (Gerrit)

      unread,
      Feb 10, 2026, 8:10:42 AM (12 days ago) Feb 10
      to Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
      Attention needed from Etienne Pierre-Doray

      Markus Handell added 8 comments

      Patchset-level comments
      Etienne Pierre-Doray . resolved

      LGTM % comment
      I'm wondering about this call: https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc;l=807;drc=e63596721df61bbc199c38c4a102597ad81ad154;bpv=1;bpt=1

      Landing this will effectively cancel the effect of SchedulingPolicy::Feature::kWebRTC AFAICT. This is desirable long term but I don't know if you intend to roll out this way.

      Markus Handell

      Yep that was unintended, thanks for noticing. This should be fixed in the new PS.

      File base/threading/platform_thread.h
      Line 491, Patchset 14: std::optional<ThreadType> effective_;
      Etienne Pierre-Doray . resolved

      Nit: effective_thread_type_

      Markus Handell

      Done

      Line 490, Patchset 14: std::optional<ThreadType> base_;
      Etienne Pierre-Doray . resolved

      Nit: default_thread_type_

      Markus Handell

      Done

      Line 478, Patchset 14: void SetCurrent(ThreadType type);
      Etienne Pierre-Doray . resolved

      Nit: SetDefault()

      Markus Handell

      Done

      Line 196, Patchset 14: // The `may_change_affinity` parameter determines whether this call can

      // change the thread CPU affinity on platforms where it is available. It
      // should only be used in cases where e.g. a temporary thread boost should
      // not change placement.
      Etienne Pierre-Doray . resolved

      Nit: Remove stale comment.

      Markus Handell

      Done

      File base/threading/platform_thread.cc
      Line 44, Patchset 14:void PlatformThreadBase::SetCurrentThreadType(ThreadType thread_type) {
      Etienne Pierre-Doray . resolved

      Since GetCurrentThreadType() returns something different than this, I would rename SetDefaultThreadType() for less confusion. But this can be a follow-up that I do; maybe simply add a TODO at the declaration.

      Markus Handell

      Done

      Line 44, Patchset 14:void PlatformThreadBase::SetCurrentThreadType(ThreadType thread_type) {
      Etienne Pierre-Doray . resolved

      Since GetCurrentThreadType() returns something different than this, I would rename SetDefaultThreadType() for less confusion. But this can be a follow-up that I do; maybe simply add a TODO at the declaration.

      Markus Handell

      Added a TODO; maybe we should consider holding off on updating every caller after some grace time in prod in the interest of any rollbacks?

      Line 104, Patchset 14: DCHECK(!(ScopedBoostablePriority::CurrentThreadHasScope() &&
      highest_lease.has_value()));
      Etienne Pierre-Doray . resolved

      Can we do `DCHECK(!ScopedBoostablePriority::CurrentThreadHasScope())` in RaiseThreadTypeLease's constructor?
      That seems simpler than MaybeUpdate() that's called in other places.

      Markus Handell

      Done, and updated ScopedBoostPriorityBase to check for leases as well.

      Open in Gerrit

      Related details

      Attention is currently required from:
      • Etienne Pierre-Doray
      Submit Requirements:
        • requirement satisfiedCode-Coverage
        • requirement is not 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: I5fe815b407320e21d0b7780baa3e9815f857a935
        Gerrit-Change-Number: 7532481
        Gerrit-PatchSet: 16
        Gerrit-Owner: Markus Handell <hand...@google.com>
        Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Reviewer: Markus Handell <hand...@google.com>
        Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
        Gerrit-CC: Stephen Chenney <sche...@chromium.org>
        Gerrit-Attention: Etienne Pierre-Doray <etie...@chromium.org>
        Gerrit-Comment-Date: Tue, 10 Feb 2026 13:10:18 +0000
        Gerrit-HasComments: Yes
        Gerrit-Has-Labels: No
        Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
        satisfied_requirement
        unsatisfied_requirement
        open
        diffy

        Etienne Pierre-Doray (Gerrit)

        unread,
        Feb 10, 2026, 11:09:13 AM (12 days ago) Feb 10
        to Markus Handell, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
        Attention needed from Markus Handell

        Etienne Pierre-Doray voted and added 2 comments

        Votes added by Etienne Pierre-Doray

        Code-Review+1

        2 comments

        Patchset-level comments
        Etienne Pierre-Doray . resolved

        LGTM

        File base/threading/scoped_thread_priority.cc
        Line 53, Patchset 16 (Latest): DCHECK(!PlatformThread::CurrentThreadHasLeases());
        Etienne Pierre-Doray . unresolved

        It's fine to create a ScopedBoostPriority within a lease (and I think we sometimes will), so I don't think we want this check.

        But they must strictly nest, so I think we want to do `DCHECK(!ScopedBoostablePriority::CurrentThreadHasScope())` inside of ~RaiseThreadTypeLease

        Open in Gerrit

        Related details

        Attention is currently required from:
        • Markus Handell
        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: I5fe815b407320e21d0b7780baa3e9815f857a935
          Gerrit-Change-Number: 7532481
          Gerrit-PatchSet: 16
          Gerrit-Owner: Markus Handell <hand...@google.com>
          Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
          Gerrit-Reviewer: Markus Handell <hand...@google.com>
          Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
          Gerrit-CC: Stephen Chenney <sche...@chromium.org>
          Gerrit-Attention: Markus Handell <hand...@google.com>
          Gerrit-Comment-Date: Tue, 10 Feb 2026 16:09:08 +0000
          Gerrit-HasComments: Yes
          Gerrit-Has-Labels: Yes
          satisfied_requirement
          unsatisfied_requirement
          open
          diffy

          Markus Handell (Gerrit)

          unread,
          Feb 10, 2026, 11:24:18 AM (12 days ago) Feb 10
          to Francois Pierre Doray, Daniel Cheng, Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
          Attention needed from Daniel Cheng and Francois Pierre Doray

          Markus Handell added 1 comment

          File base/threading/scoped_thread_priority.cc
          Line 53, Patchset 16: DCHECK(!PlatformThread::CurrentThreadHasLeases());
          Etienne Pierre-Doray . resolved

          It's fine to create a ScopedBoostPriority within a lease (and I think we sometimes will), so I don't think we want this check.

          But they must strictly nest, so I think we want to do `DCHECK(!ScopedBoostablePriority::CurrentThreadHasScope())` inside of ~RaiseThreadTypeLease

          Markus Handell

          Done

          Open in Gerrit

          Related details

          Attention is currently required from:
          • Daniel Cheng
          • Francois Pierre Doray
          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: I5fe815b407320e21d0b7780baa3e9815f857a935
            Gerrit-Change-Number: 7532481
            Gerrit-PatchSet: 16
            Gerrit-Owner: Markus Handell <hand...@google.com>
            Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
            Gerrit-Reviewer: Markus Handell <hand...@google.com>
            Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
            Gerrit-CC: Stephen Chenney <sche...@chromium.org>
            Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
            Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
            Gerrit-Comment-Date: Tue, 10 Feb 2026 16:24:04 +0000
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Markus Handell (Gerrit)

            unread,
            Feb 10, 2026, 11:25:11 AM (12 days ago) Feb 10
            to Francois Pierre Doray, Daniel Cheng, Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
            Attention needed from Daniel Cheng and Francois Pierre Doray

            Markus Handell added 1 comment

            Patchset-level comments
            File-level comment, Patchset 17 (Latest):
            Markus Handell . resolved

            dcheng for renderer_main.cc, fdoray for the rest

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Daniel Cheng
            • Francois Pierre Doray
            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: I5fe815b407320e21d0b7780baa3e9815f857a935
            Gerrit-Change-Number: 7532481
            Gerrit-PatchSet: 17
            Gerrit-Owner: Markus Handell <hand...@google.com>
            Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
            Gerrit-Reviewer: Markus Handell <hand...@google.com>
            Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
            Gerrit-CC: Stephen Chenney <sche...@chromium.org>
            Gerrit-Attention: Francois Pierre Doray <fdo...@chromium.org>
            Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
            Gerrit-Comment-Date: Tue, 10 Feb 2026 16:24:59 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: No
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Francois Pierre Doray (Gerrit)

            unread,
            Feb 10, 2026, 5:15:52 PM (11 days ago) Feb 10
            to Markus Handell, Daniel Cheng, Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
            Attention needed from Daniel Cheng and Markus Handell

            Francois Pierre Doray voted Code-Review+1

            Code-Review+1
            Open in Gerrit

            Related details

            Attention is currently required from:
            • Daniel Cheng
            • Markus Handell
            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: I5fe815b407320e21d0b7780baa3e9815f857a935
            Gerrit-Change-Number: 7532481
            Gerrit-PatchSet: 17
            Gerrit-Owner: Markus Handell <hand...@google.com>
            Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
            Gerrit-Reviewer: Markus Handell <hand...@google.com>
            Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
            Gerrit-CC: Stephen Chenney <sche...@chromium.org>
            Gerrit-Attention: Markus Handell <hand...@google.com>
            Gerrit-Attention: Daniel Cheng <dch...@chromium.org>
            Gerrit-Comment-Date: Tue, 10 Feb 2026 22:15:47 +0000
            Gerrit-HasComments: No
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Daniel Cheng (Gerrit)

            unread,
            Feb 10, 2026, 7:40:19 PM (11 days ago) Feb 10
            to Markus Handell, Daniel Cheng, Francois Pierre Doray, Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
            Attention needed from Markus Handell

            Daniel Cheng voted and added 11 comments

            Votes added by Daniel Cheng

            Code-Review+1

            11 comments

            Patchset-level comments
            Daniel Cheng . unresolved

            LGTM w/nits

            Overall, I do think the interaction between `ScopedPriorityBoost` and `RaiseThreadTypeLease`; I get the impression that they don't serve exactly the same purpose, but it's not also not 100% clear to me:

            • when one is appropriate vs the other
            • how they interact
            • So improving the documentation here would also be good for a followup
            File base/task/thread_type.cc
            Line 25, Patchset 16: }
            Daniel Cheng . unresolved
            Nit:
            ```suggestion
            }
            NOTREACHED();
            ```
            File base/threading/platform_thread.h
            Line 491, Patchset 16: // they're the first type set on the thread.
            Daniel Cheng . unresolved

            At least to me, this comment doesn't really help me understand why this is OK only if they're the first type set on the thread. I feel like there are some other assumptions about the system that should probably be mentioned here.

            (Maybe it'll be less confusing once the current renames above are done?)

            Line 472, Patchset 16: uint32_t bitmask = 0;
            Daniel Cheng . unresolved

            These two fields need some comments.

            Line 471, Patchset 16: 0};
            Daniel Cheng . unresolved

            I would omit this, because what this actually means is "explicitly initialize the first element to zero and then initialize the remaining elements from an empty initializer list".

            See https://en.cppreference.com/w/cpp/language/list_initialization.html and https://en.cppreference.com/w/cpp/language/aggregate_initialization.html. In the latter, for "Implicitly initialized elements":

            Otherwise, if the element is not a reference, the element is copy-initialized from an empty initializer list.
            ```suggestion
            };
            ```
            Line 461, Patchset 16:class BASE_EXPORT ThreadTypeManager {
            Daniel Cheng . unresolved

            This class should have a comment of some sort that describes it's API, even if it's in `internal`.

            File base/threading/platform_thread.cc
            Line 24, Patchset 16: if (CurrentIOThread::IsSet()) {
            Daniel Cheng . unresolved

            I think this is pre-existing, but perhaps it'd be nice to come back here and clarify in a comment if both these bits can be set, and if so, why IO thread takes precedence.

            Line 85, Patchset 16: // The lease system is currently not compatible with ScopedBoostablePriority.
            Daniel Cheng . unresolved

            Is there a crbug to fix this? Or are they fundamentally incompatible? It's unclear if this should be a TODO with a crbug or not.

            Line 139, Patchset 16: bitmask |= (1u << type);
            Daniel Cheng . unresolved

            Maybe a TODO to use `base::EnumSet` here would be appropriate.

            File base/threading/platform_thread_unittest.cc
            Line 25, Patchset 16:std::ostream& operator<<(std::ostream& os, ThreadType type) {
            Daniel Cheng . unresolved

            If you feel we need these (I thought googletest has some default printing for enums, even if it's not as helpful as possible), they need to be defined alongside where the type is defined to avoid ODR violations.

            File base/threading/scoped_thread_priority.cc
            Line 52, Patchset 16: // used at the same time.
            Daniel Cheng . unresolved

            Same question about whether or not a TODO is appropriate here.

            Open in Gerrit

            Related details

            Attention is currently required from:
            • Markus Handell
            Submit Requirements:
            • requirement satisfiedCode-Coverage
            • requirement 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: I5fe815b407320e21d0b7780baa3e9815f857a935
            Gerrit-Change-Number: 7532481
            Gerrit-PatchSet: 17
            Gerrit-Owner: Markus Handell <hand...@google.com>
            Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
            Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
            Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
            Gerrit-Reviewer: Markus Handell <hand...@google.com>
            Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
            Gerrit-CC: Stephen Chenney <sche...@chromium.org>
            Gerrit-Attention: Markus Handell <hand...@google.com>
            Gerrit-Comment-Date: Wed, 11 Feb 2026 00:40:10 +0000
            Gerrit-HasComments: Yes
            Gerrit-Has-Labels: Yes
            satisfied_requirement
            unsatisfied_requirement
            open
            diffy

            Markus Handell (Gerrit)

            unread,
            Feb 11, 2026, 8:03:35 AM (11 days ago) Feb 11
            to Daniel Cheng, Francois Pierre Doray, Etienne Pierre-Doray, Chromium LUCI CQ, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org

            Markus Handell added 11 comments

            Patchset-level comments
            File-level comment, Patchset 17:
            Daniel Cheng . resolved

            LGTM w/nits

            Overall, I do think the interaction between `ScopedPriorityBoost` and `RaiseThreadTypeLease`; I get the impression that they don't serve exactly the same purpose, but it's not also not 100% clear to me:

            • when one is appropriate vs the other
            • how they interact
            • So improving the documentation here would also be good for a followup
            Markus Handell

            Ack, @etie...@chromium.org perhaps let's discuss this on newly filed https://g-issues.chromium.org/issues/483622914?

            File base/task/thread_type.cc
            Line 25, Patchset 16: }
            Daniel Cheng . resolved
            Nit:
            ```suggestion
            }
            NOTREACHED();
            ```
            Markus Handell

            Done

            File base/threading/platform_thread.h
            Line 491, Patchset 16: // they're the first type set on the thread.
            Daniel Cheng . resolved

            At least to me, this comment doesn't really help me understand why this is OK only if they're the first type set on the thread. I feel like there are some other assumptions about the system that should probably be mentioned here.

            (Maybe it'll be less confusing once the current renames above are done?)

            Markus Handell

            Agree the comment isn't good enough. It's ok to create leases when it's non-nullopt too, it's just that the lease may not be effective (consider a kDefault base priority, and kBackground lease - the lease will not change priority). We need the optional to discriminate between the "thread type currently unmanaged" and the "thread type managed by lease or default" states. I added doc comments that hopefully should help clarify.

            Line 472, Patchset 16: uint32_t bitmask = 0;
            Daniel Cheng . resolved

            These two fields need some comments.

            Markus Handell

            Done

            Daniel Cheng . resolved

            I would omit this, because what this actually means is "explicitly initialize the first element to zero and then initialize the remaining elements from an empty initializer list".

            See https://en.cppreference.com/w/cpp/language/list_initialization.html and https://en.cppreference.com/w/cpp/language/aggregate_initialization.html. In the latter, for "Implicitly initialized elements":

            Otherwise, if the element is not a reference, the element is copy-initialized from an empty initializer list.
            ```suggestion
            };
            ```
            Markus Handell

            Done

            Line 461, Patchset 16:class BASE_EXPORT ThreadTypeManager {
            Daniel Cheng . resolved

            This class should have a comment of some sort that describes it's API, even if it's in `internal`.

            Markus Handell

            Done

            File base/threading/platform_thread.cc
            Line 24, Patchset 16: if (CurrentIOThread::IsSet()) {
            Daniel Cheng . resolved

            I think this is pre-existing, but perhaps it'd be nice to come back here and clarify in a comment if both these bits can be set, and if so, why IO thread takes precedence.

            Markus Handell

            Looked into the code and clarified that they can not be set at the same time.

            Line 85, Patchset 16: // The lease system is currently not compatible with ScopedBoostablePriority.
            Daniel Cheng . resolved

            Is there a crbug to fix this? Or are they fundamentally incompatible? It's unclear if this should be a TODO with a crbug or not.

            Markus Handell

            I've filed crbug.com/483622914 on this topic. Unlike with leases, you can control thread type in ScopedBoostableThread from another thread, and affinity is managed. ScopedBoostableThread and leases aren't fully incompatible, as using the former while the latter exists works (but not the other way around). Rephrased the doc comment.

            Line 139, Patchset 16: bitmask |= (1u << type);
            Daniel Cheng . resolved

            Maybe a TODO to use `base::EnumSet` here would be appropriate.

            Markus Handell

            Done

            File base/threading/platform_thread_unittest.cc
            Line 25, Patchset 16:std::ostream& operator<<(std::ostream& os, ThreadType type) {
            Daniel Cheng . resolved

            If you feel we need these (I thought googletest has some default printing for enums, even if it's not as helpful as possible), they need to be defined alongside where the type is defined to avoid ODR violations.

            Markus Handell

            Yes, and it was defined in platform_thread.cc, but I placed it here on request by etiennep@ who will migrate for some later ThreadPool business.

            File base/threading/scoped_thread_priority.cc
            Line 52, Patchset 16: // used at the same time.
            Daniel Cheng . resolved

            Same question about whether or not a TODO is appropriate here.

            Markus Handell

            The code you commented on was removed in the later patch set. I've equipped the platform thread code with documentary & todos. I equipped the header with TODOs on the relevant classes.

            Open in Gerrit

            Related details

            Attention set is empty
            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: I5fe815b407320e21d0b7780baa3e9815f857a935
              Gerrit-Change-Number: 7532481
              Gerrit-PatchSet: 19
              Gerrit-Owner: Markus Handell <hand...@google.com>
              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
              Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
              Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
              Gerrit-Reviewer: Markus Handell <hand...@google.com>
              Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
              Gerrit-CC: Stephen Chenney <sche...@chromium.org>
              Gerrit-Comment-Date: Wed, 11 Feb 2026 13:03:21 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
              satisfied_requirement
              open
              diffy

              Chromium LUCI CQ (Gerrit)

              unread,
              Feb 11, 2026, 8:55:41 AM (11 days ago) Feb 11
              to Markus Handell, Daniel Cheng, Francois Pierre Doray, Etienne Pierre-Doray, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org

              Chromium LUCI CQ submitted the change with unreviewed changes

              Unreviewed changes

              17 is the latest approved patch-set.
              The change was submitted with unreviewed changes in the following files:

              ```
              The name of the file: base/task/thread_type.cc
              Insertions: 3, Deletions: 0.

              The diff is too large to show. Please review the diff.
              ```
              ```
              The name of the file: base/threading/scoped_thread_priority.h
              Insertions: 4, Deletions: 0.

              The diff is too large to show. Please review the diff.
              ```
              ```
              The name of the file: base/threading/platform_thread.cc
              Insertions: 21, Deletions: 4.

              The diff is too large to show. Please review the diff.
              ```
              ```
              The name of the file: base/threading/platform_thread.h
              Insertions: 24, Deletions: 4.

              The diff is too large to show. Please review the diff.
              ```

              Change information

              Commit message:
              PlatformThread: implement a lease system for thread types

              Currently, managing thread priority involves manual calls to
              SetCurrentThreadType, which can lead to conflicts or incorrect
              states when multiple components attempt to boost or restore a
              thread's priority.

              There's also future need to manage leases of higher priority
              from objects, existing on potentially the same threads, and that
              do not have a relation to each other.

              This patch introduces a lease-based management system:
              - Introduces base::internal::ThreadTypeManager to track a thread's
              base type and active leases.
              - Added PlatformThread::RaiseThreadTypeLease, a RAII object that
              ensures a thread's effective type is the maximum of all active
              leases and its base type.
              - Updated Blink's MainThreadSchedulerImpl and BeginFrameProvider
              to use leases, simplifying the logic for boosting renderer threads
              to kPresentation and dropping them back during compositor gestures.
              Bug: 470337728
              Change-Id: I5fe815b407320e21d0b7780baa3e9815f857a935
              Reviewed-by: Etienne Pierre-Doray <etie...@chromium.org>
              Reviewed-by: Francois Pierre Doray <fdo...@chromium.org>
              Commit-Queue: Markus Handell <hand...@google.com>
              Reviewed-by: Daniel Cheng <dch...@chromium.org>
              Cr-Commit-Position: refs/heads/main@{#1583175}
              Files:
              • M base/BUILD.gn
              • A base/task/thread_type.cc
              • M base/task/thread_type.h
              • M base/threading/platform_thread.cc
              • M base/threading/platform_thread.h
              • M base/threading/platform_thread_unittest.cc
              • M base/threading/scoped_thread_priority.cc
              • M base/threading/scoped_thread_priority.h
              • M content/renderer/renderer_main.cc
              • M third_party/blink/common/features.cc
              • M third_party/blink/public/common/features.h
              • M third_party/blink/renderer/platform/graphics/begin_frame_provider.cc
              • M third_party/blink/renderer/platform/graphics/begin_frame_provider.h
              • M third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.cc
              • M third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl.h
              • M third_party/blink/renderer/platform/scheduler/main_thread/frame_scheduler_impl_unittest.cc
              • M third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.cc
              • M third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl.h
              • M third_party/blink/renderer/platform/scheduler/main_thread/main_thread_scheduler_impl_unittest.cc
              Change size: L
              Delta: 19 files changed, 617 insertions(+), 68 deletions(-)
              Branch: refs/heads/main
              Submit Requirements:
              • requirement satisfiedCode-Review: +1 by Francois Pierre Doray, +1 by Etienne Pierre-Doray, +1 by Daniel Cheng
              Open in Gerrit
              Inspect html for hidden footers to help with email filtering. To unsubscribe visit settings. DiffyGerrit
              Gerrit-MessageType: merged
              Gerrit-Project: chromium/src
              Gerrit-Branch: main
              Gerrit-Change-Id: I5fe815b407320e21d0b7780baa3e9815f857a935
              Gerrit-Change-Number: 7532481
              Gerrit-PatchSet: 20
              Gerrit-Owner: Markus Handell <hand...@google.com>
              Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
              Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
              Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
              Gerrit-Reviewer: Markus Handell <hand...@google.com>
              open
              diffy
              satisfied_requirement

              Etienne Pierre-Doray (Gerrit)

              unread,
              Feb 11, 2026, 11:50:16 AM (11 days ago) Feb 11
              to Chromium LUCI CQ, Markus Handell, Daniel Cheng, Francois Pierre Doray, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org
              Attention needed from Markus Handell

              Etienne Pierre-Doray added 4 comments

              Patchset-level comments
              Daniel Cheng . resolved

              LGTM w/nits

              Overall, I do think the interaction between `ScopedPriorityBoost` and `RaiseThreadTypeLease`; I get the impression that they don't serve exactly the same purpose, but it's not also not 100% clear to me:

              • when one is appropriate vs the other
              • how they interact
              • So improving the documentation here would also be good for a followup
              Markus Handell

              Ack, @etie...@chromium.org perhaps let's discuss this on newly filed https://g-issues.chromium.org/issues/483622914?

              Etienne Pierre-Doray

              SG, we should clarify the interaction, but I don't think there'll be a plan to improve interaction because there isn't any use case for it, so maybe we should adjust the wording in consequence.

              File base/threading/platform_thread.h
              Line 491, Patchset 16: // they're the first type set on the thread.
              Daniel Cheng . unresolved

              At least to me, this comment doesn't really help me understand why this is OK only if they're the first type set on the thread. I feel like there are some other assumptions about the system that should probably be mentioned here.

              (Maybe it'll be less confusing once the current renames above are done?)

              Markus Handell

              Agree the comment isn't good enough. It's ok to create leases when it's non-nullopt too, it's just that the lease may not be effective (consider a kDefault base priority, and kBackground lease - the lease will not change priority). We need the optional to discriminate between the "thread type currently unmanaged" and the "thread type managed by lease or default" states. I added doc comments that hopefully should help clarify.

              Etienne Pierre-Doray

              FWIW, I'd expect a default thread type to always be set by the time a lease is created. (if that's the case we could simply DCHECK).
              See my other comment for renderer main though.

              File base/threading/platform_thread.cc
              Line 85, Patchset 16: // The lease system is currently not compatible with ScopedBoostablePriority.
              Daniel Cheng . resolved

              Is there a crbug to fix this? Or are they fundamentally incompatible? It's unclear if this should be a TODO with a crbug or not.

              Markus Handell

              I've filed crbug.com/483622914 on this topic. Unlike with leases, you can control thread type in ScopedBoostableThread from another thread, and affinity is managed. ScopedBoostableThread and leases aren't fully incompatible, as using the former while the latter exists works (but not the other way around). Rephrased the doc comment.

              Etienne Pierre-Doray

              SG, we should clarify the interaction, but I don't think there'll be a plan to improve interaction because there isn't any use case for it, so maybe we should adjust the wording in consequence.

              File content/renderer/renderer_main.cc
              Line 278, Patchset 20 (Parent): base::PlatformThread::SetCurrentThreadType(base::ThreadType::kPresentation);
              Etienne Pierre-Doray . unresolved

              We should still do SetCurrentThreadType(ThreadType::kDefault) before CreateMainThreadScheduler above no?
              See my other comment about always having a default threadtype

              Open in Gerrit

              Related details

              Attention is currently required from:
              • Markus Handell
              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: I5fe815b407320e21d0b7780baa3e9815f857a935
              Gerrit-Change-Number: 7532481
              Gerrit-PatchSet: 20
              Gerrit-Owner: Markus Handell <hand...@google.com>
              Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
              Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
              Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
              Gerrit-Reviewer: Markus Handell <hand...@google.com>
              Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
              Gerrit-CC: Stephen Chenney <sche...@chromium.org>
              Gerrit-Attention: Markus Handell <hand...@google.com>
              Gerrit-Comment-Date: Wed, 11 Feb 2026 16:50:10 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Markus Handell <hand...@google.com>
              Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
              satisfied_requirement
              open
              diffy

              Markus Handell (Gerrit)

              unread,
              Feb 11, 2026, 12:16:48 PM (11 days ago) Feb 11
              to Chromium LUCI CQ, Daniel Cheng, Francois Pierre Doray, Etienne Pierre-Doray, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org

              Markus Handell added 1 comment

              File base/threading/platform_thread.h
              Line 491, Patchset 16: // they're the first type set on the thread.
              Daniel Cheng . unresolved

              At least to me, this comment doesn't really help me understand why this is OK only if they're the first type set on the thread. I feel like there are some other assumptions about the system that should probably be mentioned here.

              (Maybe it'll be less confusing once the current renames above are done?)

              Markus Handell

              Agree the comment isn't good enough. It's ok to create leases when it's non-nullopt too, it's just that the lease may not be effective (consider a kDefault base priority, and kBackground lease - the lease will not change priority). We need the optional to discriminate between the "thread type currently unmanaged" and the "thread type managed by lease or default" states. I added doc comments that hopefully should help clarify.

              Etienne Pierre-Doray

              FWIW, I'd expect a default thread type to always be set by the time a lease is created. (if that's the case we could simply DCHECK).
              See my other comment for renderer main though.

              Markus Handell

              What's the scenario you're worried about?

              Open in Gerrit

              Related details

              Attention set is empty
              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: I5fe815b407320e21d0b7780baa3e9815f857a935
              Gerrit-Change-Number: 7532481
              Gerrit-PatchSet: 20
              Gerrit-Owner: Markus Handell <hand...@google.com>
              Gerrit-Reviewer: Chromium LUCI CQ <chromiu...@luci-project-accounts.iam.gserviceaccount.com>
              Gerrit-Reviewer: Daniel Cheng <dch...@chromium.org>
              Gerrit-Reviewer: Etienne Pierre-Doray <etie...@chromium.org>
              Gerrit-Reviewer: Francois Pierre Doray <fdo...@chromium.org>
              Gerrit-Reviewer: Markus Handell <hand...@google.com>
              Gerrit-CC: Dirk Schulze <dsch...@chromium.org>
              Gerrit-CC: Stephen Chenney <sche...@chromium.org>
              Gerrit-Comment-Date: Wed, 11 Feb 2026 17:16:36 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Markus Handell <hand...@google.com>
              Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
              Comment-In-Reply-To: Daniel Cheng <dch...@chromium.org>
              satisfied_requirement
              open
              diffy

              Etienne Pierre-Doray (Gerrit)

              unread,
              Feb 11, 2026, 1:34:51 PM (11 days ago) Feb 11
              to Chromium LUCI CQ, Markus Handell, Daniel Cheng, Francois Pierre Doray, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org

              Etienne Pierre-Doray added 1 comment

              File base/threading/platform_thread.h
              Line 491, Patchset 16: // they're the first type set on the thread.
              Daniel Cheng . resolved

              At least to me, this comment doesn't really help me understand why this is OK only if they're the first type set on the thread. I feel like there are some other assumptions about the system that should probably be mentioned here.

              (Maybe it'll be less confusing once the current renames above are done?)

              Markus Handell

              Agree the comment isn't good enough. It's ok to create leases when it's non-nullopt too, it's just that the lease may not be effective (consider a kDefault base priority, and kBackground lease - the lease will not change priority). We need the optional to discriminate between the "thread type currently unmanaged" and the "thread type managed by lease or default" states. I added doc comments that hopefully should help clarify.

              Etienne Pierre-Doray

              FWIW, I'd expect a default thread type to always be set by the time a lease is created. (if that's the case we could simply DCHECK).
              See my other comment for renderer main though.

              Markus Handell

              What's the scenario you're worried about?

              Etienne Pierre-Doray

              I had in mind we don't set ThreadType if the default isn't set, but that's not the case, so I think it's fine.

              Gerrit-Comment-Date: Wed, 11 Feb 2026 18:34:46 +0000
              satisfied_requirement
              open
              diffy

              Markus Handell (Gerrit)

              unread,
              Feb 12, 2026, 3:35:14 AM (10 days ago) Feb 12
              to Chromium LUCI CQ, Daniel Cheng, Francois Pierre Doray, Etienne Pierre-Doray, Stephen Chenney, Dirk Schulze, AyeAye, chromium...@chromium.org, scheduler...@chromium.org, blink-re...@chromium.org, blink-reviews-p...@chromium.org, blink-...@chromium.org, kinuko...@chromium.org, chikamu...@chromium.org, fserb...@chromium.org, drott+bl...@chromium.org, scheduler-...@chromium.org, fmalit...@chromium.org

              Markus Handell added 1 comment

              File content/renderer/renderer_main.cc
              Line 278, Patchset 20 (Parent): base::PlatformThread::SetCurrentThreadType(base::ThreadType::kPresentation);
              Etienne Pierre-Doray . resolved

              We should still do SetCurrentThreadType(ThreadType::kDefault) before CreateMainThreadScheduler above no?
              See my other comment about always having a default threadtype

              Markus Handell

              Acknowledged, no technical need at this point.

              Gerrit-Comment-Date: Thu, 12 Feb 2026 08:34:57 +0000
              Gerrit-HasComments: Yes
              Gerrit-Has-Labels: No
              Comment-In-Reply-To: Etienne Pierre-Doray <etie...@chromium.org>
              satisfied_requirement
              open
              diffy
              Reply all
              Reply to author
              Forward
              0 new messages