0
Files
src/codelabs
Scott Haseley 72d89b0bb8 SequenceManager: Make priorities configurable (yield API 1/n)
This CL makes SequenceManager priorities configurable through a new
SequenceManager::Settings option, with a single priority being
configured as the default. This is being done in advance of adding new
renderer-specific priorities to support `scheduler.yield()`, as well
as experimenting with downshifting priorities in backgrounded agents.

Configurable priorities have a few advantages:
 - Priority definitions are closer to where they're used, making it
   clear what priority system is being used where. This also enables
   better semantic (re)naming of priorities in the future, where it
   makes sense.
 - It prevents render-specific details from creeping into
   SequenceManager
 - It reduces data structure sizes for sequences that don't use
   priorities (currently only renderer main thread, (blink) workers,
   and browser UI thread).

SequenceManager is already (mostly) set up to handle an arbitrary
number of priorities; the main non-mechanical changes are:
 - A few data structures need to be vectors instead of arrays (this
   was cleaner and simpler than templating SequenceManager).
 - Tracing needs to support multiple priority systems, which is
   implemented with a configurable priority-to-proto-priority
   conversion function, along with expanding the proto enum to be the
   union of browser, renderer, and worker priorities.
 - TaskEnvironment is updated to support configurable priorities in
   its constructor, which BrowserTaskEnvironment uses to set up
   the required settings for the browser task queues.
 - The idle task priority is passed to IdleHelper along with the idle
   queue since it differs between main and non-main renderer threads.
   I'll try to set this set ahead of time in a follow-up, but this
   would have increased the complexity of this CL because of how things
   are constructed.

Bug: 979020
Low-Coverage-Reason: pure refactor / missing coverage predated this
Change-Id: I06b47347838c992bcecfe1fe69518c5e8835cdc9
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4114556
Commit-Queue: Scott Haseley <shaseley@chromium.org>
Reviewed-by: Francois Pierre Doray <fdoray@chromium.org>
Reviewed-by: Daniel Cheng <dcheng@chromium.org>
Reviewed-by: Alexander Timin <altimin@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1106608}
2023-02-17 03:29:25 +00:00
..
2023-01-06 18:10:52 +00:00

Chromium Codelab

See the cpp101/ directory for the Chromium C++ codelab, including example solutions.

See the threading_and_scheduling/ directory for more elaborate usages of the threading and scheduling primitives in Chromium.

Motivation

The goal of this codelab is to introduce new Chromium developers to both the important design patterns and the style of code they can expect to become familiar with.

The code in this directory is for documentation purposes only. It is compiled via the top level BUILD.gn's gn_all target to make sure it is kept up to date.