OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_ | 5 #ifndef CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_ |
6 #define CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_ | 6 #define CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_ |
7 | 7 |
8 #include "cc/ipc/compositor_frame_metadata.mojom.h" | 8 #include "cc/ipc/compositor_frame_metadata.mojom.h" |
9 #include "cc/output/compositor_frame_metadata.h" | 9 #include "cc/output/compositor_frame_metadata.h" |
10 | 10 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
86 const cc::CompositorFrameMetadata& metadata) { | 86 const cc::CompositorFrameMetadata& metadata) { |
87 return metadata.satisfies_sequences; | 87 return metadata.satisfies_sequences; |
88 } | 88 } |
89 | 89 |
90 static const std::vector<cc::SurfaceId>& referenced_surfaces( | 90 static const std::vector<cc::SurfaceId>& referenced_surfaces( |
91 const cc::CompositorFrameMetadata& metadata) { | 91 const cc::CompositorFrameMetadata& metadata) { |
92 return metadata.referenced_surfaces; | 92 return metadata.referenced_surfaces; |
93 } | 93 } |
94 | 94 |
95 static bool Read(cc::mojom::CompositorFrameMetadataDataView data, | 95 static bool Read(cc::mojom::CompositorFrameMetadataDataView data, |
96 cc::CompositorFrameMetadata* out) { | 96 cc::CompositorFrameMetadata* out); |
97 out->device_scale_factor = data.device_scale_factor(); | |
98 if (!data.ReadRootScrollOffset(&out->root_scroll_offset)) | |
99 return false; | |
100 | |
101 out->page_scale_factor = data.page_scale_factor(); | |
102 if (!data.ReadScrollableViewportSize(&out->scrollable_viewport_size) || | |
103 !data.ReadRootLayerSize(&out->root_layer_size)) { | |
104 return false; | |
105 } | |
106 | |
107 out->min_page_scale_factor = data.min_page_scale_factor(); | |
108 out->max_page_scale_factor = data.max_page_scale_factor(); | |
109 out->root_overflow_x_hidden = data.root_overflow_x_hidden(); | |
110 out->root_overflow_y_hidden = data.root_overflow_y_hidden(); | |
111 if (!data.ReadLocationBarOffset(&out->location_bar_offset) || | |
112 !data.ReadLocationBarContentTranslation( | |
113 &out->location_bar_content_translation)) { | |
114 return false; | |
115 } | |
116 | |
117 out->root_background_color = data.root_background_color(); | |
118 if (!data.ReadSelection(&out->selection) || | |
119 !data.ReadLatencyInfo(&out->latency_info) || | |
120 !data.ReadSatisfiesSequences(&out->satisfies_sequences) || | |
121 !data.ReadReferencedSurfaces(&out->referenced_surfaces)) { | |
122 return false; | |
123 } | |
124 return true; | |
125 } | |
126 }; | 97 }; |
127 | 98 |
128 } // namespace mojo | 99 } // namespace mojo |
129 | 100 |
130 #endif // CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_ | 101 #endif // CC_IPC_COMPOSITOR_FRAME_METADATA_STRUCT_TRAITS_H_ |
OLD | NEW |