• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 IPC_ENUM_TRAITS_MAX_VALUE(SkXfermode::Mode, SkXfermode::kLastMode)
123 
124 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPass::Id)
125   IPC_STRUCT_TRAITS_MEMBER(layer_id)
126   IPC_STRUCT_TRAITS_MEMBER(index)
127 IPC_STRUCT_TRAITS_END()
128 
129 IPC_STRUCT_TRAITS_BEGIN(cc::DrawQuad)
130   IPC_STRUCT_TRAITS_MEMBER(material)
131   IPC_STRUCT_TRAITS_MEMBER(rect)
132   IPC_STRUCT_TRAITS_MEMBER(opaque_rect)
133   IPC_STRUCT_TRAITS_MEMBER(visible_rect)
134   IPC_STRUCT_TRAITS_MEMBER(needs_blending)
135 IPC_STRUCT_TRAITS_END()
136 
137 IPC_STRUCT_TRAITS_BEGIN(cc::CheckerboardDrawQuad)
138   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
139   IPC_STRUCT_TRAITS_MEMBER(color)
140 IPC_STRUCT_TRAITS_END()
141 
142 IPC_STRUCT_TRAITS_BEGIN(cc::DebugBorderDrawQuad)
143   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
144   IPC_STRUCT_TRAITS_MEMBER(color)
145   IPC_STRUCT_TRAITS_MEMBER(width)
146 IPC_STRUCT_TRAITS_END()
147 
148 IPC_STRUCT_TRAITS_BEGIN(cc::IOSurfaceDrawQuad)
149   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
150   IPC_STRUCT_TRAITS_MEMBER(io_surface_size)
151   IPC_STRUCT_TRAITS_MEMBER(io_surface_resource_id)
152   IPC_STRUCT_TRAITS_MEMBER(orientation)
153 IPC_STRUCT_TRAITS_END()
154 
155 IPC_STRUCT_TRAITS_BEGIN(cc::RenderPassDrawQuad)
156   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
157   IPC_STRUCT_TRAITS_MEMBER(render_pass_id)
158   IPC_STRUCT_TRAITS_MEMBER(is_replica)
159   IPC_STRUCT_TRAITS_MEMBER(mask_resource_id)
160   IPC_STRUCT_TRAITS_MEMBER(contents_changed_since_last_frame)
161   IPC_STRUCT_TRAITS_MEMBER(mask_uv_rect)
162   IPC_STRUCT_TRAITS_MEMBER(filters)
163   IPC_STRUCT_TRAITS_MEMBER(background_filters)
164 IPC_STRUCT_TRAITS_END()
165 
166 IPC_STRUCT_TRAITS_BEGIN(cc::SolidColorDrawQuad)
167   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
168   IPC_STRUCT_TRAITS_MEMBER(color)
169   IPC_STRUCT_TRAITS_MEMBER(force_anti_aliasing_off)
170 IPC_STRUCT_TRAITS_END()
171 
172 IPC_STRUCT_TRAITS_BEGIN(cc::StreamVideoDrawQuad)
173   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
174   IPC_STRUCT_TRAITS_MEMBER(resource_id)
175   IPC_STRUCT_TRAITS_MEMBER(matrix)
176 IPC_STRUCT_TRAITS_END()
177 
178 IPC_STRUCT_TRAITS_BEGIN(cc::TextureDrawQuad)
179   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
180   IPC_STRUCT_TRAITS_MEMBER(resource_id)
181   IPC_STRUCT_TRAITS_MEMBER(premultiplied_alpha)
182   IPC_STRUCT_TRAITS_MEMBER(uv_top_left)
183   IPC_STRUCT_TRAITS_MEMBER(uv_bottom_right)
184   IPC_STRUCT_TRAITS_MEMBER(background_color)
185   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[0])
186   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[1])
187   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[2])
188   IPC_STRUCT_TRAITS_MEMBER(vertex_opacity[3])
189   IPC_STRUCT_TRAITS_MEMBER(flipped)
190 IPC_STRUCT_TRAITS_END()
191 
192 IPC_STRUCT_TRAITS_BEGIN(cc::TileDrawQuad)
193   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
194   IPC_STRUCT_TRAITS_MEMBER(resource_id)
195   IPC_STRUCT_TRAITS_MEMBER(tex_coord_rect)
196   IPC_STRUCT_TRAITS_MEMBER(texture_size)
197   IPC_STRUCT_TRAITS_MEMBER(swizzle_contents)
198 IPC_STRUCT_TRAITS_END()
199 
200 IPC_STRUCT_TRAITS_BEGIN(cc::YUVVideoDrawQuad)
201   IPC_STRUCT_TRAITS_PARENT(cc::DrawQuad)
202   IPC_STRUCT_TRAITS_MEMBER(tex_scale)
203   IPC_STRUCT_TRAITS_MEMBER(y_plane_resource_id)
204   IPC_STRUCT_TRAITS_MEMBER(u_plane_resource_id)
205   IPC_STRUCT_TRAITS_MEMBER(v_plane_resource_id)
206   IPC_STRUCT_TRAITS_MEMBER(a_plane_resource_id)
207 IPC_STRUCT_TRAITS_END()
208 
209 IPC_STRUCT_TRAITS_BEGIN(cc::SharedQuadState)
210   IPC_STRUCT_TRAITS_MEMBER(content_to_target_transform)
211   IPC_STRUCT_TRAITS_MEMBER(content_bounds)
212   IPC_STRUCT_TRAITS_MEMBER(visible_content_rect)
213   IPC_STRUCT_TRAITS_MEMBER(clip_rect)
214   IPC_STRUCT_TRAITS_MEMBER(is_clipped)
215   IPC_STRUCT_TRAITS_MEMBER(opacity)
216   IPC_STRUCT_TRAITS_MEMBER(blend_mode)
217 IPC_STRUCT_TRAITS_END()
218 
219 IPC_STRUCT_TRAITS_BEGIN(cc::TransferableResource)
220   IPC_STRUCT_TRAITS_MEMBER(id)
221   IPC_STRUCT_TRAITS_MEMBER(sync_point)
222   IPC_STRUCT_TRAITS_MEMBER(format)
223   IPC_STRUCT_TRAITS_MEMBER(target)
224   IPC_STRUCT_TRAITS_MEMBER(filter)
225   IPC_STRUCT_TRAITS_MEMBER(size)
226   IPC_STRUCT_TRAITS_MEMBER(mailbox)
227   IPC_STRUCT_TRAITS_MEMBER(is_software)
228 IPC_STRUCT_TRAITS_END()
229 
230 IPC_STRUCT_TRAITS_BEGIN(cc::ReturnedResource)
231   IPC_STRUCT_TRAITS_MEMBER(id)
232   IPC_STRUCT_TRAITS_MEMBER(sync_point)
233   IPC_STRUCT_TRAITS_MEMBER(count)
234   IPC_STRUCT_TRAITS_MEMBER(lost)
235 IPC_STRUCT_TRAITS_END()
236 
237 IPC_STRUCT_TRAITS_BEGIN(cc::BeginFrameArgs)
238   IPC_STRUCT_TRAITS_MEMBER(frame_time)
239   IPC_STRUCT_TRAITS_MEMBER(deadline)
240   IPC_STRUCT_TRAITS_MEMBER(interval)
241 IPC_STRUCT_TRAITS_END()
242 
243 IPC_STRUCT_TRAITS_BEGIN(cc::CompositorFrameMetadata)
244   IPC_STRUCT_TRAITS_MEMBER(device_scale_factor)
245   IPC_STRUCT_TRAITS_MEMBER(root_scroll_offset)
246   IPC_STRUCT_TRAITS_MEMBER(page_scale_factor)
247   IPC_STRUCT_TRAITS_MEMBER(viewport_size)
248   IPC_STRUCT_TRAITS_MEMBER(root_layer_size)
249   IPC_STRUCT_TRAITS_MEMBER(min_page_scale_factor)
250   IPC_STRUCT_TRAITS_MEMBER(max_page_scale_factor)
251   IPC_STRUCT_TRAITS_MEMBER(location_bar_offset)
252   IPC_STRUCT_TRAITS_MEMBER(location_bar_content_translation)
253   IPC_STRUCT_TRAITS_MEMBER(overdraw_bottom_height)
254   IPC_STRUCT_TRAITS_MEMBER(latency_info)
255 IPC_STRUCT_TRAITS_END()
256 
257 IPC_STRUCT_TRAITS_BEGIN(cc::GLFrameData)
258   IPC_STRUCT_TRAITS_MEMBER(mailbox)
259   IPC_STRUCT_TRAITS_MEMBER(sync_point)
260   IPC_STRUCT_TRAITS_MEMBER(size)
261   IPC_STRUCT_TRAITS_MEMBER(sub_buffer_rect)
262 IPC_STRUCT_TRAITS_END()
263 
264 IPC_STRUCT_TRAITS_BEGIN(cc::SoftwareFrameData)
265   IPC_STRUCT_TRAITS_MEMBER(id)
266   IPC_STRUCT_TRAITS_MEMBER(size)
267   IPC_STRUCT_TRAITS_MEMBER(damage_rect)
268   IPC_STRUCT_TRAITS_MEMBER(handle)
269 IPC_STRUCT_TRAITS_END()
270