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 "content/public/common/common_param_traits.h" | 5 #include "content/public/common/common_param_traits.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "content/public/common/content_constants.h" | 9 #include "content/public/common/content_constants.h" |
10 #include "content/public/common/page_state.h" | 10 #include "content/public/common/page_state.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 } | 95 } |
96 | 96 |
97 void ParamTraits<net::IPEndPoint>::Write(Message* m, const param_type& p) { | 97 void ParamTraits<net::IPEndPoint>::Write(Message* m, const param_type& p) { |
98 WriteParam(m, p.address()); | 98 WriteParam(m, p.address()); |
99 WriteParam(m, p.port()); | 99 WriteParam(m, p.port()); |
100 } | 100 } |
101 | 101 |
102 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, PickleIterator* iter, | 102 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, PickleIterator* iter, |
103 param_type* p) { | 103 param_type* p) { |
104 net::IPAddressNumber address; | 104 net::IPAddressNumber address; |
105 int port; | 105 uint16 port; |
106 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) | 106 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port)) |
107 return false; | 107 return false; |
108 if (address.size() && | 108 if (address.size() && |
109 address.size() != net::kIPv4AddressSize && | 109 address.size() != net::kIPv4AddressSize && |
110 address.size() != net::kIPv6AddressSize) { | 110 address.size() != net::kIPv6AddressSize) { |
111 return false; | 111 return false; |
112 } | 112 } |
113 *p = net::IPEndPoint(address, port); | 113 *p = net::IPEndPoint(address, port); |
114 return true; | 114 return true; |
115 } | 115 } |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 154 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
155 #include "content/public/common/common_param_traits_macros.h" | 155 #include "content/public/common/common_param_traits_macros.h" |
156 } // namespace IPC | 156 } // namespace IPC |
157 | 157 |
158 // Generate param traits log methods. | 158 // Generate param traits log methods. |
159 #include "ipc/param_traits_log_macros.h" | 159 #include "ipc/param_traits_log_macros.h" |
160 namespace IPC { | 160 namespace IPC { |
161 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 161 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
162 #include "content/public/common/common_param_traits_macros.h" | 162 #include "content/public/common/common_param_traits_macros.h" |
163 } // namespace IPC | 163 } // namespace IPC |
OLD | NEW |