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

Unified Diff: ppapi/shared_impl/private/net_address_private_impl.cc

Issue 10309002: Reimplements net::AddressList without struct addrinfo. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: get_canonical_name -> canonical_name. iterator to indexing Created 8 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/websockets/websocket_throttle_unittest.cc ('k') | ppapi/shared_impl/private/ppb_host_resolver_shared.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/shared_impl/private/net_address_private_impl.cc
diff --git a/ppapi/shared_impl/private/net_address_private_impl.cc b/ppapi/shared_impl/private/net_address_private_impl.cc
index 148d5e5a14b262e2908c360a5e8aa5b5fb18e26a..2d181ec6e02699e955eabe9571273ee03927691c 100644
--- a/ppapi/shared_impl/private/net_address_private_impl.cc
+++ b/ppapi/shared_impl/private/net_address_private_impl.cc
@@ -16,7 +16,6 @@
#include "net/base/address_list.h"
#include "net/base/ip_endpoint.h"
#include "net/base/net_util.h"
-#include "net/base/sys_addrinfo.h"
#include "ppapi/c/pp_var.h"
#include "ppapi/c/private/ppb_net_address_private.h"
#include "ppapi/shared_impl/var.h"
@@ -472,21 +471,18 @@ bool NetAddressPrivateImpl::SockaddrToNetAddress(
bool NetAddressPrivateImpl::IPEndPointToNetAddress(
const net::IPEndPoint& ip,
PP_NetAddress_Private* net_addr) {
- sockaddr_storage storage = { 0 };
- size_t length = sizeof(storage);
+ net::SockaddrStorage storage;
- return ip.ToSockAddr(reinterpret_cast<sockaddr*>(&storage), &length) &&
- SockaddrToNetAddress(reinterpret_cast<const sockaddr*>(&storage), length,
- net_addr);
+ return ip.ToSockAddr(storage.addr, &storage.addr_len) &&
+ SockaddrToNetAddress(storage.addr, storage.addr_len, net_addr);
}
// static
bool NetAddressPrivateImpl::AddressListToNetAddress(
const net::AddressList& address_list,
PP_NetAddress_Private* net_addr) {
- const addrinfo* head = address_list.head();
- return head && SockaddrToNetAddress(head->ai_addr, head->ai_addrlen,
- net_addr);
+ return !address_list.empty() && IPEndPointToNetAddress(address_list.front(),
+ net_addr);
}
// static
@@ -514,8 +510,7 @@ bool NetAddressPrivateImpl::NetAddressToAddressList(
if (!NetAddressToIPEndPoint(net_addr, &ip_end_point))
return false;
- *address_list = net::AddressList::CreateFromIPAddress(ip_end_point.address(),
- ip_end_point.port());
+ *address_list = net::AddressList(ip_end_point);
return true;
}
« no previous file with comments | « net/websockets/websocket_throttle_unittest.cc ('k') | ppapi/shared_impl/private/ppb_host_resolver_shared.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698