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