- add sources.
[platform/framework/web/crosswalk.git] / src / content / common / cc_messages.h
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/quads/checkerboard_draw_quad.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/texture_draw_quad.h"
22 #include "cc/quads/tile_draw_quad.h"
23 #include "cc/quads/yuv_video_draw_quad.h"
24 #include "cc/resources/resource_format.h"
25 #include "cc/resources/returned_resource.h"
26 #include "cc/resources/transferable_resource.h"
27 #include "content/common/content_export.h"
28 #include "gpu/ipc/gpu_command_buffer_traits.h"
29 #include "ipc/ipc_message_macros.h"
30
31 #ifndef CONTENT_COMMON_CC_MESSAGES_H_
32 #define CONTENT_COMMON_CC_MESSAGES_H_
33
34 namespace gfx {
35 class Transform;
36 }
37
38 namespace cc {
39 class FilterOperations;
40 }
41
42 namespace IPC {
43
44 template <>
45 struct ParamTraits<cc::FilterOperation> {
46   typedef cc::FilterOperation param_type;
47   static void Write(Message* m, const param_type& p);
48   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
49   static void Log(const param_type& p, std::string* l);
50 };
51
52 template <>
53 struct ParamTraits<cc::FilterOperations> {
54   typedef cc::FilterOperations param_type;
55   static void Write(Message* m, const param_type& p);
56   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
57   static void Log(const param_type& p, std::string* l);
58 };
59
60 template <>
61 struct ParamTraits<skia::RefPtr<SkImageFilter> > {
62   typedef skia::RefPtr<SkImageFilter> param_type;
63   static void Write(Message* m, const param_type& p);
64   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
65   static void Log(const param_type& p, std::string* l);
66 };
67
68 template <>
69 struct ParamTraits<gfx::Transform> {
70   typedef gfx::Transform param_type;
71   static void Write(Message* m, const param_type& p);
72   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
73   static void Log(const param_type& p, std::string* l);
74 };
75
76 template <>
77 struct CONTENT_EXPORT ParamTraits<cc::RenderPass> {
78   typedef cc::RenderPass param_type;
79   static void Write(Message* m, const param_type& p);
80   static bool Read(const Message* m, PickleIterator* iter, param_type* r);
81   static void Log(const param_type& p, std::string* l);
82 };
83
84 template<>
85 struct CONTENT_EXPORT ParamTraits<cc::CompositorFrame> {
86   typedef cc::CompositorFrame param_type;
87   static void Write(Message* m, const param_type& p);
88   static bool Read(const Message* m, PickleIterator* iter, param_type* p);
89   static void Log(const param_type& p, std::string* l);
90 };
91
92 template<>
93 struct CONTENT_EXPORT ParamTraits<cc::CompositorFrameAck> {
94   typedef cc::CompositorFrameAck param_type;
95   static void Write(Message* m, const param_type& p);
96   static bool Read(const Message* m, PickleIterator* iter, param_type* p);
97   static void Log(const param_type& p, std::string* l);
98 };
99
100 template<>
101 struct CONTENT_EXPORT ParamTraits<cc::DelegatedFrameData> {
102   typedef cc::DelegatedFrameData param_type;
103   static void Write(Message* m, const param_type& p);
104   static bool Read(const Message* m, PickleIterator* iter, param_type* p);
105   static void Log(const param_type& p, std::string* l);
106 };
107
108 }  // namespace IPC
109
110 #endif  // CONTENT_COMMON_CC_MESSAGES_H_
111
112 // Multiply-included message file, hence no include guard.
113
114 #define IPC_MESSAGE_START CCMsgStart
115 #undef IPC_MESSAGE_EXPORT
116 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
117
118 IPC_ENUM_TRAITS(cc::DrawQuad::Material)
119 IPC_ENUM_TRAITS(cc::IOSurfaceDrawQuad::Orientation)
120 IPC_ENUM_TRAITS(cc::FilterOperation::FilterType)
121 IPC_ENUM_TRAITS_MAX_VALUE(cc::ResourceFormat, cc::RESOURCE_FORMAT_MAX)
122
123 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id)
124   IPC_STRUCT_TRAITS_MEMBER(layer_id)
125   IPC_STRUCT_TRAITS_MEMBER(index)
126 IPC_STRUCT_TRAITS_END()
127
128 IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad)
129   IPC_STRUCT_TRAITS_MEMBER(material)
130   IPC_STRUCT_TRAITS_MEMBER(rect)
131   IPC_STRUCT_TRAITS_MEMBER(opaque_rect)
132   IPC_STRUCT_TRAITS_MEMBER(visible_rect)
133   IPC_STRUCT_TRAITS_MEMBER(needs_blending)
134 IPC_STRUCT_TRAITS_END()
135
136 IPC_STRUCT_TRAITS_BEGIN(cc::CheckerboardDrawQuad)
137   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
138   IPC_STRUCT_TRAITS_MEMBER(color)
139 IPC_STRUCT_TRAITS_END()
140
141 IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad)
142   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
143   IPC_STRUCT_TRAITS_MEMBER(color)
144   IPC_STRUCT_TRAITS_MEMBER(width)
145 IPC_STRUCT_TRAITS_END()
146
147 IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad)
148   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
149   IPC_STRUCT_TRAITS_MEMBER(io_surface_size)
150   IPC_STRUCT_TRAITS_MEMBER(io_surface_resource_id)
151   IPC_STRUCT_TRAITS_MEMBER(orientation)
152 IPC_STRUCT_TRAITS_END()
153
154 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad)
155   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
156   IPC_STRUCT_TRAITS_MEMBER(render_pass_id)
157   IPC_STRUCT_TRAITS_MEMBER(is_replica)
158   IPC_STRUCT_TRAITS_MEMBER(mask_resource_id)
159   IPC_STRUCT_TRAITS_MEMBER(contents_changed_since_last_frame)
160   IPC_STRUCT_TRAITS_MEMBER(mask_uv_rect)
161   IPC_STRUCT_TRAITS_MEMBER(filters)
162   IPC_STRUCT_TRAITS_MEMBER(background_filters)
163 IPC_STRUCT_TRAITS_END()
164
165 IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad)
166   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
167   IPC_STRUCT_TRAITS_MEMBER(color)
168   IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off)
169 IPC_STRUCT_TRAITS_END()
170
171 IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad)
172   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
173   IPC_STRUCT_TRAITS_MEMBER(resource_id)
174   IPC_STRUCT_TRAITS_MEMBER(matrix)
175 IPC_STRUCT_TRAITS_END()
176
177 IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad)
178   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
179   IPC_STRUCT_TRAITS_MEMBER(resource_id)
180   IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha)
181   IPC_STRUCT_TRAITS_MEMBER(uv_top_left)
182   IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right)
183   IPC_STRUCT_TRAITS_MEMBER(background_color)
184   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[0])
185   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[1])
186   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[2])
187   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[3])
188   IPC_STRUCT_TRAITS_MEMBER(flipped)
189 IPC_STRUCT_TRAITS_END()
190
191 IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad)
192   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
193   IPC_STRUCT_TRAITS_MEMBER(resource_id)
194   IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect)
195   IPC_STRUCT_TRAITS_MEMBER(texture_size)
196   IPC_STRUCT_TRAITS_MEMBER(swizzle_contents)
197 IPC_STRUCT_TRAITS_END()
198
199 IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad)
200   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
201   IPC_STRUCT_TRAITS_MEMBER(tex_scale)
202   IPC_STRUCT_TRAITS_MEMBER(y_plane_resource_id)
203   IPC_STRUCT_TRAITS_MEMBER(u_plane_resource_id)
204   IPC_STRUCT_TRAITS_MEMBER(v_plane_resource_id)
205   IPC_STRUCT_TRAITS_MEMBER(a_plane_resource_id)
206 IPC_STRUCT_TRAITS_END()
207
208 IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState)
209   IPC_STRUCT_TRAITS_MEMBER(content_to_target_transform)
210   IPC_STRUCT_TRAITS_MEMBER(content_bounds)
211   IPC_STRUCT_TRAITS_MEMBER(visible_content_rect)
212   IPC_STRUCT_TRAITS_MEMBER(clip_rect)
213   IPC_STRUCT_TRAITS_MEMBER(is_clipped)
214   IPC_STRUCT_TRAITS_MEMBER(opacity)
215 IPC_STRUCT_TRAITS_END()
216
217 IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource)
218   IPC_STRUCT_TRAITS_MEMBER(id)
219   IPC_STRUCT_TRAITS_MEMBER(sync_point)
220   IPC_STRUCT_TRAITS_MEMBER(format)
221   IPC_STRUCT_TRAITS_MEMBER(target)
222   IPC_STRUCT_TRAITS_MEMBER(filter)
223   IPC_STRUCT_TRAITS_MEMBER(size)
224   IPC_STRUCT_TRAITS_MEMBER(mailbox)
225   IPC_STRUCT_TRAITS_MEMBER(is_software)
226 IPC_STRUCT_TRAITS_END()
227
228 IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource)
229   IPC_STRUCT_TRAITS_MEMBER(id)
230   IPC_STRUCT_TRAITS_MEMBER(sync_point)
231   IPC_STRUCT_TRAITS_MEMBER(count)
232   IPC_STRUCT_TRAITS_MEMBER(lost)
233 IPC_STRUCT_TRAITS_END()
234
235 IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs)
236   IPC_STRUCT_TRAITS_MEMBER(frame_time)
237   IPC_STRUCT_TRAITS_MEMBER(deadline)
238   IPC_STRUCT_TRAITS_MEMBER(interval)
239 IPC_STRUCT_TRAITS_END()
240
241 IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata)
242   IPC_STRUCT_TRAITS_MEMBER(device_scale_factor)
243   IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset)
244   IPC_STRUCT_TRAITS_MEMBER(page_scale_factor)
245   IPC_STRUCT_TRAITS_MEMBER(viewport_size)
246   IPC_STRUCT_TRAITS_MEMBER(root_layer_size)
247   IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor)
248   IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor)
249   IPC_STRUCT_TRAITS_MEMBER(location_bar_offset)
250   IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation)
251   IPC_STRUCT_TRAITS_MEMBER(overdraw_bottom_height)
252   IPC_STRUCT_TRAITS_MEMBER(latency_info)
253 IPC_STRUCT_TRAITS_END()
254
255 IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData)
256   IPC_STRUCT_TRAITS_MEMBER(mailbox)
257   IPC_STRUCT_TRAITS_MEMBER(sync_point)
258   IPC_STRUCT_TRAITS_MEMBER(size)
259   IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect)
260 IPC_STRUCT_TRAITS_END()
261
262 IPC_STRUCT_TRAITS_BEGIN(cc::SoftwareFrameData)
263   IPC_STRUCT_TRAITS_MEMBER(id)
264   IPC_STRUCT_TRAITS_MEMBER(size)
265   IPC_STRUCT_TRAITS_MEMBER(damage_rect)
266   IPC_STRUCT_TRAITS_MEMBER(handle)
267 IPC_STRUCT_TRAITS_END()