OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ppapi/proxy/ppapi_param_traits.h" | 5 #include "ppapi/proxy/ppapi_param_traits.h" |
6 | 6 |
7 #include <string.h> // For memcpy | 7 #include <string.h> // For memcpy |
8 | 8 |
9 #include "ppapi/c/pp_file_info.h" | 9 #include "ppapi/c/pp_file_info.h" |
10 #include "ppapi/c/pp_resource.h" | 10 #include "ppapi/c/pp_resource.h" |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 } | 168 } |
169 | 169 |
170 // static | 170 // static |
171 void ParamTraits<PP_NetAddress_Private>::Log(const param_type& p, | 171 void ParamTraits<PP_NetAddress_Private>::Log(const param_type& p, |
172 std::string* l) { | 172 std::string* l) { |
173 l->append("<PP_NetAddress_Private ("); | 173 l->append("<PP_NetAddress_Private ("); |
174 LogParam(p.size, l); | 174 LogParam(p.size, l); |
175 l->append(" bytes)>"); | 175 l->append(" bytes)>"); |
176 } | 176 } |
177 | 177 |
| 178 // TODO(teravest): Remove this when FileRef is moved to the "new" proxy. |
| 179 // PPB_FileRef_CreateInfo ------------------------------------------------------ |
| 180 |
| 181 // static |
| 182 void ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Write(Message* m, |
| 183 const param_type& p) { |
| 184 ParamTraits<ppapi::HostResource>::Write(m, p.resource); |
| 185 ParamTraits<int>::Write(m, p.file_system_type); |
| 186 ParamTraits<std::string>::Write(m, p.path); |
| 187 ParamTraits<std::string>::Write(m, p.name); |
| 188 ParamTraits<PP_Resource>::Write(m, p.file_system_plugin_resource); |
| 189 } |
| 190 |
| 191 // static |
| 192 bool ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Read(const Message* m, |
| 193 PickleIterator* iter, |
| 194 param_type* r) { |
| 195 return |
| 196 ParamTraits<ppapi::HostResource>::Read(m, iter, &r->resource) && |
| 197 ParamTraits<int>::Read(m, iter, &r->file_system_type) && |
| 198 ParamTraits<std::string>::Read(m, iter, &r->path) && |
| 199 ParamTraits<std::string>::Read(m, iter, &r->name) && |
| 200 ParamTraits<PP_Resource>::Read(m, iter, &r->file_system_plugin_resource); |
| 201 } |
| 202 |
| 203 // static |
| 204 void ParamTraits<ppapi::PPB_FileRef_CreateInfo>::Log(const param_type& p, |
| 205 std::string* l) { |
| 206 } |
| 207 |
178 // HostResource ---------------------------------------------------------------- | 208 // HostResource ---------------------------------------------------------------- |
179 | 209 |
180 // static | 210 // static |
181 void ParamTraits<ppapi::HostResource>::Write(Message* m, | 211 void ParamTraits<ppapi::HostResource>::Write(Message* m, |
182 const param_type& p) { | 212 const param_type& p) { |
183 ParamTraits<PP_Instance>::Write(m, p.instance()); | 213 ParamTraits<PP_Instance>::Write(m, p.instance()); |
184 ParamTraits<PP_Resource>::Write(m, p.host_resource()); | 214 ParamTraits<PP_Resource>::Write(m, p.host_resource()); |
185 } | 215 } |
186 | 216 |
187 // static | 217 // static |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
237 param_type* r) { | 267 param_type* r) { |
238 return ReadVectorWithoutCopy(m, iter, r); | 268 return ReadVectorWithoutCopy(m, iter, r); |
239 } | 269 } |
240 | 270 |
241 // static | 271 // static |
242 void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( | 272 void ParamTraits< std::vector<ppapi::proxy::SerializedVar> >::Log( |
243 const param_type& p, | 273 const param_type& p, |
244 std::string* l) { | 274 std::string* l) { |
245 } | 275 } |
246 | 276 |
| 277 // std::vector<PPB_FileRef_CreateInfo> ----------------------------------------- |
| 278 |
| 279 void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Write( |
| 280 Message* m, |
| 281 const param_type& p) { |
| 282 WriteVectorWithoutCopy(m, p); |
| 283 } |
| 284 |
| 285 // static |
| 286 bool ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Read( |
| 287 const Message* m, |
| 288 PickleIterator* iter, |
| 289 param_type* r) { |
| 290 return ReadVectorWithoutCopy(m, iter, r); |
| 291 } |
| 292 |
| 293 // static |
| 294 void ParamTraits< std::vector<ppapi::PPB_FileRef_CreateInfo> >::Log( |
| 295 const param_type& p, |
| 296 std::string* l) { |
| 297 } |
| 298 |
247 // ppapi::PpapiPermissions ----------------------------------------------------- | 299 // ppapi::PpapiPermissions ----------------------------------------------------- |
248 | 300 |
249 void ParamTraits<ppapi::PpapiPermissions>::Write(Message* m, | 301 void ParamTraits<ppapi::PpapiPermissions>::Write(Message* m, |
250 const param_type& p) { | 302 const param_type& p) { |
251 ParamTraits<uint32_t>::Write(m, p.GetBits()); | 303 ParamTraits<uint32_t>::Write(m, p.GetBits()); |
252 } | 304 } |
253 | 305 |
254 // static | 306 // static |
255 bool ParamTraits<ppapi::PpapiPermissions>::Read(const Message* m, | 307 bool ParamTraits<ppapi::PpapiPermissions>::Read(const Message* m, |
256 PickleIterator* iter, | 308 PickleIterator* iter, |
(...skipping 422 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
679 } | 731 } |
680 return false; | 732 return false; |
681 } | 733 } |
682 | 734 |
683 // static | 735 // static |
684 void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, | 736 void ParamTraits<ppapi::SocketOptionData>::Log(const param_type& p, |
685 std::string* l) { | 737 std::string* l) { |
686 } | 738 } |
687 | 739 |
688 } // namespace IPC | 740 } // namespace IPC |
OLD | NEW |