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

Side by Side Diff: content/common/common_param_traits.cc

Issue 6685013: Use IPEndPoint for P2P IPC messages (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/common_param_traits.h" 5 #include "content/common/common_param_traits.h"
6 6
7 #include "content/common/content_constants.h" 7 #include "content/common/content_constants.h"
8 #include "net/base/host_port_pair.h" 8 #include "net/base/host_port_pair.h"
9 #include "net/base/upload_data.h" 9 #include "net/base/upload_data.h"
10 #include "net/http/http_response_headers.h" 10 #include "net/http/http_response_headers.h"
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 if (has_object) 309 if (has_object)
310 *r = new net::HttpResponseHeaders(*m, iter); 310 *r = new net::HttpResponseHeaders(*m, iter);
311 return true; 311 return true;
312 } 312 }
313 313
314 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log( 314 void ParamTraits<scoped_refptr<net::HttpResponseHeaders> >::Log(
315 const param_type& p, std::string* l) { 315 const param_type& p, std::string* l) {
316 l->append("<HttpResponseHeaders>"); 316 l->append("<HttpResponseHeaders>");
317 } 317 }
318 318
319 void ParamTraits<net::IPEndPoint>::Write(Message* m, const param_type& p) {
320 WriteParam(m, p.address());
321 WriteParam(m, p.port());
322 }
323
324 bool ParamTraits<net::IPEndPoint>::Read(const Message* m, void** iter,
325 param_type* p) {
326 net::IPAddressNumber address;
327 int port;
328 if (!ReadParam(m, iter, &address) || !ReadParam(m, iter, &port))
329 return false;
330 *p = net::IPEndPoint(address, port);
331 return true;
332 }
333
334 void ParamTraits<net::IPEndPoint>::Log(const param_type& p, std::string* l) {
335 LogParam("IPEndPoint:" + p.ToString(), l);
336 }
337
319 void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Write( 338 void ParamTraits<webkit_glue::ResourceLoadTimingInfo>::Write(
320 Message* m, const param_type& p) { 339 Message* m, const param_type& p) {
321 WriteParam(m, p.base_time.is_null()); 340 WriteParam(m, p.base_time.is_null());
322 if (p.base_time.is_null()) 341 if (p.base_time.is_null())
323 return; 342 return;
324 WriteParam(m, p.base_time); 343 WriteParam(m, p.base_time);
325 WriteParam(m, p.proxy_start); 344 WriteParam(m, p.proxy_start);
326 WriteParam(m, p.proxy_end); 345 WriteParam(m, p.proxy_end);
327 WriteParam(m, p.dns_start); 346 WriteParam(m, p.dns_start);
328 WriteParam(m, p.dns_end); 347 WriteParam(m, p.dns_end);
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after
530 r->set_height(h); 549 r->set_height(h);
531 return true; 550 return true;
532 } 551 }
533 552
534 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) { 553 void ParamTraits<gfx::Rect>::Log(const gfx::Rect& p, std::string* l) {
535 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(), 554 l->append(base::StringPrintf("(%d, %d, %d, %d)", p.x(), p.y(),
536 p.width(), p.height())); 555 p.width(), p.height()));
537 } 556 }
538 557
539 } // namespace IPC 558 } // namespace IPC
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698