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