forked from chromium/chromium
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add cc::CommitState to snapshot state for compositor commit
Currently, compositor commit accesses LayerTreeHost directly from the impl thread. This is safe because the main thread is blocked during commit. However, Non-Blocking Commit is a project to eliminate main thread blocking during commit; so accessing LayerTreeHost from the impl thread during commit will no longer be safe. This CL adds struct CommitState, which contains a snapshot of (almost) all the information from LayerTreeHost needed for compositor commit. A bunch of member fields are moved out of LayerTreeHost and into CommitState; and LayerTreeHost gets pending_commit_state_ and active_commit_state_. pending_commit_state_ is read and written from the main thread while an animation frame is being prepared. active_commit_state_ is passed to the impl thread, which uses it to drive commit; it is only non-null while commit is running. Broadly speaking, LayerTreeHost data that is used by commit falls into two categories: attributes that persist from one commit to the next; and queues that are drained and passed to commit for processing. CommitState makes this distinction explicit. Rather than copying data from the pending state to the active state, LTH::ActivateCommitState() simply swaps pointers; assigns pending_commit_state_ to a new empty CommitState; and then copies back all persistent fields from the now-active CommitState. With this CL, there are still three data sources used during commit that are not thread safe: the layer tree, the property trees, and animation state. The strategy for Non-BlockingCommit is to enforce thread safety for these data by blocking the main thread only at the point where the main thread needs to modify them. Subsequent CL's will do that by adding calls to LTH::WaitForCommitCompletion() where necessary. Bug: 1237973,1255972 Change-Id: I3e9742e87539632ba1b0a7a13a79ccc5e08df1c7 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3228195 Reviewed-by: Khushal <khushalsagar@chromium.org> Reviewed-by: Jonathan Ross <jonross@chromium.org> Reviewed-by: vmpstr <vmpstr@chromium.org> Reviewed-by: enne <enne@chromium.org> Commit-Queue: Stefan Zager <szager@chromium.org> Cr-Commit-Position: refs/heads/main@{#936106}
- Loading branch information
1 parent
33e336a
commit 40f911d
Showing
81 changed files
with
1,729 additions
and
1,145 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.