
-- Sequence Checker -- Inside a task run synchronously by RunOrPostTask, CalledOnValidSequence() behaves like in a posted task. -- Thread Checker -- Inside a task run synchronously by RunOrPostTask, CalledOnValidThread() returns true iff the Thread Checker was bound on the same thread and: - Outside of a task [1], or, - Inside the same task. A Thread Checker bound inside a task run synchronously by RunOrPostTask only returns true from CalledOnValidThread() within that same task. -- Implementation details -- We now lazily assign a SequenceToken to each thread. This ensures that all bound Sequence Checkers are associated with a valid SequenceToken (they could previously be assigned to an invalid SequenceToken). In a scope where RunOrPostTask runs a task synchronously, the current SequenceToken is set to the SequenceToken captured when the SequenceManager was bound to its thread. This allows Sequence Checker to behave the same way in a task run synchronously by RunOrPostTask and in a posted task (even if the Sequence Checker was bound before the SequenceManager was instantiated or bound to its thread). We no longer return false from CalledOnValidThread() when the Thread Checker was bound from a different task, bound to a valid sequence token, there is no default SingleThreadTaskRunner on the calling thread and TLS wasn't destroyed on the calling thread. This is because Thread Checker are now always bound to a valid SequenceToken. We rely on a new method CurrentTaskIsThreadBound() to determine if CalledOnValidThread() is deterministically or fortuitously called from the bound thread. We modified GpuWatchDogThread to use DCHECK(task_runner()->RunsTasksInCurrentSequence()) instead of a Sequence Checker. The GpuWatchDogThread can be stopped and started again [2]. Previously, its Sequence Checker falled back to PlatformThreadRef to verify sequenced execution, because it was bound to an invalid SequenceToken. By chance, the PlatformThreadRef was reused across restarts, so checks passed. Now that Sequence Checkers are always bound to a valid SequenceToken, checks wouldn't pass (SequenceToken isn't the same on the old and new threads). [1] ThreadGroupImpl::WorkerThreadDelegateImpl::worker_thread_checker_ depends on this. [2] https://source.chromium.org/chromium/chromium/src/+/main:content/gpu/gpu_main.cc;l=450;drc=8e78783dc1f7007bad46d657c9f332614e240fd8 Bug: 1503967 Change-Id: I295ecd716884ab97da7037ad1494d11235ce7865 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5074212 Commit-Queue: Maggie Chen <magchen@chromium.org> Reviewed-by: Maggie Chen <magchen@chromium.org> Reviewed-by: Etienne Pierre-Doray <etiennep@chromium.org> Auto-Submit: Francois Pierre Doray <fdoray@chromium.org> Cr-Commit-Position: refs/heads/main@{#1242801}
Chromium
Chromium is an open-source browser project that aims to build a safer, faster, and more stable way for all users to experience the web.
The project's web site is https://www.chromium.org.
To check out the source code locally, don't use git clone
! Instead,
follow the instructions on how to get the code.
Documentation in the source is rooted in docs/README.md.
Learn how to Get Around the Chromium Source Code Directory Structure.
For historical reasons, there are some small top level directories. Now the guidance is that new top level directories are for product (e.g. Chrome, Android WebView, Ash). Even if these products have multiple executables, the code should be in subdirectories of the product.
If you found a bug, please file it at https://crbug.com/new.