This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
Revert "Fixed constness of display list storage." #52724
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the crux of your argument is around exposing this immutable data ( #52705 (comment) ). That decision is tied to #52715 since it accesses it.
Everything else in this PR is correct since it statically asserts correct constness, so you can make the revert just the removal of this method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is nothing wrong with the current implementation. Adding const in a few places is probably fine, but not needed since the storage is not exposed outside of the internal implementation.
Two questions I have is whether or not destructors are required to work on const objects (I supposed that they are or the PR would not have landed) and whether or not the internal const-ness (which isn't strictly necessary) would imply that the data in the buffer never changes (but it actually does - there are mutable fields in the data that provided required functions).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But, yes, the rest of it doesn't hurt anything and might be considered cleaner other than the fact that the data stream actually contains at least one (and potentially more as we migrate the text stuff to be Skia/Impeller-agnostic) mutable chunk of data.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we need mutable storage in DisplayList the correct solution would to make
DisplayList::storage_
not const. Previously it was declaredconst
but had the ability to mutate it because there was a const method that returned a non-const pointer.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It won't matter as the mutation happens on a const object contained within the DL that is passed to a Dispatch receiver - and it's the receiver that does the mutation.
My point was less "how are we going to do this" than "we do this and making this pointer const won't stop it, so are we sending the right message by making it const", but I think it is a minor point that doesn't matter...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The fact that the field is marked "mutable" already acknowledges that it is allowing mutation inside what is otherwise a const set of data, so I think the point is moot.