diff options
author | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 02:02:40 +0000 |
---|---|---|
committer | eroman@chromium.org <eroman@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-05-12 02:02:40 +0000 |
commit | fe89ea7e351d304ca379125329018f5b96a2aded (patch) | |
tree | f4a0a43fc9e626d3a8e015a363ebbab635154e4e /content | |
parent | 1870d5cfa5ca359b44a32322c225cca1b2818e91 (diff) | |
download | chromium_src-fe89ea7e351d304ca379125329018f5b96a2aded.zip chromium_src-fe89ea7e351d304ca379125329018f5b96a2aded.tar.gz chromium_src-fe89ea7e351d304ca379125329018f5b96a2aded.tar.bz2 |
Miscelaneous cleanups to AddressList to make it harder to mis-use.
- Removed all destructive non-const member functions -- these were dangerous since if you called them without first making a copy of the AddressList, it could mutate earlier copies.
- Made AddressList::Data::head const, so new code added to AddressList cannot inadvertently introduce such dangerous mutations (won't compile).
- Moved the non-trivial constructors and assign methods into factory methods (for added readability)
- Removed the bool parameter from Copy (for added readability).
Review URL: http://codereview.chromium.org/6880302
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@85090 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content')
-rw-r--r-- | content/browser/renderer_host/p2p/socket_host_tcp.cc | 3 | ||||
-rw-r--r-- | content/browser/renderer_host/p2p/socket_host_test_utils.h | 4 |
2 files changed, 4 insertions, 3 deletions
diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc index 1e5d48b..8d824b3 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc @@ -56,7 +56,8 @@ bool P2PSocketHostTcp::Init(const net::IPEndPoint& local_address, remote_address_ = remote_address; state_ = STATE_CONNECTING; socket_.reset(new net::TCPClientSocket( - net::AddressList(remote_address.address(), remote_address.port(), false), + net::AddressList::CreateFromIPAddress( + remote_address.address(), remote_address.port()), NULL, net::NetLog::Source())); int result = socket_->Connect(&connect_callback_); if (result != net::ERR_IO_PENDING) { diff --git a/content/browser/renderer_host/p2p/socket_host_test_utils.h b/content/browser/renderer_host/p2p/socket_host_test_utils.h index 2c8eb22..bc829fd 100644 --- a/content/browser/renderer_host/p2p/socket_host_test_utils.h +++ b/content/browser/renderer_host/p2p/socket_host_test_utils.h @@ -178,8 +178,8 @@ bool FakeSocket::IsConnectedAndIdle() const { } int FakeSocket::GetPeerAddress(net::AddressList* address) const { - *address = net::AddressList(peer_address_.address(), - peer_address_.port(), false); + *address = net::AddressList::CreateFromIPAddress(peer_address_.address(), + peer_address_.port()); return net::OK; } |