[TreesInViz] Clean up cc.mojom.ElementId type traits
cc::ElementId has two reserved internal values, kInvalidElementId and kDeletedElementId, that are not expected to be constructed explicitly by clients. We need to be able to serialize these values over Mojo. The existing code handles the kInvalidElementId case via automatic nullability, but this is confusing, and also misses handling of the kDeletedElementId case. Instead, remove the nullability and handle both special values explicitly. Bug: 40902503 Change-Id: I54d2eb31a062bee1787cb8145eee035a15763d4c Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6535304 Commit-Queue: Victor Miura <vmiura@chromium.org> Reviewed-by: Alex Gough <ajgo@chromium.org> Reviewed-by: Fred Shih <ffred@chromium.org> Reviewed-by: Zhenyao Mo <zmo@chromium.org> Cr-Commit-Position: refs/heads/main@{#1459449}
This commit is contained in:

committed by
Chromium LUCI CQ

parent
f25630ea1f
commit
e3e69fe36d
cc/mojom
services/viz/public/mojom/compositing
@ -129,7 +129,6 @@ mojom("ui_resource_id") {
|
||||
{
|
||||
mojom = "cc.mojom.UIResourceId"
|
||||
cpp = "::cc::UIResourceId"
|
||||
nullable_is_same_type = true
|
||||
copyable_pass_by_value = true
|
||||
},
|
||||
]
|
||||
|
@ -14,14 +14,11 @@ namespace mojo {
|
||||
template <>
|
||||
struct StructTraits<cc::mojom::ElementIdDataView, cc::ElementId> {
|
||||
static uint64_t id(const cc::ElementId& id) { return id.GetInternalValue(); }
|
||||
|
||||
static bool IsNull(const cc::ElementId& id) { return !id; }
|
||||
|
||||
static void SetToNull(cc::ElementId* out) { *out = cc::ElementId(); }
|
||||
|
||||
static bool Read(cc::mojom::ElementIdDataView data, cc::ElementId* out) {
|
||||
if (data.id() == cc::ElementId::kInvalidElementId) {
|
||||
*out = cc::ElementId();
|
||||
} else if (data.id() == cc::ElementId::kDeletedElementId) {
|
||||
*out = cc::ElementId::DeletedValue();
|
||||
} else {
|
||||
*out = cc::ElementId(data.id());
|
||||
}
|
||||
|
@ -144,7 +144,7 @@ struct AnimationKeyframeModel {
|
||||
// Optional ElementId override to select the target element for this model.
|
||||
// By default its enclosing AnimationKeyframeEffect determines the target
|
||||
// ElementId.
|
||||
cc.mojom.ElementId? element_id;
|
||||
cc.mojom.ElementId element_id;
|
||||
|
||||
// Easing function to use by default between all keyframes.
|
||||
TimingFunction timing_function;
|
||||
@ -183,7 +183,7 @@ struct Animation {
|
||||
|
||||
// Optionally identifies a target element for the animation, mapping it to a
|
||||
// layer or property tree node which shares the same ElementId.
|
||||
cc.mojom.ElementId? element_id;
|
||||
cc.mojom.ElementId element_id;
|
||||
|
||||
// Keyframe models comprising the animation.
|
||||
array<AnimationKeyframeModel> keyframe_models;
|
||||
|
@ -151,7 +151,7 @@ struct Layer {
|
||||
// Optional stable identifier that may be referenced in property trees and
|
||||
// animations. Identifies a client-side object which can be represented by
|
||||
// multiple layers over time but only by a single layer at once.
|
||||
cc.mojom.ElementId? element_id;
|
||||
cc.mojom.ElementId element_id;
|
||||
|
||||
// Current cumulative dirty rect for the layer since last update, in layer
|
||||
// space.
|
||||
@ -238,7 +238,7 @@ struct TransformNode {
|
||||
|
||||
// The stable ElementId of the client-side object to which this transform node
|
||||
// applies.
|
||||
cc.mojom.ElementId? element_id;
|
||||
cc.mojom.ElementId element_id;
|
||||
|
||||
// Actual transformation parameters for this node. See cc::TransformNode.
|
||||
gfx.mojom.Transform local;
|
||||
@ -276,7 +276,7 @@ struct TransformNode {
|
||||
// The stable ElementId of the client-side object (e.g. document, in Blink)
|
||||
// corresponding to this node, if this node corresponds to the root of a
|
||||
// visible frame.
|
||||
cc.mojom.ElementId? visible_frame_element_id;
|
||||
cc.mojom.ElementId visible_frame_element_id;
|
||||
|
||||
// cc::DamageReasonsSet bit mask tracking the damage reasons for changes to
|
||||
// this node.
|
||||
@ -332,7 +332,7 @@ struct EffectNode {
|
||||
|
||||
// The stable ElementId of the client-side object to which this effect node
|
||||
// applies.
|
||||
cc.mojom.ElementId? element_id;
|
||||
cc.mojom.ElementId element_id;
|
||||
|
||||
// The opacity of drawn layers associated with this effect node.
|
||||
float opacity;
|
||||
@ -368,7 +368,7 @@ struct EffectNode {
|
||||
|
||||
// The element id corresponding to the mask to apply to the filtered backdrop
|
||||
// image.
|
||||
cc.mojom.ElementId? backdrop_mask_element_id;
|
||||
cc.mojom.ElementId backdrop_mask_element_id;
|
||||
|
||||
// The mask filter information applied to this effect node. The coordinates of
|
||||
// in the mask info is in the space of the transform node associated with this
|
||||
@ -438,7 +438,7 @@ struct ScrollNode {
|
||||
|
||||
// The stable ElementId of the scrollable client-side object to which this
|
||||
// scroll node applies.
|
||||
cc.mojom.ElementId? element_id;
|
||||
cc.mojom.ElementId element_id;
|
||||
|
||||
// Flags specifying the behavior of scrolls on this node.
|
||||
bool max_scroll_offset_affected_by_page_scale;
|
||||
|
Reference in New Issue
Block a user