1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 // IPC Messages sent between compositor instances.
7 #include "cc/output/begin_frame_args.h"
8 #include "cc/output/compositor_frame.h"
9 #include "cc/output/compositor_frame_ack.h"
10 #include "cc/output/filter_operation.h"
11 #include "cc/output/viewport_selection_bound.h"
12 #include "cc/quads/debug_border_draw_quad.h"
13 #include "cc/quads/draw_quad.h"
14 #include "cc/quads/io_surface_draw_quad.h"
15 #include "cc/quads/picture_draw_quad.h"
16 #include "cc/quads/render_pass.h"
17 #include "cc/quads/render_pass_draw_quad.h"
18 #include "cc/quads/shared_quad_state.h"
19 #include "cc/quads/solid_color_draw_quad.h"
20 #include "cc/quads/stream_video_draw_quad.h"
21 #include "cc/quads/surface_draw_quad.h"
22 #include "cc/quads/texture_draw_quad.h"
23 #include "cc/quads/tile_draw_quad.h"
24 #include "cc/quads/yuv_video_draw_quad.h"
25 #include "cc/resources/resource_format.h"
26 #include "cc/resources/returned_resource.h"
27 #include "cc/resources/transferable_resource.h"
28 #include "cc/surfaces/surface_id.h"
29 #include "cc/surfaces/surface_sequence.h"
30 #include "content/common/content_export.h"
31 #include "gpu/ipc/gpu_command_buffer_traits.h"
32 #include "ipc/ipc_message_macros.h"
33 #include "ui/gfx/ipc/gfx_param_traits.h"
35 #ifndef CONTENT_COMMON_CC_MESSAGES_H_
36 #define CONTENT_COMMON_CC_MESSAGES_H_
43 class FilterOperations
;
49 struct ParamTraits
<cc::FilterOperation
> {
50 typedef cc::FilterOperation param_type
;
51 static void Write(Message
* m
, const param_type
& p
);
52 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
53 static void Log(const param_type
& p
, std::string
* l
);
57 struct ParamTraits
<cc::FilterOperations
> {
58 typedef cc::FilterOperations param_type
;
59 static void Write(Message
* m
, const param_type
& p
);
60 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
61 static void Log(const param_type
& p
, std::string
* l
);
65 struct ParamTraits
<skia::RefPtr
<SkImageFilter
> > {
66 typedef skia::RefPtr
<SkImageFilter
> param_type
;
67 static void Write(Message
* m
, const param_type
& p
);
68 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
69 static void Log(const param_type
& p
, std::string
* l
);
73 struct ParamTraits
<gfx::Transform
> {
74 typedef gfx::Transform param_type
;
75 static void Write(Message
* m
, const param_type
& p
);
76 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
77 static void Log(const param_type
& p
, std::string
* l
);
81 struct CONTENT_EXPORT ParamTraits
<cc::RenderPass
> {
82 typedef cc::RenderPass param_type
;
83 static void Write(Message
* m
, const param_type
& p
);
84 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* r
);
85 static void Log(const param_type
& p
, std::string
* l
);
89 struct CONTENT_EXPORT ParamTraits
<cc::CompositorFrame
> {
90 typedef cc::CompositorFrame param_type
;
91 static void Write(Message
* m
, const param_type
& p
);
92 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
93 static void Log(const param_type
& p
, std::string
* l
);
97 struct CONTENT_EXPORT ParamTraits
<cc::CompositorFrameAck
> {
98 typedef cc::CompositorFrameAck param_type
;
99 static void Write(Message
* m
, const param_type
& p
);
100 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
101 static void Log(const param_type
& p
, std::string
* l
);
105 struct CONTENT_EXPORT ParamTraits
<cc::DelegatedFrameData
> {
106 typedef cc::DelegatedFrameData param_type
;
107 static void Write(Message
* m
, const param_type
& p
);
108 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
109 static void Log(const param_type
& p
, std::string
* l
);
113 struct CONTENT_EXPORT ParamTraits
<cc::DrawQuad::Resources
> {
114 typedef cc::DrawQuad::Resources param_type
;
115 static void Write(Message
* m
, const param_type
& p
);
116 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
117 static void Log(const param_type
& p
, std::string
* l
);
121 struct CONTENT_EXPORT ParamTraits
<cc::StreamVideoDrawQuad::OverlayResources
> {
122 typedef cc::StreamVideoDrawQuad::OverlayResources param_type
;
123 static void Write(Message
* m
, const param_type
& p
);
124 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
125 static void Log(const param_type
& p
, std::string
* l
);
129 struct CONTENT_EXPORT ParamTraits
<cc::TextureDrawQuad::OverlayResources
> {
130 typedef cc::TextureDrawQuad::OverlayResources param_type
;
131 static void Write(Message
* m
, const param_type
& p
);
132 static bool Read(const Message
* m
, base::PickleIterator
* iter
, param_type
* p
);
133 static void Log(const param_type
& p
, std::string
* l
);
138 #endif // CONTENT_COMMON_CC_MESSAGES_H_
140 // Multiply-included message file, hence no include guard.
142 #define IPC_MESSAGE_START CCMsgStart
143 #undef IPC_MESSAGE_EXPORT
144 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
146 IPC_ENUM_TRAITS_MAX_VALUE(cc::DrawQuad::Material
, cc::DrawQuad::MATERIAL_LAST
)
147 IPC_ENUM_TRAITS_MAX_VALUE(cc::IOSurfaceDrawQuad::Orientation
,
148 cc::IOSurfaceDrawQuad::ORIENTATION_LAST
)
149 IPC_ENUM_TRAITS_MAX_VALUE(cc::FilterOperation::FilterType
,
150 cc::FilterOperation::FILTER_TYPE_LAST
)
151 IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat
, cc::RESOURCE_FORMAT_MAX
)
152 IPC_ENUM_TRAITS_MAX_VALUE(cc::SelectionBoundType
, cc::SELECTION_BOUND_TYPE_LAST
)
153 IPC_ENUM_TRAITS_MAX_VALUE(SkXfermode::Mode
, SkXfermode::kLastMode
)
154 IPC_ENUM_TRAITS_MAX_VALUE(cc::YUVVideoDrawQuad::ColorSpace
,
155 cc::YUVVideoDrawQuad::COLOR_SPACE_LAST
)
157 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassId
)
158 IPC_STRUCT_TRAITS_MEMBER(layer_id
)
159 IPC_STRUCT_TRAITS_MEMBER(index
)
160 IPC_STRUCT_TRAITS_END()
162 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceId
)
163 IPC_STRUCT_TRAITS_MEMBER(id
)
164 IPC_STRUCT_TRAITS_END()
166 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceSequence
)
167 IPC_STRUCT_TRAITS_MEMBER(id_namespace
)
168 IPC_STRUCT_TRAITS_MEMBER(sequence
)
169 IPC_STRUCT_TRAITS_END()
171 IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad
)
172 IPC_STRUCT_TRAITS_MEMBER(material
)
173 IPC_STRUCT_TRAITS_MEMBER(rect
)
174 IPC_STRUCT_TRAITS_MEMBER(opaque_rect
)
175 IPC_STRUCT_TRAITS_MEMBER(visible_rect
)
176 IPC_STRUCT_TRAITS_MEMBER(needs_blending
)
177 IPC_STRUCT_TRAITS_MEMBER(resources
)
178 IPC_STRUCT_TRAITS_END()
180 IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad
)
181 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
182 IPC_STRUCT_TRAITS_MEMBER(color
)
183 IPC_STRUCT_TRAITS_MEMBER(width
)
184 IPC_STRUCT_TRAITS_END()
186 IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad
)
187 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
188 IPC_STRUCT_TRAITS_MEMBER(io_surface_size
)
189 IPC_STRUCT_TRAITS_MEMBER(orientation
)
190 IPC_STRUCT_TRAITS_END()
192 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad
)
193 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
194 IPC_STRUCT_TRAITS_MEMBER(render_pass_id
)
195 IPC_STRUCT_TRAITS_MEMBER(mask_uv_scale
)
196 IPC_STRUCT_TRAITS_MEMBER(mask_texture_size
)
197 IPC_STRUCT_TRAITS_MEMBER(filters
)
198 IPC_STRUCT_TRAITS_MEMBER(filters_scale
)
199 IPC_STRUCT_TRAITS_MEMBER(background_filters
)
200 IPC_STRUCT_TRAITS_END()
202 IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad
)
203 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
204 IPC_STRUCT_TRAITS_MEMBER(color
)
205 IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off
)
206 IPC_STRUCT_TRAITS_END()
208 IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad
)
209 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
210 IPC_STRUCT_TRAITS_MEMBER(overlay_resources
)
211 IPC_STRUCT_TRAITS_MEMBER(matrix
)
212 IPC_STRUCT_TRAITS_END()
214 IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceDrawQuad
)
215 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
216 IPC_STRUCT_TRAITS_MEMBER(surface_id
)
217 IPC_STRUCT_TRAITS_END()
219 IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad
)
220 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
221 IPC_STRUCT_TRAITS_MEMBER(overlay_resources
)
222 IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha
)
223 IPC_STRUCT_TRAITS_MEMBER(uv_top_left
)
224 IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right
)
225 IPC_STRUCT_TRAITS_MEMBER(background_color
)
226 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[0])
227 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[1])
228 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[2])
229 IPC_STRUCT_TRAITS_MEMBER(vertex_opacity
[3])
230 IPC_STRUCT_TRAITS_MEMBER(y_flipped
)
231 IPC_STRUCT_TRAITS_MEMBER(nearest_neighbor
)
232 IPC_STRUCT_TRAITS_END()
234 IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad
)
235 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
236 IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect
)
237 IPC_STRUCT_TRAITS_MEMBER(texture_size
)
238 IPC_STRUCT_TRAITS_MEMBER(swizzle_contents
)
239 IPC_STRUCT_TRAITS_MEMBER(nearest_neighbor
)
240 IPC_STRUCT_TRAITS_END()
242 IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad
)
243 IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad
)
244 IPC_STRUCT_TRAITS_MEMBER(ya_tex_coord_rect
)
245 IPC_STRUCT_TRAITS_MEMBER(uv_tex_coord_rect
)
246 IPC_STRUCT_TRAITS_MEMBER(ya_tex_size
)
247 IPC_STRUCT_TRAITS_MEMBER(uv_tex_size
)
248 IPC_STRUCT_TRAITS_MEMBER(color_space
)
249 IPC_STRUCT_TRAITS_END()
251 IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState
)
252 IPC_STRUCT_TRAITS_MEMBER(quad_to_target_transform
)
253 IPC_STRUCT_TRAITS_MEMBER(quad_layer_bounds
)
254 IPC_STRUCT_TRAITS_MEMBER(visible_quad_layer_rect
)
255 IPC_STRUCT_TRAITS_MEMBER(clip_rect
)
256 IPC_STRUCT_TRAITS_MEMBER(is_clipped
)
257 IPC_STRUCT_TRAITS_MEMBER(opacity
)
258 IPC_STRUCT_TRAITS_MEMBER(blend_mode
)
259 IPC_STRUCT_TRAITS_MEMBER(sorting_context_id
)
260 IPC_STRUCT_TRAITS_END()
262 IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource
)
263 IPC_STRUCT_TRAITS_MEMBER(id
)
264 IPC_STRUCT_TRAITS_MEMBER(format
)
265 IPC_STRUCT_TRAITS_MEMBER(filter
)
266 IPC_STRUCT_TRAITS_MEMBER(size
)
267 IPC_STRUCT_TRAITS_MEMBER(mailbox_holder
)
268 IPC_STRUCT_TRAITS_MEMBER(read_lock_fences_enabled
)
269 IPC_STRUCT_TRAITS_MEMBER(is_repeated
)
270 IPC_STRUCT_TRAITS_MEMBER(is_software
)
271 IPC_STRUCT_TRAITS_MEMBER(allow_overlay
)
272 IPC_STRUCT_TRAITS_END()
274 IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource
)
275 IPC_STRUCT_TRAITS_MEMBER(id
)
276 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
277 IPC_STRUCT_TRAITS_MEMBER(count
)
278 IPC_STRUCT_TRAITS_MEMBER(lost
)
279 IPC_STRUCT_TRAITS_END()
281 IPC_STRUCT_TRAITS_BEGIN(cc::ViewportSelectionBound
)
282 IPC_STRUCT_TRAITS_MEMBER(type
)
283 IPC_STRUCT_TRAITS_MEMBER(edge_top
)
284 IPC_STRUCT_TRAITS_MEMBER(edge_bottom
)
285 IPC_STRUCT_TRAITS_MEMBER(visible
)
286 IPC_STRUCT_TRAITS_END()
288 IPC_STRUCT_TRAITS_BEGIN(cc::ViewportSelection
)
289 IPC_STRUCT_TRAITS_MEMBER(start
)
290 IPC_STRUCT_TRAITS_MEMBER(end
)
291 IPC_STRUCT_TRAITS_MEMBER(is_editable
)
292 IPC_STRUCT_TRAITS_MEMBER(is_empty_text_form_control
)
293 IPC_STRUCT_TRAITS_END()
295 IPC_ENUM_TRAITS_MAX_VALUE( \
296 cc::BeginFrameArgs::BeginFrameArgsType
, \
297 cc::BeginFrameArgs::BEGIN_FRAME_ARGS_TYPE_MAX
- 1)
299 IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs
)
300 IPC_STRUCT_TRAITS_MEMBER(frame_time
)
301 IPC_STRUCT_TRAITS_MEMBER(deadline
)
302 IPC_STRUCT_TRAITS_MEMBER(interval
)
303 IPC_STRUCT_TRAITS_MEMBER(type
)
304 IPC_STRUCT_TRAITS_END()
306 IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata
)
307 IPC_STRUCT_TRAITS_MEMBER(device_scale_factor
)
308 IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset
)
309 IPC_STRUCT_TRAITS_MEMBER(page_scale_factor
)
310 IPC_STRUCT_TRAITS_MEMBER(scrollable_viewport_size
)
311 IPC_STRUCT_TRAITS_MEMBER(root_layer_size
)
312 IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor
)
313 IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor
)
314 IPC_STRUCT_TRAITS_MEMBER(root_overflow_x_hidden
)
315 IPC_STRUCT_TRAITS_MEMBER(root_overflow_y_hidden
)
316 IPC_STRUCT_TRAITS_MEMBER(location_bar_offset
)
317 IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation
)
318 IPC_STRUCT_TRAITS_MEMBER(selection
)
319 IPC_STRUCT_TRAITS_MEMBER(latency_info
)
320 IPC_STRUCT_TRAITS_MEMBER(satisfies_sequences
)
321 IPC_STRUCT_TRAITS_END()
323 IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData
)
324 IPC_STRUCT_TRAITS_MEMBER(mailbox
)
325 IPC_STRUCT_TRAITS_MEMBER(sync_point
)
326 IPC_STRUCT_TRAITS_MEMBER(size
)
327 IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect
)
328 IPC_STRUCT_TRAITS_END()