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

Unified Diff: net/dns/mojo_host_struct_traits.h

Issue 2881673002: Avoid heap allocations in IPAddress (Closed)
Patch Set: New constructor 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
« no previous file with comments | « net/dns/mdns_client.cc ('k') | net/dns/mojo_host_struct_traits.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/dns/mojo_host_struct_traits.h
diff --git a/net/dns/mojo_host_struct_traits.h b/net/dns/mojo_host_struct_traits.h
index 307e1b22ba8371aa75bb145abc95825e6270c523..ca7e2f46886762a17dbf3fb12029828e1b5cfad1 100644
--- a/net/dns/mojo_host_struct_traits.h
+++ b/net/dns/mojo_host_struct_traits.h
@@ -50,8 +50,9 @@ struct StructTraits<net::interfaces::HostResolverRequestInfoDataView,
template <>
struct StructTraits<net::interfaces::IPEndPointDataView, net::IPEndPoint> {
- static const std::vector<uint8_t>& address(const net::IPEndPoint& obj) {
- return obj.address().bytes();
+ static const std::vector<uint8_t> address(const net::IPEndPoint& obj) {
+ // TODO(rch): avoid creating a vector here.
+ return obj.address().CopyBytesToVector();
}
static uint16_t port(const net::IPEndPoint& obj) { return obj.port(); }
« no previous file with comments | « net/dns/mdns_client.cc ('k') | net/dns/mojo_host_struct_traits.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698