Index: ppapi/proxy/ppapi_param_traits.cc |
diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc |
index 23d2b727af3ecdd2866613ae70b13765fd5ba350..0a1d4f650d9eb2a38a9928b4517c8201ef1148c0 100644 |
--- a/ppapi/proxy/ppapi_param_traits.cc |
+++ b/ppapi/proxy/ppapi_param_traits.cc |
@@ -10,9 +10,10 @@ |
#include "ppapi/c/pp_resource.h" |
#include "ppapi/c/private/ppb_flash_tcp_socket.h" |
#include "ppapi/proxy/ppapi_messages.h" |
-#include "ppapi/proxy/serialized_var.h" |
#include "ppapi/proxy/serialized_flash_menu.h" |
+#include "ppapi/proxy/serialized_var.h" |
#include "ppapi/shared_impl/host_resource.h" |
+#include "ppapi/shared_impl/private/network_list.h" |
namespace IPC { |
@@ -137,6 +138,39 @@ bool ParamTraits<PP_FileInfo>::Read(const Message* m, void** iter, |
void ParamTraits<PP_FileInfo>::Log(const param_type& p, std::string* l) { |
} |
+// PP_HostResolver_Private_Hint ------------------------------------------------ |
+// static |
+void ParamTraits<PP_HostResolver_Private_Hint>::Write(Message* m, |
+ const param_type& p) { |
+ ParamTraits<int>::Write(m, static_cast<int>(p.family)); |
+ ParamTraits<int>::Write(m, static_cast<int>(p.flags)); |
+} |
+ |
+// static |
+bool ParamTraits<PP_HostResolver_Private_Hint>::Read(const Message* m, |
+ void** iter, |
+ param_type* r) { |
+ int family, flags; |
+ if (!ParamTraits<int>::Read(m, iter, &family) || |
+ !ParamTraits<int>::Read(m, iter, &flags)) { |
+ return false; |
+ } |
+ |
+ if (family != PP_NETADDRESSFAMILY_UNSPECIFIED && |
+ family != PP_NETADDRESSFAMILY_IPV4 && |
+ family != PP_NETADDRESSFAMILY_IPV6) { |
+ return false; |
+ } |
+ r->family = static_cast<PP_NetAddressFamily_Private>(family); |
+ r->flags = static_cast<PP_HostResolver_Private_Flags>(flags); |
+ return true; |
+} |
+ |
+// static |
+void ParamTraits<PP_HostResolver_Private_Hint>::Log(const param_type& p, |
+ std::string* l) { |
+} |
+ |
// PP_NetAddress_Private ------------------------------------------------------- |
// static |
@@ -399,6 +433,49 @@ void ParamTraits<ppapi::HostResource>::Log(const param_type& p, |
std::string* l) { |
} |
+// NetworkList ----------------------------------------------------------------- |
+ |
+// static |
+void ParamTraits<ppapi::NetworkList>::Write(Message* m, const param_type& p) { |
+ ParamTraits<int>::Write(m, static_cast<int>(p.GetSize())); |
+ |
+ std::string canonical_name; |
+ PP_NetAddress_Private address; |
+ |
+ for (size_t i = 0; i < p.GetSize(); ++i) { |
+ p.GetItem(i, &canonical_name, &address); |
+ ParamTraits<std::string>::Write(m, canonical_name); |
+ ParamTraits<PP_NetAddress_Private>::Write(m, address); |
+ } |
+} |
+ |
+// static |
+bool ParamTraits<ppapi::NetworkList>::Read(const Message* m, |
+ void** iter, |
+ param_type* r) { |
+ int size; |
+ if (!ParamTraits<int>::Read(m, iter, &size)) |
+ return false; |
+ |
+ std::string canonical_name; |
+ PP_NetAddress_Private address; |
+ |
+ r->Clear(); |
+ while (size-- > 0) { |
+ if (!ParamTraits<std::string>::Read(m, iter, &canonical_name) || |
+ !ParamTraits<PP_NetAddress_Private>::Read(m, iter, &address)) { |
+ return false; |
+ } |
+ r->Append(canonical_name, address); |
+ } |
+ |
+ return true; |
+} |
+ |
+// static |
+void ParamTraits<ppapi::NetworkList>::Log(const param_type& p, std::string* l) { |
+} |
+ |
// SerializedVar --------------------------------------------------------------- |
// static |