cc_messages.h revision 5f1c94371a64b3196d4be9466099bb892df9b88e
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.
4//
5// IPC Messages sent between compositor instances.
6
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/checkerboard_draw_quad.h"
13#include "cc/quads/debug_border_draw_quad.h"
14#include "cc/quads/draw_quad.h"
15#include "cc/quads/io_surface_draw_quad.h"
16#include "cc/quads/picture_draw_quad.h"
17#include "cc/quads/render_pass.h"
18#include "cc/quads/render_pass_draw_quad.h"
19#include "cc/quads/shared_quad_state.h"
20#include "cc/quads/solid_color_draw_quad.h"
21#include "cc/quads/stream_video_draw_quad.h"
22#include "cc/quads/surface_draw_quad.h"
23#include "cc/quads/texture_draw_quad.h"
24#include "cc/quads/tile_draw_quad.h"
25#include "cc/quads/yuv_video_draw_quad.h"
26#include "cc/resources/resource_format.h"
27#include "cc/resources/returned_resource.h"
28#include "cc/resources/transferable_resource.h"
29#include "cc/surfaces/surface_id.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"
34
35#ifndef CONTENT_COMMON_CC_MESSAGES_H_
36#define CONTENT_COMMON_CC_MESSAGES_H_
37
38namespace gfx {
39class Transform;
40}
41
42namespace cc {
43class FilterOperations;
44}
45
46namespace IPC {
47
48template <>
49struct 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, PickleIterator* iter, param_type* r);
53  static void Log(const param_type& p, std::string* l);
54};
55
56template <>
57struct 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, PickleIterator* iter, param_type* r);
61  static void Log(const param_type& p, std::string* l);
62};
63
64template <>
65struct 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, PickleIterator* iter, param_type* r);
69  static void Log(const param_type& p, std::string* l);
70};
71
72template <>
73struct 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, PickleIterator* iter, param_type* r);
77  static void Log(const param_type& p, std::string* l);
78};
79
80template <>
81struct 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, PickleIterator* iter, param_type* r);
85  static void Log(const param_type& p, std::string* l);
86};
87
88template<>
89struct 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, PickleIterator* iter, param_type* p);
93  static void Log(const param_type& p, std::string* l);
94};
95
96template<>
97struct 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, PickleIterator* iter, param_type* p);
101  static void Log(const param_type& p, std::string* l);
102};
103
104template<>
105struct 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, PickleIterator* iter, param_type* p);
109  static void Log(const param_type& p, std::string* l);
110};
111
112template <>
113struct CONTENT_EXPORT ParamTraits<cc::SoftwareFrameData> {
114  typedef cc::SoftwareFrameData param_type;
115  static void Write(Message* m, const param_type& p);
116  static bool Read(const Message* m, PickleIterator* iter, param_type* p);
117  static void Log(const param_type& p, std::string* l);
118};
119
120}  // namespace IPC
121
122#endif  // CONTENT_COMMON_CC_MESSAGES_H_
123
124// Multiply-included message file, hence no include guard.
125
126#define IPC_MESSAGE_START CCMsgStart
127#undef IPC_MESSAGE_EXPORT
128#define IPC_MESSAGE_EXPORT CONTENT_EXPORT
129
130IPC_ENUM_TRAITS_MAX_VALUE(cc::DrawQuad::Material, cc::DrawQuad::MATERIAL_LAST)
131IPC_ENUM_TRAITS_MAX_VALUE(cc::IOSurfaceDrawQuad::Orientation,
132                          cc::IOSurfaceDrawQuad::ORIENTATION_LAST)
133IPC_ENUM_TRAITS_MAX_VALUE(cc::FilterOperation::FilterType,
134                          cc::FilterOperation::FILTER_TYPE_LAST )
135IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat, cc::RESOURCE_FORMAT_MAX)
136IPC_ENUM_TRAITS_MAX_VALUE(cc::SelectionBoundType, cc::SELECTION_BOUND_TYPE_LAST)
137IPC_ENUM_TRAITS_MAX_VALUE(SkXfermode::Mode, SkXfermode::kLastMode)
138IPC_ENUM_TRAITS_MAX_VALUE(cc::YUVVideoDrawQuad::ColorSpace,
139                          cc::YUVVideoDrawQuad::COLOR_SPACE_LAST)
140
141IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id)
142  IPC_STRUCT_TRAITS_MEMBER(layer_id)
143  IPC_STRUCT_TRAITS_MEMBER(index)
144IPC_STRUCT_TRAITS_END()
145
146IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceId)
147IPC_STRUCT_TRAITS_MEMBER(id)
148IPC_STRUCT_TRAITS_END()
149
150IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad)
151  IPC_STRUCT_TRAITS_MEMBER(material)
152  IPC_STRUCT_TRAITS_MEMBER(rect)
153  IPC_STRUCT_TRAITS_MEMBER(opaque_rect)
154  IPC_STRUCT_TRAITS_MEMBER(visible_rect)
155  IPC_STRUCT_TRAITS_MEMBER(needs_blending)
156IPC_STRUCT_TRAITS_END()
157
158IPC_STRUCT_TRAITS_BEGIN(cc::CheckerboardDrawQuad)
159  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
160  IPC_STRUCT_TRAITS_MEMBER(color)
161IPC_STRUCT_TRAITS_END()
162
163IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad)
164  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
165  IPC_STRUCT_TRAITS_MEMBER(color)
166  IPC_STRUCT_TRAITS_MEMBER(width)
167IPC_STRUCT_TRAITS_END()
168
169IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad)
170  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
171  IPC_STRUCT_TRAITS_MEMBER(io_surface_size)
172  IPC_STRUCT_TRAITS_MEMBER(io_surface_resource_id)
173  IPC_STRUCT_TRAITS_MEMBER(orientation)
174IPC_STRUCT_TRAITS_END()
175
176IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad)
177  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
178  IPC_STRUCT_TRAITS_MEMBER(render_pass_id)
179  IPC_STRUCT_TRAITS_MEMBER(is_replica)
180  IPC_STRUCT_TRAITS_MEMBER(mask_resource_id)
181  IPC_STRUCT_TRAITS_MEMBER(contents_changed_since_last_frame)
182  IPC_STRUCT_TRAITS_MEMBER(mask_uv_rect)
183  IPC_STRUCT_TRAITS_MEMBER(filters)
184  IPC_STRUCT_TRAITS_MEMBER(background_filters)
185IPC_STRUCT_TRAITS_END()
186
187IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad)
188  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
189  IPC_STRUCT_TRAITS_MEMBER(color)
190  IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off)
191IPC_STRUCT_TRAITS_END()
192
193IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad)
194  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
195  IPC_STRUCT_TRAITS_MEMBER(resource_id)
196  IPC_STRUCT_TRAITS_MEMBER(matrix)
197IPC_STRUCT_TRAITS_END()
198
199IPC_STRUCT_TRAITS_BEGIN(cc::SurfaceDrawQuad)
200  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
201  IPC_STRUCT_TRAITS_MEMBER(surface_id)
202IPC_STRUCT_TRAITS_END()
203
204IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad)
205  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
206  IPC_STRUCT_TRAITS_MEMBER(resource_id)
207  IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha)
208  IPC_STRUCT_TRAITS_MEMBER(uv_top_left)
209  IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right)
210  IPC_STRUCT_TRAITS_MEMBER(background_color)
211  IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[0])
212  IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[1])
213  IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[2])
214  IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[3])
215  IPC_STRUCT_TRAITS_MEMBER(flipped)
216IPC_STRUCT_TRAITS_END()
217
218IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad)
219  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
220  IPC_STRUCT_TRAITS_MEMBER(resource_id)
221  IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect)
222  IPC_STRUCT_TRAITS_MEMBER(texture_size)
223  IPC_STRUCT_TRAITS_MEMBER(swizzle_contents)
224IPC_STRUCT_TRAITS_END()
225
226IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad)
227  IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
228  IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect)
229  IPC_STRUCT_TRAITS_MEMBER(y_plane_resource_id)
230  IPC_STRUCT_TRAITS_MEMBER(u_plane_resource_id)
231  IPC_STRUCT_TRAITS_MEMBER(v_plane_resource_id)
232  IPC_STRUCT_TRAITS_MEMBER(a_plane_resource_id)
233  IPC_STRUCT_TRAITS_MEMBER(color_space)
234IPC_STRUCT_TRAITS_END()
235
236IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState)
237  IPC_STRUCT_TRAITS_MEMBER(content_to_target_transform)
238  IPC_STRUCT_TRAITS_MEMBER(content_bounds)
239  IPC_STRUCT_TRAITS_MEMBER(visible_content_rect)
240  IPC_STRUCT_TRAITS_MEMBER(clip_rect)
241  IPC_STRUCT_TRAITS_MEMBER(is_clipped)
242  IPC_STRUCT_TRAITS_MEMBER(opacity)
243  IPC_STRUCT_TRAITS_MEMBER(blend_mode)
244  IPC_STRUCT_TRAITS_MEMBER(sorting_context_id)
245IPC_STRUCT_TRAITS_END()
246
247IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource)
248  IPC_STRUCT_TRAITS_MEMBER(id)
249  IPC_STRUCT_TRAITS_MEMBER(format)
250  IPC_STRUCT_TRAITS_MEMBER(filter)
251  IPC_STRUCT_TRAITS_MEMBER(size)
252  IPC_STRUCT_TRAITS_MEMBER(mailbox_holder)
253  IPC_STRUCT_TRAITS_MEMBER(is_repeated)
254  IPC_STRUCT_TRAITS_MEMBER(is_software)
255  IPC_STRUCT_TRAITS_MEMBER(allow_overlay)
256IPC_STRUCT_TRAITS_END()
257
258IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource)
259  IPC_STRUCT_TRAITS_MEMBER(id)
260  IPC_STRUCT_TRAITS_MEMBER(sync_point)
261  IPC_STRUCT_TRAITS_MEMBER(count)
262  IPC_STRUCT_TRAITS_MEMBER(lost)
263IPC_STRUCT_TRAITS_END()
264
265IPC_STRUCT_TRAITS_BEGIN(cc::ViewportSelectionBound)
266  IPC_STRUCT_TRAITS_MEMBER(type)
267  IPC_STRUCT_TRAITS_MEMBER(viewport_rect)
268  IPC_STRUCT_TRAITS_MEMBER(visible)
269IPC_STRUCT_TRAITS_END()
270
271IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs)
272  IPC_STRUCT_TRAITS_MEMBER(frame_time)
273  IPC_STRUCT_TRAITS_MEMBER(deadline)
274  IPC_STRUCT_TRAITS_MEMBER(interval)
275IPC_STRUCT_TRAITS_END()
276
277IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata)
278  IPC_STRUCT_TRAITS_MEMBER(device_scale_factor)
279  IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset)
280  IPC_STRUCT_TRAITS_MEMBER(page_scale_factor)
281  IPC_STRUCT_TRAITS_MEMBER(scrollable_viewport_size)
282  IPC_STRUCT_TRAITS_MEMBER(root_layer_size)
283  IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor)
284  IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor)
285  IPC_STRUCT_TRAITS_MEMBER(location_bar_offset)
286  IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation)
287  IPC_STRUCT_TRAITS_MEMBER(overdraw_bottom_height)
288  IPC_STRUCT_TRAITS_MEMBER(selection_start)
289  IPC_STRUCT_TRAITS_MEMBER(selection_end)
290  IPC_STRUCT_TRAITS_MEMBER(latency_info)
291IPC_STRUCT_TRAITS_END()
292
293IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData)
294  IPC_STRUCT_TRAITS_MEMBER(mailbox)
295  IPC_STRUCT_TRAITS_MEMBER(sync_point)
296  IPC_STRUCT_TRAITS_MEMBER(size)
297  IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect)
298IPC_STRUCT_TRAITS_END()
299