diff options
author | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 04:16:27 +0000 |
---|---|---|
committer | thakis@chromium.org <thakis@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-01 04:16:27 +0000 |
commit | ad8e04ac88be37d5ccb6c2cf61f52b224dca493c (patch) | |
tree | 9bcb878643bdd9e5af6749fff469b2552e569907 /net/socket | |
parent | 5af8043eb24ad60251d8a4e33192e3e6f59246a3 (diff) | |
download | chromium_src-ad8e04ac88be37d5ccb6c2cf61f52b224dca493c.zip chromium_src-ad8e04ac88be37d5ccb6c2cf61f52b224dca493c.tar.gz chromium_src-ad8e04ac88be37d5ccb6c2cf61f52b224dca493c.tar.bz2 |
Convert implicit scoped_refptr constructor calls to explicit ones, part 1
This CL was created automatically by this clang rewriter: http://codereview.appspot.com/2776043/ . I manually fixed a few rough spots of the rewriter output (doh1-3) and fixed all presubmit errors.
BUG=28083
TEST=None
Review URL: http://codereview.chromium.org/4192012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64573 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/socket')
-rw-r--r-- | net/socket/client_socket_pool_base_unittest.cc | 4 | ||||
-rw-r--r-- | net/socket/deterministic_socket_data_unittest.cc | 4 | ||||
-rw-r--r-- | net/socket/socks5_client_socket_unittest.cc | 2 | ||||
-rw-r--r-- | net/socket/socks_client_socket_unittest.cc | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_mac.cc | 4 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_nss.cc | 2 | ||||
-rw-r--r-- | net/socket/ssl_client_socket_unittest.cc | 24 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_pool_unittest.cc | 16 | ||||
-rw-r--r-- | net/socket/tcp_client_socket_unittest.cc | 26 |
9 files changed, 42 insertions, 42 deletions
diff --git a/net/socket/client_socket_pool_base_unittest.cc b/net/socket/client_socket_pool_base_unittest.cc index f8d2d1f..7cf35e3 100644 --- a/net/socket/client_socket_pool_base_unittest.cc +++ b/net/socket/client_socket_pool_base_unittest.cc @@ -1281,7 +1281,7 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { } within_callback_ = true; TestCompletionCallback next_job_callback; - scoped_refptr<TestSocketParams> params = new TestSocketParams(); + scoped_refptr<TestSocketParams> params(new TestSocketParams()); int rv = handle_->Init("a", params, kDefaultPriority, @@ -2087,7 +2087,7 @@ class TestReleasingSocketRequest : public CallbackRunner< Tuple1<int> > { callback_.RunWithParams(params); if (reset_releasing_handle_) handle_.Reset(); - scoped_refptr<TestSocketParams> con_params = new TestSocketParams(); + scoped_refptr<TestSocketParams> con_params(new TestSocketParams()); EXPECT_EQ(expected_result_, handle2_.Init("a", con_params, kDefaultPriority, diff --git a/net/socket/deterministic_socket_data_unittest.cc b/net/socket/deterministic_socket_data_unittest.cc index 199dd0b..5e25aa0 100644 --- a/net/socket/deterministic_socket_data_unittest.cc +++ b/net/socket/deterministic_socket_data_unittest.cc @@ -131,7 +131,7 @@ void DeterministicSocketDataTest::AssertReadBufferEquals(const char* data, void DeterministicSocketDataTest::AssertSyncWriteEquals(const char* data, int len) { - scoped_refptr<IOBuffer> buf = new IOBuffer(len); + scoped_refptr<IOBuffer> buf(new IOBuffer(len)); memcpy(buf->data(), data, len); // Issue the write, which will complete immediately @@ -152,7 +152,7 @@ void DeterministicSocketDataTest::AssertAsyncWriteEquals(const char* data, void DeterministicSocketDataTest::AssertWriteReturns(const char* data, int len, int rv) { - scoped_refptr<IOBuffer> buf = new IOBuffer(len); + scoped_refptr<IOBuffer> buf(new IOBuffer(len)); memcpy(buf->data(), data, len); // Issue the read, which will complete asynchronously diff --git a/net/socket/socks5_client_socket_unittest.cc b/net/socket/socks5_client_socket_unittest.cc index 43a441d..2152c86 100644 --- a/net/socket/socks5_client_socket_unittest.cc +++ b/net/socket/socks5_client_socket_unittest.cc @@ -141,7 +141,7 @@ TEST_F(SOCKS5ClientSocketTest, CompleteHandshake) { EXPECT_TRUE(LogContainsEndEvent(net_log_.entries(), -1, NetLog::TYPE_SOCKS5_CONNECT)); - scoped_refptr<IOBuffer> buffer = new IOBuffer(payload_write.size()); + scoped_refptr<IOBuffer> buffer(new IOBuffer(payload_write.size())); memcpy(buffer->data(), payload_write.data(), payload_write.size()); rv = user_sock_->Write(buffer, payload_write.size(), &callback_); EXPECT_EQ(ERR_IO_PENDING, rv); diff --git a/net/socket/socks_client_socket_unittest.cc b/net/socket/socks_client_socket_unittest.cc index 086b21d9..11a88ae 100644 --- a/net/socket/socks_client_socket_unittest.cc +++ b/net/socket/socks_client_socket_unittest.cc @@ -153,7 +153,7 @@ TEST_F(SOCKSClientSocketTest, CompleteHandshake) { EXPECT_TRUE(LogContainsEndEvent( log.entries(), -1, NetLog::TYPE_SOCKS_CONNECT)); - scoped_refptr<IOBuffer> buffer = new IOBuffer(payload_write.size()); + scoped_refptr<IOBuffer> buffer(new IOBuffer(payload_write.size())); memcpy(buffer->data(), payload_write.data(), payload_write.size()); rv = user_sock_->Write(buffer, payload_write.size(), &callback_); EXPECT_EQ(ERR_IO_PENDING, rv); diff --git a/net/socket/ssl_client_socket_mac.cc b/net/socket/ssl_client_socket_mac.cc index 02c2097..d6fca9b 100644 --- a/net/socket/ssl_client_socket_mac.cc +++ b/net/socket/ssl_client_socket_mac.cc @@ -1132,8 +1132,8 @@ int SSLClientSocketMac::DidCompleteHandshake() { DCHECK(!server_cert_ || renegotiating_); VLOG(1) << "Handshake completed, next verify cert"; - scoped_refptr<X509Certificate> new_server_cert = - GetServerCert(ssl_context_); + scoped_refptr<X509Certificate> new_server_cert( + GetServerCert(ssl_context_)); if (!new_server_cert) return ERR_UNEXPECTED; diff --git a/net/socket/ssl_client_socket_nss.cc b/net/socket/ssl_client_socket_nss.cc index 358efd4..37d2642 100644 --- a/net/socket/ssl_client_socket_nss.cc +++ b/net/socket/ssl_client_socket_nss.cc @@ -1411,7 +1411,7 @@ int SSLClientSocketNSS::BufferSend(void) { int rv = 0; if (len) { - scoped_refptr<IOBuffer> send_buffer = new IOBuffer(len); + scoped_refptr<IOBuffer> send_buffer(new IOBuffer(len)); memcpy(send_buffer->data(), buf1, len1); memcpy(send_buffer->data() + len1, buf2, len2); rv = transport_->socket()->Write(send_buffer, len, diff --git a/net/socket/ssl_client_socket_unittest.cc b/net/socket/ssl_client_socket_unittest.cc index 1cd7210..a32d5df 100644 --- a/net/socket/ssl_client_socket_unittest.cc +++ b/net/socket/ssl_client_socket_unittest.cc @@ -320,8 +320,8 @@ TEST_F(SSLClientSocketTest, Read) { EXPECT_TRUE(sock->IsConnected()); const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; - scoped_refptr<net::IOBuffer> request_buffer = - new net::IOBuffer(arraysize(request_text) - 1); + scoped_refptr<net::IOBuffer> request_buffer( + new net::IOBuffer(arraysize(request_text) - 1)); memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); rv = sock->Write(request_buffer, arraysize(request_text) - 1, &callback); @@ -331,7 +331,7 @@ TEST_F(SSLClientSocketTest, Read) { rv = callback.WaitForResult(); EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv); - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(4096); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(4096)); for (;;) { rv = sock->Read(buf, 4096, &callback); EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); @@ -381,7 +381,7 @@ TEST_F(SSLClientSocketTest, Read_FullDuplex) { EXPECT_TRUE(sock->IsConnected()); // Issue a "hanging" Read first. - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(4096); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(4096)); rv = sock->Read(buf, 4096, &callback); // We haven't written the request, so there should be no response yet. ASSERT_EQ(net::ERR_IO_PENDING, rv); @@ -394,8 +394,8 @@ TEST_F(SSLClientSocketTest, Read_FullDuplex) { for (int i = 0; i < 3800; ++i) request_text.push_back('*'); request_text.append("\r\n\r\n"); - scoped_refptr<net::IOBuffer> request_buffer = - new net::StringIOBuffer(request_text); + scoped_refptr<net::IOBuffer> request_buffer( + new net::StringIOBuffer(request_text)); rv = sock->Write(request_buffer, request_text.size(), &callback2); EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); @@ -438,8 +438,8 @@ TEST_F(SSLClientSocketTest, Read_SmallChunks) { } const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; - scoped_refptr<net::IOBuffer> request_buffer = - new net::IOBuffer(arraysize(request_text) - 1); + scoped_refptr<net::IOBuffer> request_buffer( + new net::IOBuffer(arraysize(request_text) - 1)); memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); rv = sock->Write(request_buffer, arraysize(request_text) - 1, &callback); @@ -449,7 +449,7 @@ TEST_F(SSLClientSocketTest, Read_SmallChunks) { rv = callback.WaitForResult(); EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv); - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(1); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(1)); for (;;) { rv = sock->Read(buf, 1, &callback); EXPECT_TRUE(rv >= 0 || rv == net::ERR_IO_PENDING); @@ -492,8 +492,8 @@ TEST_F(SSLClientSocketTest, Read_Interrupted) { } const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; - scoped_refptr<net::IOBuffer> request_buffer = - new net::IOBuffer(arraysize(request_text) - 1); + scoped_refptr<net::IOBuffer> request_buffer( + new net::IOBuffer(arraysize(request_text) - 1)); memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); rv = sock->Write(request_buffer, arraysize(request_text) - 1, &callback); @@ -504,7 +504,7 @@ TEST_F(SSLClientSocketTest, Read_Interrupted) { EXPECT_EQ(static_cast<int>(arraysize(request_text) - 1), rv); // Do a partial read and then exit. This test should not crash! - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(512); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(512)); rv = sock->Read(buf, 512, &callback); EXPECT_TRUE(rv > 0 || rv == net::ERR_IO_PENDING); diff --git a/net/socket/tcp_client_socket_pool_unittest.cc b/net/socket/tcp_client_socket_pool_unittest.cc index ffb530b..1a4ca02 100644 --- a/net/socket/tcp_client_socket_pool_unittest.cc +++ b/net/socket/tcp_client_socket_pool_unittest.cc @@ -297,8 +297,8 @@ class TCPClientSocketPoolTest : public testing::Test { } int StartRequest(const std::string& group_name, RequestPriority priority) { - scoped_refptr<TCPSocketParams> params = new TCPSocketParams( - HostPortPair("www.google.com", 80), MEDIUM, GURL(), false); + scoped_refptr<TCPSocketParams> params(new TCPSocketParams( + HostPortPair("www.google.com", 80), MEDIUM, GURL(), false)); return test_base_.StartRequestUsingPool( &pool_, group_name, priority, params); } @@ -346,8 +346,8 @@ TEST_F(TCPClientSocketPoolTest, InitHostResolutionFailure) { host_resolver_->rules()->AddSimulatedFailure("unresolvable.host.name"); TestCompletionCallback callback; ClientSocketHandle handle; - scoped_refptr<TCPSocketParams> dest = new TCPSocketParams( - "unresolvable.host.name", 80, kDefaultPriority, GURL(), false); + scoped_refptr<TCPSocketParams> dest(new TCPSocketParams( + "unresolvable.host.name", 80, kDefaultPriority, GURL(), false)); EXPECT_EQ(ERR_IO_PENDING, handle.Init("a", dest, kDefaultPriority, &callback, &pool_, BoundNetLog())); @@ -605,8 +605,8 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { MessageLoop::current()->RunAllPending(); } within_callback_ = true; - scoped_refptr<TCPSocketParams> dest = new TCPSocketParams( - HostPortPair("www.google.com", 80), LOWEST, GURL(), false); + scoped_refptr<TCPSocketParams> dest(new TCPSocketParams( + HostPortPair("www.google.com", 80), LOWEST, GURL(), false)); int rv = handle_->Init("a", dest, LOWEST, this, pool_, BoundNetLog()); EXPECT_EQ(OK, rv); } @@ -626,8 +626,8 @@ class RequestSocketCallback : public CallbackRunner< Tuple1<int> > { TEST_F(TCPClientSocketPoolTest, RequestTwice) { ClientSocketHandle handle; RequestSocketCallback callback(&handle, &pool_); - scoped_refptr<TCPSocketParams> dest = new TCPSocketParams( - HostPortPair("www.google.com", 80), LOWEST, GURL(), false); + scoped_refptr<TCPSocketParams> dest(new TCPSocketParams( + HostPortPair("www.google.com", 80), LOWEST, GURL(), false)); int rv = handle.Init("a", dest, LOWEST, &callback, &pool_, BoundNetLog()); ASSERT_EQ(ERR_IO_PENDING, rv); diff --git a/net/socket/tcp_client_socket_unittest.cc b/net/socket/tcp_client_socket_unittest.cc index 3d92166..64d78f3 100644 --- a/net/socket/tcp_client_socket_unittest.cc +++ b/net/socket/tcp_client_socket_unittest.cc @@ -138,8 +138,8 @@ TEST_F(TCPClientSocketTest, Read) { } const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; - scoped_refptr<IOBuffer> request_buffer = - new IOBuffer(arraysize(request_text) - 1); + scoped_refptr<IOBuffer> request_buffer( + new IOBuffer(arraysize(request_text) - 1)); memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); rv = sock_->Write(request_buffer, arraysize(request_text) - 1, &callback); @@ -150,7 +150,7 @@ TEST_F(TCPClientSocketTest, Read) { EXPECT_EQ(rv, static_cast<int>(arraysize(request_text) - 1)); } - scoped_refptr<IOBuffer> buf = new IOBuffer(4096); + scoped_refptr<IOBuffer> buf(new IOBuffer(4096)); uint32 bytes_read = 0; while (bytes_read < arraysize(kServerReply) - 1) { rv = sock_->Read(buf, 4096, &callback); @@ -183,8 +183,8 @@ TEST_F(TCPClientSocketTest, Read_SmallChunks) { } const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; - scoped_refptr<IOBuffer> request_buffer = - new IOBuffer(arraysize(request_text) - 1); + scoped_refptr<IOBuffer> request_buffer( + new IOBuffer(arraysize(request_text) - 1)); memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); rv = sock_->Write(request_buffer, arraysize(request_text) - 1, &callback); @@ -195,7 +195,7 @@ TEST_F(TCPClientSocketTest, Read_SmallChunks) { EXPECT_EQ(rv, static_cast<int>(arraysize(request_text) - 1)); } - scoped_refptr<IOBuffer> buf = new IOBuffer(1); + scoped_refptr<IOBuffer> buf(new IOBuffer(1)); uint32 bytes_read = 0; while (bytes_read < arraysize(kServerReply) - 1) { rv = sock_->Read(buf, 1, &callback); @@ -228,8 +228,8 @@ TEST_F(TCPClientSocketTest, Read_Interrupted) { } const char request_text[] = "GET / HTTP/1.0\r\n\r\n"; - scoped_refptr<IOBuffer> request_buffer = - new IOBuffer(arraysize(request_text) - 1); + scoped_refptr<IOBuffer> request_buffer( + new IOBuffer(arraysize(request_text) - 1)); memcpy(request_buffer->data(), request_text, arraysize(request_text) - 1); rv = sock_->Write(request_buffer, arraysize(request_text) - 1, &callback); @@ -241,7 +241,7 @@ TEST_F(TCPClientSocketTest, Read_Interrupted) { } // Do a partial read and then exit. This test should not crash! - scoped_refptr<IOBuffer> buf = new IOBuffer(16); + scoped_refptr<IOBuffer> buf(new IOBuffer(16)); rv = sock_->Read(buf, 16, &callback); EXPECT_TRUE(rv >= 0 || rv == ERR_IO_PENDING); @@ -263,13 +263,13 @@ TEST_F(TCPClientSocketTest, DISABLED_FullDuplex_ReadFirst) { // Read first. There's no data, so it should return ERR_IO_PENDING. const int kBufLen = 4096; - scoped_refptr<IOBuffer> buf = new IOBuffer(kBufLen); + scoped_refptr<IOBuffer> buf(new IOBuffer(kBufLen)); rv = sock_->Read(buf, kBufLen, &callback); EXPECT_EQ(ERR_IO_PENDING, rv); PauseServerReads(); const int kWriteBufLen = 64 * 1024; - scoped_refptr<IOBuffer> request_buffer = new IOBuffer(kWriteBufLen); + scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kWriteBufLen)); char* request_data = request_buffer->data(); memset(request_data, 'A', kWriteBufLen); TestCompletionCallback write_callback; @@ -305,7 +305,7 @@ TEST_F(TCPClientSocketTest, DISABLED_FullDuplex_WriteFirst) { PauseServerReads(); const int kWriteBufLen = 64 * 1024; - scoped_refptr<IOBuffer> request_buffer = new IOBuffer(kWriteBufLen); + scoped_refptr<IOBuffer> request_buffer(new IOBuffer(kWriteBufLen)); char* request_data = request_buffer->data(); memset(request_data, 'A', kWriteBufLen); TestCompletionCallback write_callback; @@ -322,7 +322,7 @@ TEST_F(TCPClientSocketTest, DISABLED_FullDuplex_WriteFirst) { // Read() to block on ERR_IO_PENDING too. const int kBufLen = 4096; - scoped_refptr<IOBuffer> buf = new IOBuffer(kBufLen); + scoped_refptr<IOBuffer> buf(new IOBuffer(kBufLen)); while (true) { rv = sock_->Read(buf, kBufLen, &callback); ASSERT_TRUE(rv >= 0 || rv == ERR_IO_PENDING); |