[email protected] | ce208f87 | 2012-03-07 20:42:56 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 2 | // 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] | ea505a9d | 2011-07-07 18:34:40 | [diff] [blame] | 8 | #include <string> |
| 9 | #include <vector> |
| 10 | |
avi | e029c413 | 2015-12-23 06:45:22 | [diff] [blame] | 11 | #include "build/build_config.h" |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 12 | #include "ipc/ipc_message_utils.h" |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 13 | #include "ipc/ipc_platform_file.h" |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 14 | #include "ppapi/c/pp_completion_callback.h" |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 15 | #include "ppapi/c/pp_rect.h" |
| 16 | #include "ppapi/c/pp_var.h" |
[email protected] | f0a04c4 | 2011-08-26 22:43:20 | [diff] [blame] | 17 | #include "ppapi/proxy/ppapi_proxy_export.h" |
[email protected] | c44620b | 2014-06-16 14:20:26 | [diff] [blame] | 18 | #include "ppapi/shared_impl/compositor_layer_data.h" |
[email protected] | 0c92b0d | 2012-12-08 00:46:23 | [diff] [blame] | 19 | #include "ppapi/shared_impl/file_path.h" |
[email protected] | d1967ed | 2013-06-18 01:10:21 | [diff] [blame] | 20 | #include "ppapi/shared_impl/file_ref_create_info.h" |
[email protected] | 61ebd74e | 2014-02-26 00:44:05 | [diff] [blame] | 21 | #include "ppapi/shared_impl/media_stream_video_track_shared.h" |
[email protected] | 195d4cde | 2012-10-02 18:12:41 | [diff] [blame] | 22 | #include "ppapi/shared_impl/ppapi_permissions.h" |
[email protected] | 64a61fc | 2013-06-19 13:30:59 | [diff] [blame] | 23 | #include "ppapi/shared_impl/socket_option_data.h" |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 24 | |
jrummell | a68c98f | 2015-01-08 22:35:43 | [diff] [blame] | 25 | struct PP_KeyInformation; |
[email protected] | 5a2b68f | 2011-11-10 00:00:49 | [diff] [blame] | 26 | struct PP_NetAddress_Private; |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 27 | |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 28 | namespace ppapi { |
| 29 | |
| 30 | class HostResource; |
[email protected] | de289526 | 2012-04-04 17:15:48 | [diff] [blame] | 31 | class PPB_X509Certificate_Fields; |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 32 | |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 33 | namespace proxy { |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 34 | |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 35 | struct PPBFlash_DrawGlyphs_Params; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 36 | struct PPBURLLoader_UpdateProgress_Params; |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 37 | struct SerializedDirEntry; |
[email protected] | 709a847e | 2010-11-10 01:16:11 | [diff] [blame] | 38 | struct SerializedFontDescription; |
[email protected] | 725056b7 | 2013-03-16 09:57:51 | [diff] [blame] | 39 | struct SerializedTrueTypeFontDesc; |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 40 | class SerializedFlashMenu; |
[email protected] | 246fc49 | 2012-08-27 20:28:18 | [diff] [blame] | 41 | class SerializedHandle; |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 42 | class SerializedVar; |
[email protected] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 43 | |
| 44 | } // namespace proxy |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 45 | } // namespace ppapi |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 46 | |
| 47 | namespace IPC { |
| 48 | |
| 49 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 50 | struct PPAPI_PROXY_EXPORT ParamTraits<PP_Bool> { |
[email protected] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame] | 51 | typedef PP_Bool param_type; |
jam | 3db6b6d | 2016-05-13 15:09:58 | [diff] [blame] | 52 | static void GetSize(base::PickleSizer* s, const param_type& p); |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 53 | 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] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame] | 57 | static void Log(const param_type& p, std::string* l); |
| 58 | }; |
| 59 | |
[email protected] | 373a95a | 2011-07-01 16:58:14 | [diff] [blame] | 60 | template <> |
[email protected] | 5a2b68f | 2011-11-10 00:00:49 | [diff] [blame] | 61 | struct PPAPI_PROXY_EXPORT ParamTraits<PP_NetAddress_Private> { |
| 62 | typedef PP_NetAddress_Private param_type; |
jam | 3db6b6d | 2016-05-13 15:09:58 | [diff] [blame] | 63 | static void GetSize(base::PickleSizer* s, const param_type& p); |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 64 | 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] | 373a95a | 2011-07-01 16:58:14 | [diff] [blame] | 68 | static void Log(const param_type& p, std::string* l); |
| 69 | }; |
| 70 | |
jrummell | a68c98f | 2015-01-08 22:35:43 | [diff] [blame] | 71 | template <> |
| 72 | struct PPAPI_PROXY_EXPORT ParamTraits<PP_KeyInformation> { |
| 73 | typedef PP_KeyInformation param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 74 | 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); |
jrummell | a68c98f | 2015-01-08 22:35:43 | [diff] [blame] | 78 | static void Log(const param_type& p, std::string* l); |
| 79 | }; |
| 80 | |
[email protected] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 81 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 82 | struct PPAPI_PROXY_EXPORT ParamTraits< |
| 83 | ppapi::proxy::PPBFlash_DrawGlyphs_Params> { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 84 | typedef ppapi::proxy::PPBFlash_DrawGlyphs_Params param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 85 | 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] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 89 | static void Log(const param_type& p, std::string* l); |
| 90 | }; |
| 91 | |
[email protected] | 4deeb43 | 2011-02-17 23:59:39 | [diff] [blame] | 92 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 93 | struct PPAPI_PROXY_EXPORT ParamTraits< |
| 94 | ppapi::proxy::PPBURLLoader_UpdateProgress_Params> { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 95 | typedef ppapi::proxy::PPBURLLoader_UpdateProgress_Params param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 96 | 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] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 100 | static void Log(const param_type& p, std::string* l); |
| 101 | }; |
| 102 | |
| 103 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 104 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedDirEntry> { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 105 | typedef ppapi::proxy::SerializedDirEntry param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 106 | 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] | 43a4020 | 2010-11-12 16:25:01 | [diff] [blame] | 110 | static void Log(const param_type& p, std::string* l); |
| 111 | }; |
| 112 | |
| 113 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 114 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFontDescription> { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 115 | typedef ppapi::proxy::SerializedFontDescription param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 116 | 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] | 799d1ab | 2010-11-09 17:16:28 | [diff] [blame] | 120 | static void Log(const param_type& p, std::string* l); |
| 121 | }; |
| 122 | |
| 123 | template<> |
[email protected] | 725056b7 | 2013-03-16 09:57:51 | [diff] [blame] | 124 | struct PPAPI_PROXY_EXPORT |
| 125 | ParamTraits<ppapi::proxy::SerializedTrueTypeFontDesc> { |
| 126 | typedef ppapi::proxy::SerializedTrueTypeFontDesc param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 127 | 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] | 725056b7 | 2013-03-16 09:57:51 | [diff] [blame] | 131 | static void Log(const param_type& p, std::string* l); |
| 132 | }; |
| 133 | |
| 134 | template<> |
[email protected] | 246fc49 | 2012-08-27 20:28:18 | [diff] [blame] | 135 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedHandle> { |
| 136 | typedef ppapi::proxy::SerializedHandle param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 137 | 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] | 246fc49 | 2012-08-27 20:28:18 | [diff] [blame] | 141 | static void Log(const param_type& p, std::string* l); |
| 142 | }; |
| 143 | |
| 144 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 145 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::HostResource> { |
[email protected] | be0a84b | 2011-08-13 04:18:44 | [diff] [blame] | 146 | typedef ppapi::HostResource param_type; |
jam | 3db6b6d | 2016-05-13 15:09:58 | [diff] [blame] | 147 | static void GetSize(base::PickleSizer* s, const param_type& p); |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 148 | 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] | f24448db | 2011-01-27 20:40:39 | [diff] [blame] | 152 | static void Log(const param_type& p, std::string* l); |
| 153 | }; |
| 154 | |
| 155 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 156 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedVar> { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 157 | typedef ppapi::proxy::SerializedVar param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 158 | 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] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 162 | static void Log(const param_type& p, std::string* l); |
| 163 | }; |
| 164 | |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 165 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 166 | struct PPAPI_PROXY_EXPORT ParamTraits< |
| 167 | std::vector<ppapi::proxy::SerializedVar> > { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 168 | typedef std::vector<ppapi::proxy::SerializedVar> param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 169 | 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] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 173 | static void Log(const param_type& p, std::string* l); |
| 174 | }; |
| 175 | |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 176 | template<> |
[email protected] | 195d4cde | 2012-10-02 18:12:41 | [diff] [blame] | 177 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PpapiPermissions> { |
| 178 | typedef ppapi::PpapiPermissions param_type; |
jam | 3db6b6d | 2016-05-13 15:09:58 | [diff] [blame] | 179 | static void GetSize(base::PickleSizer* s, const param_type& p); |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 180 | 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] | 195d4cde | 2012-10-02 18:12:41 | [diff] [blame] | 184 | static void Log(const param_type& p, std::string* l); |
| 185 | }; |
| 186 | |
[email protected] | 246fc49 | 2012-08-27 20:28:18 | [diff] [blame] | 187 | #if !defined(OS_NACL) && !defined(NACL_WIN64) |
[email protected] | 0c92b0d | 2012-12-08 00:46:23 | [diff] [blame] | 188 | template <> |
| 189 | struct ParamTraits<ppapi::PepperFilePath> { |
| 190 | typedef ppapi::PepperFilePath param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 191 | 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] | 0c92b0d | 2012-12-08 00:46:23 | [diff] [blame] | 195 | static void Log(const param_type& p, std::string* l); |
| 196 | }; |
| 197 | |
[email protected] | 1162a6a | 2011-04-21 17:28:16 | [diff] [blame] | 198 | template<> |
[email protected] | f41f5369 | 2012-04-05 04:07:32 | [diff] [blame] | 199 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::proxy::SerializedFlashMenu> { |
[email protected] | 4d2efd2 | 2011-08-18 21:58:02 | [diff] [blame] | 200 | typedef ppapi::proxy::SerializedFlashMenu param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 201 | 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] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 205 | static void Log(const param_type& p, std::string* l); |
| 206 | }; |
[email protected] | 667591d | 2012-09-04 21:30:12 | [diff] [blame] | 207 | #endif // !defined(OS_NACL) && !defined(NACL_WIN64) |
[email protected] | 7358d57 | 2011-02-15 18:44:40 | [diff] [blame] | 208 | |
[email protected] | de289526 | 2012-04-04 17:15:48 | [diff] [blame] | 209 | template<> |
| 210 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::PPB_X509Certificate_Fields> { |
| 211 | typedef ppapi::PPB_X509Certificate_Fields param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 212 | 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] | de289526 | 2012-04-04 17:15:48 | [diff] [blame] | 216 | static void Log(const param_type& p, std::string* l); |
| 217 | }; |
[email protected] | 246fc49 | 2012-08-27 20:28:18 | [diff] [blame] | 218 | |
[email protected] | 64a61fc | 2013-06-19 13:30:59 | [diff] [blame] | 219 | template<> |
| 220 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::SocketOptionData> { |
| 221 | typedef ppapi::SocketOptionData param_type; |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 222 | 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] | 64a61fc | 2013-06-19 13:30:59 | [diff] [blame] | 226 | static void Log(const param_type& p, std::string* l); |
| 227 | }; |
[email protected] | de289526 | 2012-04-04 17:15:48 | [diff] [blame] | 228 | |
[email protected] | c44620b | 2014-06-16 14:20:26 | [diff] [blame] | 229 | template<> |
| 230 | struct PPAPI_PROXY_EXPORT ParamTraits<ppapi::CompositorLayerData::Transform> { |
| 231 | typedef ppapi::CompositorLayerData::Transform param_type; |
jam | 3db6b6d | 2016-05-13 15:09:58 | [diff] [blame] | 232 | static void GetSize(base::PickleSizer* s, const param_type& p); |
rockot | 502c94f | 2016-02-03 20:20:16 | [diff] [blame] | 233 | 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] | c44620b | 2014-06-16 14:20:26 | [diff] [blame] | 237 | static void Log(const param_type& p, std::string* l); |
| 238 | }; |
| 239 | |
[email protected] | c2932f5e | 2010-11-03 03:22:33 | [diff] [blame] | 240 | } // namespace IPC |
| 241 | |
| 242 | #endif // PPAPI_PROXY_PPAPI_PARAM_TRAITS_H_ |