blob: 75d4529f4caa87817af3aa567b12935d641fb5a3 [file] [log] [blame]
[email protected]ce208f872012-03-07 20:42:561// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]c2932f5e2010-11-03 03:22:332// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5#ifndef PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_
6#define PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_
7
[email protected]ea505a9d2011-07-07 18:34:408#include <string>
9#include <vector>
10
avie029c4132015-12-23 06:45:2211#include "build/build_config.h"
[email protected]c2932f5e2010-11-03 03:22:3312#include "ipc/ipc_message_utils.h"
[email protected]43a40202010-11-12 16:25:0113#include "ipc/ipc_platform_file.h"
[email protected]c2932f5e2010-11-03 03:22:3314#include "ppapi/c/pp_completion_callback.h"
[email protected]c2932f5e2010-11-03 03:22:3315#include "ppapi/c/pp_rect.h"
16#include "ppapi/c/pp_var.h"
[email protected]f0a04c42011-08-26 22:43:2017#include "ppapi/proxy/ppapi_proxy_export.h"
[email protected]c44620b2014-06-16 14:20:2618#include "ppapi/shared_impl/compositor_layer_data.h"
[email protected]0c92b0d2012-12-08 00:46:2319#include "ppapi/shared_impl/file_path.h"
[email protected]d1967ed2013-06-18 01:10:2120#include "ppapi/shared_impl/file_ref_create_info.h"
[email protected]61ebd74e2014-02-26 00:44:0521#include "ppapi/shared_impl/media_stream_video_track_shared.h"
[email protected]195d4cde2012-10-02 18:12:4122#include "ppapi/shared_impl/ppapi_permissions.h"
[email protected]64a61fc2013-06-19 13:30:5923#include "ppapi/shared_impl/socket_option_data.h"
[email protected]c2932f5e2010-11-03 03:22:3324
jrummella68c98f2015-01-08 22:35:4325struct PP_KeyInformation;
[email protected]5a2b68f2011-11-10 00:00:4926struct PP_NetAddress_Private;
[email protected]c2932f5e2010-11-03 03:22:3327
[email protected]be0a84b2011-08-13 04:18:4428namespace ppapi {
29
30class HostResource;
[email protected]de2895262012-04-04 17:15:4831class PPB_X509Certificate_Fields;
[email protected]be0a84b2011-08-13 04:18:4432
[email protected]c2932f5e2010-11-03 03:22:3333namespace proxy {
[email protected]f24448db2011-01-27 20:40:3934
[email protected]43a40202010-11-12 16:25:0135struct PPBFlash_DrawGlyphs_Params;
[email protected]f24448db2011-01-27 20:40:3936struct PPBURLLoader_UpdateProgress_Params;
[email protected]43a40202010-11-12 16:25:0137struct SerializedDirEntry;
[email protected]709a847e2010-11-10 01:16:1138struct SerializedFontDescription;
[email protected]725056b72013-03-16 09:57:5139struct SerializedTrueTypeFontDesc;
[email protected]7358d572011-02-15 18:44:4040class SerializedFlashMenu;
[email protected]246fc492012-08-27 20:28:1841class SerializedHandle;
[email protected]c2932f5e2010-11-03 03:22:3342class SerializedVar;
[email protected]f24448db2011-01-27 20:40:3943
44} // namespace proxy
[email protected]4d2efd22011-08-18 21:58:0245} // namespace ppapi
[email protected]c2932f5e2010-11-03 03:22:3346
47namespace IPC {
48
49template<>
[email protected]f41f53692012-04-05 04:07:3250struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> {
[email protected]799d1ab2010-11-09 17:16:2851 typedef PP_Bool param_type;
jam3db6b6d2016-05-13 15:09:5852 static void GetSize(base::PickleSizer* s, const param_type& p);
rockot502c94f2016-02-03 20:20:1653 static void Write(base::Pickle* m, const param_type& p);
54 static bool Read(const base::Pickle* m,
55 base::PickleIterator* iter,
56 param_type* r);
[email protected]799d1ab2010-11-09 17:16:2857 static void Log(const param_type& p, std::string* l);
58};
59
[email protected]373a95a2011-07-01 16:58:1460template <>
[email protected]5a2b68f2011-11-10 00:00:4961struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> {
62 typedef PP_NetAddress_Private param_type;
jam3db6b6d2016-05-13 15:09:5863 static void GetSize(base::PickleSizer* s, const param_type& p);
rockot502c94f2016-02-03 20:20:1664 static void Write(base::Pickle* m, const param_type& p);
65 static bool Read(const base::Pickle* m,
66 base::PickleIterator* iter,
67 param_type* p);
[email protected]373a95a2011-07-01 16:58:1468 static void Log(const param_type& p, std::string* l);
69};
70
jrummella68c98f2015-01-08 22:35:4371template <>
72struct PPAPI_PROXY_EXPORT ParamTraits<PP_KeyInformation> {
73 typedef PP_KeyInformation param_type;
rockot502c94f2016-02-03 20:20:1674 static void Write(base::Pickle* m, const param_type& p);
75 static bool Read(const base::Pickle* m,
76 base::PickleIterator* iter,
77 param_type* p);
jrummella68c98f2015-01-08 22:35:4378 static void Log(const param_type& p, std::string* l);
79};
80
[email protected]43a40202010-11-12 16:25:0181template<>
[email protected]f41f53692012-04-05 04:07:3282struct PPAPI_PROXY_EXPORT ParamTraits<
83 ppapi::proxy::PPBFlash_DrawGlyphs_Params> {
[email protected]4d2efd22011-08-18 21:58:0284 typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type;
rockot502c94f2016-02-03 20:20:1685 static void Write(base::Pickle* m, const param_type& p);
86 static bool Read(const base::Pickle* m,
87 base::PickleIterator* iter,
88 param_type* r);
[email protected]43a40202010-11-12 16:25:0189 static void Log(const param_type& p, std::string* l);
90};
91
[email protected]4deeb432011-02-17 23:59:3992template<>
[email protected]f41f53692012-04-05 04:07:3293struct PPAPI_PROXY_EXPORT ParamTraits<
94 ppapi::proxy::PPBURLLoader_UpdateProgress_Params> {
[email protected]4d2efd22011-08-18 21:58:0295 typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type;
rockot502c94f2016-02-03 20:20:1696 static void Write(base::Pickle* m, const param_type& p);
97 static bool Read(const base::Pickle* m,
98 base::PickleIterator* iter,
99 param_type* r);
[email protected]f24448db2011-01-27 20:40:39100 static void Log(const param_type& p, std::string* l);
101};
102
103template<>
[email protected]f41f53692012-04-05 04:07:32104struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedDirEntry> {
[email protected]4d2efd22011-08-18 21:58:02105 typedef ppapi::proxy::SerializedDirEntry param_type;
rockot502c94f2016-02-03 20:20:16106 static void Write(base::Pickle* m, const param_type& p);
107 static bool Read(const base::Pickle* m,
108 base::PickleIterator* iter,
109 param_type* r);
[email protected]43a40202010-11-12 16:25:01110 static void Log(const param_type& p, std::string* l);
111};
112
113template<>
[email protected]f41f53692012-04-05 04:07:32114struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFontDescription> {
[email protected]4d2efd22011-08-18 21:58:02115 typedef ppapi::proxy::SerializedFontDescription param_type;
rockot502c94f2016-02-03 20:20:16116 static void Write(base::Pickle* m, const param_type& p);
117 static bool Read(const base::Pickle* m,
118 base::PickleIterator* iter,
119 param_type* r);
[email protected]799d1ab2010-11-09 17:16:28120 static void Log(const param_type& p, std::string* l);
121};
122
123template<>
[email protected]725056b72013-03-16 09:57:51124struct PPAPI_PROXY_EXPORT
125 ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> {
126 typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type;
rockot502c94f2016-02-03 20:20:16127 static void Write(base::Pickle* m, const param_type& p);
128 static bool Read(const base::Pickle* m,
129 base::PickleIterator* iter,
130 param_type* r);
[email protected]725056b72013-03-16 09:57:51131 static void Log(const param_type& p, std::string* l);
132};
133
134template<>
[email protected]246fc492012-08-27 20:28:18135struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> {
136 typedef ppapi::proxy::SerializedHandle param_type;
rockot502c94f2016-02-03 20:20:16137 static void Write(base::Pickle* m, const param_type& p);
138 static bool Read(const base::Pickle* m,
139 base::PickleIterator* iter,
140 param_type* r);
[email protected]246fc492012-08-27 20:28:18141 static void Log(const param_type& p, std::string* l);
142};
143
144template<>
[email protected]f41f53692012-04-05 04:07:32145struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> {
[email protected]be0a84b2011-08-13 04:18:44146 typedef ppapi::HostResource param_type;
jam3db6b6d2016-05-13 15:09:58147 static void GetSize(base::PickleSizer* s, const param_type& p);
rockot502c94f2016-02-03 20:20:16148 static void Write(base::Pickle* m, const param_type& p);
149 static bool Read(const base::Pickle* m,
150 base::PickleIterator* iter,
151 param_type* r);
[email protected]f24448db2011-01-27 20:40:39152 static void Log(const param_type& p, std::string* l);
153};
154
155template<>
[email protected]f41f53692012-04-05 04:07:32156struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedVar> {
[email protected]4d2efd22011-08-18 21:58:02157 typedef ppapi::proxy::SerializedVar param_type;
rockot502c94f2016-02-03 20:20:16158 static void Write(base::Pickle* m, const param_type& p);
159 static bool Read(const base::Pickle* m,
160 base::PickleIterator* iter,
161 param_type* r);
[email protected]c2932f5e2010-11-03 03:22:33162 static void Log(const param_type& p, std::string* l);
163};
164
[email protected]c2932f5e2010-11-03 03:22:33165template<>
[email protected]f41f53692012-04-05 04:07:32166struct PPAPI_PROXY_EXPORT ParamTraits<
167 std::vector<ppapi::proxy::SerializedVar> > {
[email protected]4d2efd22011-08-18 21:58:02168 typedef std::vector<ppapi::proxy::SerializedVar> param_type;
rockot502c94f2016-02-03 20:20:16169 static void Write(base::Pickle* m, const param_type& p);
170 static bool Read(const base::Pickle* m,
171 base::PickleIterator* iter,
172 param_type* r);
[email protected]c2932f5e2010-11-03 03:22:33173 static void Log(const param_type& p, std::string* l);
174};
175
[email protected]7358d572011-02-15 18:44:40176template<>
[email protected]195d4cde2012-10-02 18:12:41177struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> {
178 typedef ppapi::PpapiPermissions param_type;
jam3db6b6d2016-05-13 15:09:58179 static void GetSize(base::PickleSizer* s, const param_type& p);
rockot502c94f2016-02-03 20:20:16180 static void Write(base::Pickle* m, const param_type& p);
181 static bool Read(const base::Pickle* m,
182 base::PickleIterator* iter,
183 param_type* r);
[email protected]195d4cde2012-10-02 18:12:41184 static void Log(const param_type& p, std::string* l);
185};
186
[email protected]246fc492012-08-27 20:28:18187#if !defined(OS_NACL) && !defined(NACL_WIN64)
[email protected]0c92b0d2012-12-08 00:46:23188template <>
189struct ParamTraits<ppapi::PepperFilePath> {
190 typedef ppapi::PepperFilePath param_type;
rockot502c94f2016-02-03 20:20:16191 static void Write(base::Pickle* m, const param_type& p);
192 static bool Read(const base::Pickle* m,
193 base::PickleIterator* iter,
194 param_type* p);
[email protected]0c92b0d2012-12-08 00:46:23195 static void Log(const param_type& p, std::string* l);
196};
197
[email protected]1162a6a2011-04-21 17:28:16198template<>
[email protected]f41f53692012-04-05 04:07:32199struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> {
[email protected]4d2efd22011-08-18 21:58:02200 typedef ppapi::proxy::SerializedFlashMenu param_type;
rockot502c94f2016-02-03 20:20:16201 static void Write(base::Pickle* m, const param_type& p);
202 static bool Read(const base::Pickle* m,
203 base::PickleIterator* iter,
204 param_type* r);
[email protected]7358d572011-02-15 18:44:40205 static void Log(const param_type& p, std::string* l);
206};
[email protected]667591d2012-09-04 21:30:12207#endif // !defined(OS_NACL) && !defined(NACL_WIN64)
[email protected]7358d572011-02-15 18:44:40208
[email protected]de2895262012-04-04 17:15:48209template<>
210struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> {
211 typedef ppapi::PPB_X509Certificate_Fields param_type;
rockot502c94f2016-02-03 20:20:16212 static void Write(base::Pickle* m, const param_type& p);
213 static bool Read(const base::Pickle* m,
214 base::PickleIterator* iter,
215 param_type* r);
[email protected]de2895262012-04-04 17:15:48216 static void Log(const param_type& p, std::string* l);
217};
[email protected]246fc492012-08-27 20:28:18218
[email protected]64a61fc2013-06-19 13:30:59219template<>
220struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> {
221 typedef ppapi::SocketOptionData param_type;
rockot502c94f2016-02-03 20:20:16222 static void Write(base::Pickle* m, const param_type& p);
223 static bool Read(const base::Pickle* m,
224 base::PickleIterator* iter,
225 param_type* r);
[email protected]64a61fc2013-06-19 13:30:59226 static void Log(const param_type& p, std::string* l);
227};
[email protected]de2895262012-04-04 17:15:48228
[email protected]c44620b2014-06-16 14:20:26229template<>
230struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::CompositorLayerData::Transform> {
231 typedef ppapi::CompositorLayerData::Transform param_type;
jam3db6b6d2016-05-13 15:09:58232 static void GetSize(base::PickleSizer* s, const param_type& p);
rockot502c94f2016-02-03 20:20:16233 static void Write(base::Pickle* m, const param_type& p);
234 static bool Read(const base::Pickle* m,
235 base::PickleIterator* iter,
236 param_type* r);
[email protected]c44620b2014-06-16 14:20:26237 static void Log(const param_type& p, std::string* l);
238};
239
[email protected]c2932f5e2010-11-03 03:22:33240} // namespace IPC
241
242#endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_