Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(335)

Unified Diff: content/public/common/common_param_traits.cc

Issue 2881673002: Avoid heap allocations in IPAddress (Closed)
Patch Set: Address comments Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/public/common/common_param_traits.cc
diff --git a/content/public/common/common_param_traits.cc b/content/public/common/common_param_traits.cc
index 286e6621cc6212cf727ba636c44d4df4a0ba6ceb..149804d8119f5f9adcce333c4cb3cdbc89ddfce1 100644
--- a/content/public/common/common_param_traits.cc
+++ b/content/public/common/common_param_traits.cc
@@ -124,11 +124,13 @@ void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) {
void ParamTraits<net::IPAddress>::GetSize(base::PickleSizer* s,
const param_type& p) {
- GetParamSize(s, p.bytes());
+ for (uint8_t byte : p.bytes())
eroman 2017/05/15 22:15:23 This doesn't look right to me, are browser tests p
Ryan Hamilton 2017/05/17 18:26:41 Yes, it looks like they are. I *think* This is cor
+ GetParamSize(s, byte);
}
void ParamTraits<net::IPAddress>::Write(base::Pickle* m, const param_type& p) {
- WriteParam(m, p.bytes());
+ for (uint8_t byte : p.bytes())
eroman 2017/05/15 22:15:23 Same here. Not sure how this works, given it is no
Ryan Hamilton 2017/05/17 18:26:41 I *think* this works and seems correct to me. Here
eroman 2017/05/17 20:48:16 I don't see how this code can be correct, what am
Ryan Hamilton 2017/05/17 23:14:04 *facepalm* Yes, you're right of course. I've swit
+ WriteParam(m, byte);
}
bool ParamTraits<net::IPAddress>::Read(const base::Pickle* m,

Powered by Google App Engine
This is Rietveld 408576698