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 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
117 *p = net::IPEndPoint(address, port); | 117 *p = net::IPEndPoint(address, port); |
118 return true; | 118 return true; |
119 } | 119 } |
120 | 120 |
121 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { | 121 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) { |
122 LogParam("IPEndPoint:" + p.ToString(), l); | 122 LogParam("IPEndPoint:" + p.ToString(), l); |
123 } | 123 } |
124 | 124 |
125 void ParamTraits<net::IPAddress>::GetSize(base::PickleSizer* s, | 125 void ParamTraits<net::IPAddress>::GetSize(base::PickleSizer* s, |
126 const param_type& p) { | 126 const param_type& p) { |
127 GetParamSize(s, p.bytes()); | 127 GetParamSize(s, p.BytesAsVector()); |
eroman
2017/05/12 23:25:04
Can you improve the efficiency of this?
(Construct
Ryan Hamilton
2017/05/13 13:20:46
Good point. Done.
| |
128 } | 128 } |
129 | 129 |
130 void ParamTraits<net::IPAddress>::Write(base::Pickle* m, const param_type& p) { | 130 void ParamTraits<net::IPAddress>::Write(base::Pickle* m, const param_type& p) { |
131 WriteParam(m, p.bytes()); | 131 WriteParam(m, p.BytesAsVector()); |
eroman
2017/05/12 23:25:04
Same here.
Ryan Hamilton
2017/05/13 13:20:46
Done.
| |
132 } | 132 } |
133 | 133 |
134 bool ParamTraits<net::IPAddress>::Read(const base::Pickle* m, | 134 bool ParamTraits<net::IPAddress>::Read(const base::Pickle* m, |
135 base::PickleIterator* iter, | 135 base::PickleIterator* iter, |
136 param_type* p) { | 136 param_type* p) { |
137 std::vector<uint8_t> bytes; | 137 std::vector<uint8_t> bytes; |
138 if (!ReadParam(m, iter, &bytes)) | 138 if (!ReadParam(m, iter, &bytes)) |
139 return false; | 139 return false; |
140 if (bytes.size() && | 140 if (bytes.size() && |
141 bytes.size() != net::IPAddress::kIPv4AddressSize && | 141 bytes.size() != net::IPAddress::kIPv4AddressSize && |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
199 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 199 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
200 #include "content/public/common/common_param_traits_macros.h" | 200 #include "content/public/common/common_param_traits_macros.h" |
201 } // namespace IPC | 201 } // namespace IPC |
202 | 202 |
203 // Generate param traits log methods. | 203 // Generate param traits log methods. |
204 #include "ipc/param_traits_log_macros.h" | 204 #include "ipc/param_traits_log_macros.h" |
205 namespace IPC { | 205 namespace IPC { |
206 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ | 206 #undef CONTENT_PUBLIC_COMMON_COMMON_PARAM_TRAITS_MACROS_H_ |
207 #include "content/public/common/common_param_traits_macros.h" | 207 #include "content/public/common/common_param_traits_macros.h" |
208 } // namespace IPC | 208 } // namespace IPC |
OLD | NEW |