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

Unified Diff: net/socket/tcp_listen_socket_unittest.cc

Issue 20142003: Remove ref-counting from StreamListenSocket (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed comments Created 7 years, 4 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/socket/tcp_listen_socket_unittest.h ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/socket/tcp_listen_socket_unittest.cc
diff --git a/net/socket/tcp_listen_socket_unittest.cc b/net/socket/tcp_listen_socket_unittest.cc
index 9589ce2e0d439f23d63276e496314eaa191fe931..b122c6143d89446c563b68962be0e8383a9de099 100644
--- a/net/socket/tcp_listen_socket_unittest.cc
+++ b/net/socket/tcp_listen_socket_unittest.cc
@@ -26,8 +26,6 @@ static const int kDefaultTimeoutMs = 5000;
TCPListenSocketTester::TCPListenSocketTester()
: loop_(NULL),
- server_(NULL),
- connection_(NULL),
cv_(&lock_),
server_port_(0) {}
@@ -121,17 +119,14 @@ int TCPListenSocketTester::ClearTestSocket() {
}
void TCPListenSocketTester::Shutdown() {
- connection_->Release();
- connection_ = NULL;
- server_->Release();
- server_ = NULL;
+ connection_.reset();
+ server_.reset();
ReportAction(TCPListenSocketTestAction(ACTION_SHUTDOWN));
}
void TCPListenSocketTester::Listen() {
server_ = DoListen();
ASSERT_TRUE(server_.get());
- server_->AddRef();
// The server's port will be needed to open the client socket.
IPEndPoint local_address;
@@ -241,10 +236,10 @@ bool TCPListenSocketTester::Send(SocketDescriptor sock,
return true;
}
-void TCPListenSocketTester::DidAccept(StreamListenSocket* server,
- StreamListenSocket* connection) {
- connection_ = connection;
- connection_->AddRef();
+void TCPListenSocketTester::DidAccept(
+ StreamListenSocket* server,
+ scoped_ptr<StreamListenSocket> connection) {
+ connection_ = connection.Pass();
ReportAction(TCPListenSocketTestAction(ACTION_ACCEPT));
}
@@ -261,7 +256,7 @@ void TCPListenSocketTester::DidClose(StreamListenSocket* sock) {
TCPListenSocketTester::~TCPListenSocketTester() {}
-scoped_refptr<TCPListenSocket> TCPListenSocketTester::DoListen() {
+scoped_ptr<TCPListenSocket> TCPListenSocketTester::DoListen() {
// Let the OS pick a free port.
return TCPListenSocket::CreateAndListen(kLoopback, 0, this);
}
« no previous file with comments | « net/socket/tcp_listen_socket_unittest.h ('k') | net/socket/transport_client_socket_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698