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 | |
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')
52 files changed, 425 insertions, 425 deletions
diff --git a/net/base/cookie_monster_perftest.cc b/net/base/cookie_monster_perftest.cc index c006128..8c64d9a 100644 --- a/net/base/cookie_monster_perftest.cc +++ b/net/base/cookie_monster_perftest.cc @@ -283,10 +283,10 @@ TEST(CookieMonsterTest, TestGCTimes) { }; for (int ci = 0; ci < static_cast<int>(ARRAYSIZE_UNSAFE(test_cases)); ++ci) { const TestCase& test_case(test_cases[ci]); - scoped_refptr<CookieMonster> cm = + scoped_refptr<CookieMonster> cm( CreateMonsterFromStoreForGC( test_case.num_cookies, test_case.num_old_cookies, - CookieMonster::kSafeFromGlobalPurgeDays * 2); + CookieMonster::kSafeFromGlobalPurgeDays * 2)); GURL gurl("http://google.com"); std::string cookie_line("z=3"); diff --git a/net/base/cookie_monster_unittest.cc b/net/base/cookie_monster_unittest.cc index f4cca57..751b255 100644 --- a/net/base/cookie_monster_unittest.cc +++ b/net/base/cookie_monster_unittest.cc @@ -1852,7 +1852,7 @@ TEST(CookieMonsterTest, BackingStoreCommunication) { // Create new cookies and flush them to the store. { - scoped_refptr<net::CookieMonster> cmout = new CookieMonster(store, NULL); + scoped_refptr<net::CookieMonster> cmout(new CookieMonster(store, NULL)); for (const CookiesInputInfo* p = input_info; p < &input_info[ARRAYSIZE_UNSAFE(input_info)]; p++) { EXPECT_TRUE(cmout->SetCookieWithDetails(GURL(p->gurl), p->name, p->value, @@ -1866,7 +1866,7 @@ TEST(CookieMonsterTest, BackingStoreCommunication) { // Create a new cookie monster and make sure that everything is correct { - scoped_refptr<net::CookieMonster> cmin = new CookieMonster(store, NULL); + scoped_refptr<net::CookieMonster> cmin(new CookieMonster(store, NULL)); CookieMonster::CookieList cookies(cmin->GetAllCookies()); ASSERT_EQ(2u, cookies.size()); // Ordering is path length, then creation time. So second cookie @@ -1895,7 +1895,7 @@ TEST(CookieMonsterTest, BackingStoreCommunication) { TEST(CookieMonsterTest, CookieOrdering) { // Put a random set of cookies into a monster and make sure // they're returned in the right order. - scoped_refptr<net::CookieMonster> cm = new CookieMonster(NULL, NULL); + scoped_refptr<net::CookieMonster> cm(new CookieMonster(NULL, NULL)); EXPECT_TRUE(cm->SetCookie(GURL("http://d.c.b.a.google.com/aa/x.html"), "c=1")); EXPECT_TRUE(cm->SetCookie(GURL("http://b.a.google.com/aa/bb/cc/x.html"), @@ -1957,8 +1957,8 @@ TEST(CookieMonsterTest, GarbageCollectionTriggers) { // First we check to make sure that a whole lot of recent cookies // doesn't get rid of anything after garbage collection is checked for. { - scoped_refptr<net::CookieMonster> cm = - CreateMonsterForGC(CookieMonster::kMaxCookies * 2); + scoped_refptr<net::CookieMonster> cm( + CreateMonsterForGC(CookieMonster::kMaxCookies * 2)); EXPECT_EQ(CookieMonster::kMaxCookies * 2, cm->GetAllCookies().size()); cm->SetCookie(GURL("http://newdomain.com"), "b=2"); EXPECT_EQ(CookieMonster::kMaxCookies * 2 + 1, cm->GetAllCookies().size()); @@ -2016,10 +2016,10 @@ TEST(CookieMonsterTest, GarbageCollectionTriggers) { recent_scheme < static_cast<int>(ARRAYSIZE_UNSAFE(schemes)); recent_scheme++) { const TestCase *test_case = &test_cases[ci]; - scoped_refptr<net::CookieMonster> cm = + scoped_refptr<net::CookieMonster> cm( CreateMonsterFromStoreForGC( test_case->num_cookies, test_case->num_old_cookies, - CookieMonster::kSafeFromGlobalPurgeDays * 2); + CookieMonster::kSafeFromGlobalPurgeDays * 2)); cm->SetExpiryAndKeyScheme(schemes[recent_scheme]); EXPECT_EQ(test_case->expected_initial_cookies, static_cast<int>(cm->GetAllCookies().size())) diff --git a/net/base/directory_lister_unittest.cc b/net/base/directory_lister_unittest.cc index f75d8d8..5607bc5 100644 --- a/net/base/directory_lister_unittest.cc +++ b/net/base/directory_lister_unittest.cc @@ -77,8 +77,8 @@ TEST(DirectoryListerTest, BigDirTest) { ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &path)); ListerDelegate delegate(false); - scoped_refptr<net::DirectoryLister> lister = - new net::DirectoryLister(path, &delegate); + scoped_refptr<net::DirectoryLister> lister( + new net::DirectoryLister(path, &delegate)); lister->Start(); @@ -92,11 +92,11 @@ TEST(DirectoryListerTest, BigDirRecursiveTest) { ASSERT_TRUE(PathService::Get(base::DIR_EXE, &path)); ListerDelegate delegate(true); - scoped_refptr<net::DirectoryLister> lister = + scoped_refptr<net::DirectoryLister> lister( new net::DirectoryLister(path, true, net::DirectoryLister::FULL_PATH, - &delegate); + &delegate)); lister->Start(); @@ -110,8 +110,8 @@ TEST(DirectoryListerTest, CancelTest) { ASSERT_TRUE(PathService::Get(base::DIR_SOURCE_ROOT, &path)); ListerDelegate delegate(false); - scoped_refptr<net::DirectoryLister> lister = - new net::DirectoryLister(path, &delegate); + scoped_refptr<net::DirectoryLister> lister( + new net::DirectoryLister(path, &delegate)); lister->Start(); lister->Cancel(); diff --git a/net/base/host_resolver_impl.cc b/net/base/host_resolver_impl.cc index 3805979..ea1788e 100644 --- a/net/base/host_resolver_impl.cc +++ b/net/base/host_resolver_impl.cc @@ -1371,7 +1371,7 @@ void HostResolverImpl::ProcessQueuedRequests() { if (!top_req) return; - scoped_refptr<Job> job = CreateAndStartJob(top_req); + scoped_refptr<Job> job(CreateAndStartJob(top_req)); // Search for any other pending request which can piggy-back off this job. for (size_t pool_i = 0; pool_i < POOL_COUNT; ++pool_i) { @@ -1401,8 +1401,8 @@ HostResolverImpl::Job* HostResolverImpl::CreateAndStartJob(Request* req) { req->request_net_log().AddEvent(NetLog::TYPE_HOST_RESOLVER_IMPL_CREATE_JOB, NULL); - scoped_refptr<Job> job = new Job(next_job_id_++, this, key, - req->request_net_log(), net_log_); + scoped_refptr<Job> job(new Job(next_job_id_++, this, key, + req->request_net_log(), net_log_)); job->AddRequest(req); AddOutstandingJob(job); job->Start(); diff --git a/net/base/host_resolver_impl_unittest.cc b/net/base/host_resolver_impl_unittest.cc index 07e00bf..f3bdb74 100644 --- a/net/base/host_resolver_impl_unittest.cc +++ b/net/base/host_resolver_impl_unittest.cc @@ -259,8 +259,8 @@ TEST_F(HostResolverImplTest, SynchronousLookup) { AddressList addrlist; const int kPortnum = 80; - scoped_refptr<RuleBasedHostResolverProc> resolver_proc = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> resolver_proc( + new RuleBasedHostResolverProc(NULL)); resolver_proc->AddRule("just.testing", "192.168.1.42"); scoped_ptr<HostResolver> host_resolver( @@ -291,8 +291,8 @@ TEST_F(HostResolverImplTest, AsynchronousLookup) { AddressList addrlist; const int kPortnum = 80; - scoped_refptr<RuleBasedHostResolverProc> resolver_proc = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> resolver_proc( + new RuleBasedHostResolverProc(NULL)); resolver_proc->AddRule("just.testing", "192.168.1.42"); scoped_ptr<HostResolver> host_resolver( @@ -328,8 +328,8 @@ TEST_F(HostResolverImplTest, AsynchronousLookup) { } TEST_F(HostResolverImplTest, CanceledAsynchronousLookup) { - scoped_refptr<WaitingHostResolverProc> resolver_proc = - new WaitingHostResolverProc(NULL); + scoped_refptr<WaitingHostResolverProc> resolver_proc( + new WaitingHostResolverProc(NULL)); CapturingNetLog net_log(CapturingNetLog::kUnbounded); CapturingBoundNetLog log(CapturingNetLog::kUnbounded); @@ -390,8 +390,8 @@ TEST_F(HostResolverImplTest, CanceledAsynchronousLookup) { TEST_F(HostResolverImplTest, NumericIPv4Address) { // Stevens says dotted quads with AI_UNSPEC resolve to a single sockaddr_in. - scoped_refptr<RuleBasedHostResolverProc> resolver_proc = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> resolver_proc( + new RuleBasedHostResolverProc(NULL)); resolver_proc->AllowDirectLookup("*"); scoped_ptr<HostResolver> host_resolver( @@ -413,8 +413,8 @@ TEST_F(HostResolverImplTest, NumericIPv4Address) { } TEST_F(HostResolverImplTest, NumericIPv6Address) { - scoped_refptr<RuleBasedHostResolverProc> resolver_proc = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> resolver_proc( + new RuleBasedHostResolverProc(NULL)); resolver_proc->AllowDirectLookup("*"); // Resolve a plain IPv6 address. Don't worry about [brackets], because @@ -445,8 +445,8 @@ TEST_F(HostResolverImplTest, NumericIPv6Address) { } TEST_F(HostResolverImplTest, EmptyHost) { - scoped_refptr<RuleBasedHostResolverProc> resolver_proc = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> resolver_proc( + new RuleBasedHostResolverProc(NULL)); resolver_proc->AllowDirectLookup("*"); scoped_ptr<HostResolver> host_resolver( @@ -459,8 +459,8 @@ TEST_F(HostResolverImplTest, EmptyHost) { } TEST_F(HostResolverImplTest, LongHost) { - scoped_refptr<RuleBasedHostResolverProc> resolver_proc = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> resolver_proc( + new RuleBasedHostResolverProc(NULL)); resolver_proc->AllowDirectLookup("*"); scoped_ptr<HostResolver> host_resolver( @@ -523,8 +523,8 @@ class DeDupeRequestsVerifier : public ResolveRequest::Delegate { TEST_F(HostResolverImplTest, DeDupeRequests) { // Use a capturing resolver_proc, since the verifier needs to know what calls // reached Resolve(). Also, the capturing resolver_proc is initially blocked. - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); scoped_ptr<HostResolver> host_resolver( CreateHostResolverImpl(resolver_proc)); @@ -574,8 +574,8 @@ TEST_F(HostResolverImplTest, CancelMultipleRequests) { // Use a capturing resolver_proc, since the verifier needs to know what calls // reached Resolver(). Also, the capturing resolver_proc is initially // blocked. - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); scoped_ptr<HostResolver> host_resolver( CreateHostResolverImpl(resolver_proc)); @@ -661,8 +661,8 @@ TEST_F(HostResolverImplTest, CancelWithinCallback) { // Use a capturing resolver_proc, since the verifier needs to know what calls // reached Resolver(). Also, the capturing resolver_proc is initially // blocked. - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); scoped_ptr<HostResolver> host_resolver( CreateHostResolverImpl(resolver_proc)); @@ -718,8 +718,8 @@ TEST_F(HostResolverImplTest, DeleteWithinCallback) { // Use a capturing resolver_proc, since the verifier needs to know what calls // reached Resolver(). Also, the capturing resolver_proc is initially // blocked. - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); // The class will receive callbacks for when each resolve completes. It // checks that the right things happened. Note that the verifier holds the @@ -773,8 +773,8 @@ TEST_F(HostResolverImplTest, StartWithinCallback) { // Use a capturing resolver_proc, since the verifier needs to know what calls // reached Resolver(). Also, the capturing resolver_proc is initially // blocked. - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); // Turn off caching for this host resolver. scoped_ptr<HostResolver> host_resolver( @@ -1105,8 +1105,8 @@ TEST_F(HostResolverImplTest, FlushCacheOnIPAddressChange) { // Test that IP address changes send ERR_ABORTED to pending requests. TEST_F(HostResolverImplTest, AbortOnIPAddressChanged) { - scoped_refptr<WaitingHostResolverProc> resolver_proc = - new WaitingHostResolverProc(NULL); + scoped_refptr<WaitingHostResolverProc> resolver_proc( + new WaitingHostResolverProc(NULL)); HostCache* cache = CreateDefaultCache(); scoped_ptr<HostResolver> host_resolver( new HostResolverImpl(resolver_proc, cache, kMaxJobs, NULL)); @@ -1130,8 +1130,8 @@ TEST_F(HostResolverImplTest, AbortOnIPAddressChanged) { // Obey pool constraints after IP address has changed. TEST_F(HostResolverImplTest, ObeyPoolConstraintsAfterIPAddressChange) { - scoped_refptr<WaitingHostResolverProc> resolver_proc = - new WaitingHostResolverProc(NULL); + scoped_refptr<WaitingHostResolverProc> resolver_proc( + new WaitingHostResolverProc(NULL)); scoped_ptr<MockHostResolver> host_resolver(new MockHostResolver()); host_resolver->Reset(resolver_proc); @@ -1202,8 +1202,8 @@ class ResolveWithinCallback : public CallbackRunner< Tuple1<int> > { }; TEST_F(HostResolverImplTest, OnlyAbortExistingRequestsOnIPAddressChange) { - scoped_refptr<WaitingHostResolverProc> resolver_proc = - new WaitingHostResolverProc(NULL); + scoped_refptr<WaitingHostResolverProc> resolver_proc( + new WaitingHostResolverProc(NULL)); scoped_ptr<MockHostResolver> host_resolver(new MockHostResolver()); host_resolver->Reset(resolver_proc); @@ -1227,8 +1227,8 @@ TEST_F(HostResolverImplTest, OnlyAbortExistingRequestsOnIPAddressChange) { // Tests that when the maximum threads is set to 1, requests are dequeued // in order of priority. TEST_F(HostResolverImplTest, HigherPriorityRequestsStartedFirst) { - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); // This HostResolverImpl will only allow 1 outstanding resolve at a time. size_t kMaxJobs = 1u; @@ -1312,8 +1312,8 @@ TEST_F(HostResolverImplTest, HigherPriorityRequestsStartedFirst) { // Try cancelling a request which has not been attached to a job yet. TEST_F(HostResolverImplTest, CancelPendingRequest) { - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); // This HostResolverImpl will only allow 1 outstanding resolve at a time. const size_t kMaxJobs = 1u; @@ -1375,8 +1375,8 @@ TEST_F(HostResolverImplTest, CancelPendingRequest) { // Test that when too many requests are enqueued, old ones start to be aborted. TEST_F(HostResolverImplTest, QueueOverflow) { - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(NULL); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(NULL)); // This HostResolverImpl will only allow 1 outstanding resolve at a time. const size_t kMaxOutstandingJobs = 1u; @@ -1453,8 +1453,8 @@ TEST_F(HostResolverImplTest, QueueOverflow) { // Tests that after changing the default AddressFamily to IPV4, requests // with UNSPECIFIED address family map to IPV4. TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv4) { - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(new EchoingHostResolverProc); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(new EchoingHostResolverProc)); // This HostResolverImpl will only allow 1 outstanding resolve at a time. const size_t kMaxOutstandingJobs = 1u; @@ -1521,8 +1521,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv4) { // of requests 0 and 1 is flipped, and the default is set to IPv6 in place of // IPv4. TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv6) { - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(new EchoingHostResolverProc); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(new EchoingHostResolverProc)); // This HostResolverImpl will only allow 1 outstanding resolve at a time. const size_t kMaxOutstandingJobs = 1u; @@ -1588,8 +1588,8 @@ TEST_F(HostResolverImplTest, SetDefaultAddressFamily_IPv6) { // This tests that the default address family is respected for synchronous // resolutions. TEST_F(HostResolverImplTest, SetDefaultAddressFamily_Synchronous) { - scoped_refptr<CapturingHostResolverProc> resolver_proc = - new CapturingHostResolverProc(new EchoingHostResolverProc); + scoped_refptr<CapturingHostResolverProc> resolver_proc( + new CapturingHostResolverProc(new EchoingHostResolverProc)); const size_t kMaxOutstandingJobs = 10u; scoped_ptr<HostResolverImpl> host_resolver(new HostResolverImpl( diff --git a/net/base/listen_socket.cc b/net/base/listen_socket.cc index 0cb529d..c964ec9 100644 --- a/net/base/listen_socket.cc +++ b/net/base/listen_socket.cc @@ -121,8 +121,8 @@ SOCKET ListenSocket::Accept(SOCKET s) { void ListenSocket::Accept() { SOCKET conn = Accept(socket_); if (conn != kInvalidSocket) { - scoped_refptr<ListenSocket> sock = - new ListenSocket(conn, socket_delegate_); + scoped_refptr<ListenSocket> sock( + new ListenSocket(conn, socket_delegate_)); // it's up to the delegate to AddRef if it wants to keep it around #if defined(OS_POSIX) sock->WatchSocket(WAITING_READ); diff --git a/net/base/mock_host_resolver.cc b/net/base/mock_host_resolver.cc index 9c82f93..9ee5c53 100644 --- a/net/base/mock_host_resolver.cc +++ b/net/base/mock_host_resolver.cc @@ -80,8 +80,8 @@ void MockHostResolverBase::Reset(HostResolverProc* interceptor) { synchronous_mode_ = false; // At the root of the chain, map everything to localhost. - scoped_refptr<RuleBasedHostResolverProc> catchall = - new RuleBasedHostResolverProc(NULL); + scoped_refptr<RuleBasedHostResolverProc> catchall( + new RuleBasedHostResolverProc(NULL)); catchall->AddRule("*", "127.0.0.1"); // Next add a rules-based layer the use controls. diff --git a/net/base/x509_certificate_mac.cc b/net/base/x509_certificate_mac.cc index 05fbe63..361e37c 100644 --- a/net/base/x509_certificate_mac.cc +++ b/net/base/x509_certificate_mac.cc @@ -872,10 +872,10 @@ bool X509Certificate::IsIssuedBy( for (int i = 0; i < n; ++i) { SecCertificateRef cert_handle = reinterpret_cast<SecCertificateRef>( const_cast<void*>(CFArrayGetValueAtIndex(cert_chain, i))); - scoped_refptr<X509Certificate> cert = X509Certificate::CreateFromHandle( + scoped_refptr<X509Certificate> cert(X509Certificate::CreateFromHandle( cert_handle, X509Certificate::SOURCE_LONE_CERT_IMPORT, - X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles())); for (unsigned j = 0; j < valid_issuers.size(); j++) { if (cert->issuer().Matches(valid_issuers[j])) return true; diff --git a/net/base/x509_certificate_unittest.cc b/net/base/x509_certificate_unittest.cc index 9bb81cb..31173e4 100644 --- a/net/base/x509_certificate_unittest.cc +++ b/net/base/x509_certificate_unittest.cc @@ -252,9 +252,9 @@ void CheckGoogleCert(const scoped_refptr<X509Certificate>& google_cert, } TEST(X509CertificateTest, GoogleCertParsing) { - scoped_refptr<X509Certificate> google_cert = + scoped_refptr<X509Certificate> google_cert( X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(google_der), sizeof(google_der)); + reinterpret_cast<const char*>(google_der), sizeof(google_der))); CheckGoogleCert(google_cert, google_fingerprint, 1238192407, // Mar 27 22:20:07 2009 GMT @@ -262,8 +262,8 @@ TEST(X509CertificateTest, GoogleCertParsing) { } TEST(X509CertificateTest, WebkitCertParsing) { - scoped_refptr<X509Certificate> webkit_cert = X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); + scoped_refptr<X509Certificate> webkit_cert(X509Certificate::CreateFromBytes( + reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der))); ASSERT_NE(static_cast<X509Certificate*>(NULL), webkit_cert); @@ -318,8 +318,8 @@ TEST(X509CertificateTest, WebkitCertParsing) { } TEST(X509CertificateTest, ThawteCertParsing) { - scoped_refptr<X509Certificate> thawte_cert = X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(thawte_der), sizeof(thawte_der)); + scoped_refptr<X509Certificate> thawte_cert(X509Certificate::CreateFromBytes( + reinterpret_cast<const char*>(thawte_der), sizeof(thawte_der))); ASSERT_NE(static_cast<X509Certificate*>(NULL), thawte_cert); @@ -379,10 +379,10 @@ TEST(X509CertificateTest, ThawteCertParsing) { } TEST(X509CertificateTest, PaypalNullCertParsing) { - scoped_refptr<X509Certificate> paypal_null_cert = + scoped_refptr<X509Certificate> paypal_null_cert( X509Certificate::CreateFromBytes( reinterpret_cast<const char*>(paypal_null_der), - sizeof(paypal_null_der)); + sizeof(paypal_null_der))); ASSERT_NE(static_cast<X509Certificate*>(NULL), paypal_null_cert); @@ -409,8 +409,8 @@ TEST(X509CertificateTest, PaypalNullCertParsing) { // This certificate will expire on 2011-09-08. TEST(X509CertificateTest, UnoSoftCertParsing) { FilePath certs_dir = GetTestCertsDirectory(); - scoped_refptr<X509Certificate> unosoft_hu_cert = - ImportCertFromFile(certs_dir, "unosoft_hu_cert.der"); + scoped_refptr<X509Certificate> unosoft_hu_cert( + ImportCertFromFile(certs_dir, "unosoft_hu_cert.der")); ASSERT_NE(static_cast<X509Certificate*>(NULL), unosoft_hu_cert); @@ -481,18 +481,18 @@ TEST(X509CertificateTest, Cache) { // certificate cache. google_cert_handle = X509Certificate::CreateOSCertHandleFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der)); - scoped_refptr<X509Certificate> cert1 = X509Certificate::CreateFromHandle( + scoped_refptr<X509Certificate> cert1(X509Certificate::CreateFromHandle( google_cert_handle, X509Certificate::SOURCE_LONE_CERT_IMPORT, - X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles())); X509Certificate::FreeOSCertHandle(google_cert_handle); // Add a certificate from the same source (SOURCE_LONE_CERT_IMPORT). This // should return the cached certificate (cert1). google_cert_handle = X509Certificate::CreateOSCertHandleFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der)); - scoped_refptr<X509Certificate> cert2 = X509Certificate::CreateFromHandle( + scoped_refptr<X509Certificate> cert2(X509Certificate::CreateFromHandle( google_cert_handle, X509Certificate::SOURCE_LONE_CERT_IMPORT, - X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles())); X509Certificate::FreeOSCertHandle(google_cert_handle); EXPECT_EQ(cert1, cert2); @@ -501,9 +501,9 @@ TEST(X509CertificateTest, Cache) { // cached certificate (cert1) and return a new certificate. google_cert_handle = X509Certificate::CreateOSCertHandleFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der)); - scoped_refptr<X509Certificate> cert3 = X509Certificate::CreateFromHandle( + scoped_refptr<X509Certificate> cert3(X509Certificate::CreateFromHandle( google_cert_handle, X509Certificate::SOURCE_FROM_NETWORK, - X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles())); X509Certificate::FreeOSCertHandle(google_cert_handle); EXPECT_NE(cert1, cert3); @@ -512,43 +512,43 @@ TEST(X509CertificateTest, Cache) { // certificate (cert3). google_cert_handle = X509Certificate::CreateOSCertHandleFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der)); - scoped_refptr<X509Certificate> cert4 = X509Certificate::CreateFromHandle( + scoped_refptr<X509Certificate> cert4(X509Certificate::CreateFromHandle( google_cert_handle, X509Certificate::SOURCE_FROM_NETWORK, - X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles())); X509Certificate::FreeOSCertHandle(google_cert_handle); EXPECT_EQ(cert3, cert4); google_cert_handle = X509Certificate::CreateOSCertHandleFromBytes( reinterpret_cast<const char*>(google_der), sizeof(google_der)); - scoped_refptr<X509Certificate> cert5 = X509Certificate::CreateFromHandle( + scoped_refptr<X509Certificate> cert5(X509Certificate::CreateFromHandle( google_cert_handle, X509Certificate::SOURCE_FROM_NETWORK, - X509Certificate::OSCertHandles()); + X509Certificate::OSCertHandles())); X509Certificate::FreeOSCertHandle(google_cert_handle); EXPECT_EQ(cert3, cert5); } TEST(X509CertificateTest, Pickle) { - scoped_refptr<X509Certificate> cert1 = X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(google_der), sizeof(google_der)); + scoped_refptr<X509Certificate> cert1(X509Certificate::CreateFromBytes( + reinterpret_cast<const char*>(google_der), sizeof(google_der))); Pickle pickle; cert1->Persist(&pickle); void* iter = NULL; - scoped_refptr<X509Certificate> cert2 = - X509Certificate::CreateFromPickle(pickle, &iter); + scoped_refptr<X509Certificate> cert2( + X509Certificate::CreateFromPickle(pickle, &iter)); EXPECT_EQ(cert1, cert2); } TEST(X509CertificateTest, Policy) { - scoped_refptr<X509Certificate> google_cert = X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(google_der), sizeof(google_der)); + scoped_refptr<X509Certificate> google_cert(X509Certificate::CreateFromBytes( + reinterpret_cast<const char*>(google_der), sizeof(google_der))); - scoped_refptr<X509Certificate> webkit_cert = X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); + scoped_refptr<X509Certificate> webkit_cert(X509Certificate::CreateFromBytes( + reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der))); CertPolicy policy; @@ -581,18 +581,18 @@ TEST(X509CertificateTest, Policy) { #if defined(OS_MACOSX) || defined(OS_WIN) TEST(X509CertificateTest, IntermediateCertificates) { - scoped_refptr<X509Certificate> webkit_cert = + scoped_refptr<X509Certificate> webkit_cert( X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der)); + reinterpret_cast<const char*>(webkit_der), sizeof(webkit_der))); - scoped_refptr<X509Certificate> thawte_cert = + scoped_refptr<X509Certificate> thawte_cert( X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(thawte_der), sizeof(thawte_der)); + reinterpret_cast<const char*>(thawte_der), sizeof(thawte_der))); - scoped_refptr<X509Certificate> paypal_cert = + scoped_refptr<X509Certificate> paypal_cert( X509Certificate::CreateFromBytes( reinterpret_cast<const char*>(paypal_null_der), - sizeof(paypal_null_der)); + sizeof(paypal_null_der))); X509Certificate::OSCertHandle google_handle; // Create object with no intermediates: @@ -645,8 +645,8 @@ TEST(X509CertificateTest, IsIssuedBy) { FilePath certs_dir = GetTestCertsDirectory(); // Test a client certificate from MIT. - scoped_refptr<X509Certificate> mit_davidben_cert = - ImportCertFromFile(certs_dir, "mit.davidben.der"); + scoped_refptr<X509Certificate> mit_davidben_cert( + ImportCertFromFile(certs_dir, "mit.davidben.der")); ASSERT_NE(static_cast<X509Certificate*>(NULL), mit_davidben_cert); CertPrincipal mit_issuer; @@ -662,8 +662,8 @@ TEST(X509CertificateTest, IsIssuedBy) { EXPECT_TRUE(mit_davidben_cert->IsIssuedBy(mit_issuers)); // Test a client certificate from FOAF.ME. - scoped_refptr<X509Certificate> foaf_me_chromium_test_cert = - ImportCertFromFile(certs_dir, "foaf.me.chromium-test-cert.der"); + scoped_refptr<X509Certificate> foaf_me_chromium_test_cert( + ImportCertFromFile(certs_dir, "foaf.me.chromium-test-cert.der")); ASSERT_NE(static_cast<X509Certificate*>(NULL), foaf_me_chromium_test_cert); CertPrincipal foaf_issuer; diff --git a/net/disk_cache/backend_impl.cc b/net/disk_cache/backend_impl.cc index 4765a44..2b17e48 100644 --- a/net/disk_cache/backend_impl.cc +++ b/net/disk_cache/backend_impl.cc @@ -174,13 +174,13 @@ bool SetFieldTrialInfo(int size_group) { // Field trials involve static objects so we have to do this only once. first = false; - scoped_refptr<base::FieldTrial> trial1 = - new base::FieldTrial("CacheSize", 10); + scoped_refptr<base::FieldTrial> trial1( + new base::FieldTrial("CacheSize", 10)); std::string group1 = base::StringPrintf("CacheSizeGroup_%d", size_group); trial1->AppendGroup(group1, base::FieldTrial::kAllRemainingProbability); - scoped_refptr<base::FieldTrial> trial2 = - new base::FieldTrial("CacheThrottle", 100); + scoped_refptr<base::FieldTrial> trial2( + new base::FieldTrial("CacheThrottle", 100)); int group2a = trial2->AppendGroup("CacheThrottle_On", 10); // 10 % in. trial2->AppendGroup("CacheThrottle_Off", 10); // 10 % control. diff --git a/net/disk_cache/backend_unittest.cc b/net/disk_cache/backend_unittest.cc index adfc95c..4298456 100644 --- a/net/disk_cache/backend_unittest.cc +++ b/net/disk_cache/backend_unittest.cc @@ -230,7 +230,7 @@ TEST_F(DiskCacheBackendTest, ExternalFiles) { FilePath filename = GetCacheFilePath().AppendASCII("f_000001"); const int kSize = 50; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer1->data(), kSize, false); ASSERT_EQ(kSize, file_util::WriteFile(filename, buffer1->data(), kSize)); @@ -241,7 +241,7 @@ TEST_F(DiskCacheBackendTest, ExternalFiles) { entry->Close(); // And verify that the first file is still there. - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize)); ASSERT_EQ(kSize, file_util::ReadFile(filename, buffer2->data(), kSize)); EXPECT_EQ(0, memcmp(buffer1->data(), buffer2->data(), kSize)); } @@ -269,7 +269,7 @@ TEST_F(DiskCacheTest, ShutdownWithPendingIO) { ASSERT_EQ(net::OK, cb.GetResult(rv)); const int kSize = 25000; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, false); for (int i = 0; i < 10 * 1024 * 1024; i += 64 * 1024) { @@ -319,7 +319,7 @@ TEST_F(DiskCacheTest, ShutdownWithPendingIO2) { ASSERT_EQ(net::OK, cb.GetResult(rv)); const int kSize = 25000; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, false); rv = entry->WriteData(0, 0, buffer, kSize, &cb, false); @@ -366,7 +366,7 @@ void DiskCacheBackendTest::BackendSetSize() { disk_cache::Entry* entry; ASSERT_EQ(net::OK, CreateEntry(first, &entry)); - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(cache_size); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(cache_size)); memset(buffer->data(), 0, cache_size); EXPECT_EQ(cache_size / 10, WriteData(entry, 0, 0, buffer, cache_size / 10, false)) << "normal file"; @@ -497,7 +497,7 @@ void DiskCacheBackendTest::BackendValidEntry() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 50; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); memset(buffer1->data(), 0, kSize); base::strlcpy(buffer1->data(), "And the data to save", kSize); EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer1, kSize, false)); @@ -506,7 +506,7 @@ void DiskCacheBackendTest::BackendValidEntry() { ASSERT_EQ(net::OK, OpenEntry(key, &entry)); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize)); memset(buffer2->data(), 0, kSize); EXPECT_EQ(kSize, ReadData(entry, 0, 0, buffer2, kSize)); entry->Close(); @@ -535,7 +535,7 @@ void DiskCacheBackendTest::BackendInvalidEntry() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 50; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); memset(buffer->data(), 0, kSize); base::strlcpy(buffer->data(), "And the data to save", kSize); EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false)); @@ -579,7 +579,7 @@ void DiskCacheBackendTest::BackendInvalidEntryRead() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 50; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); memset(buffer->data(), 0, kSize); base::strlcpy(buffer->data(), "And the data to save", kSize); EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false)); @@ -697,7 +697,7 @@ void DiskCacheBackendTest::BackendTrimInvalidEntry() { disk_cache::Entry* entry; ASSERT_EQ(net::OK, CreateEntry(first, &entry)); - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); memset(buffer->data(), 0, kSize); EXPECT_EQ(kSize, WriteData(entry, 0, 0, buffer, kSize, false)); @@ -748,7 +748,7 @@ void DiskCacheBackendTest::BackendTrimInvalidEntry2() { SetMaxSize(kSize * 40); InitCache(); - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); memset(buffer->data(), 0, kSize); disk_cache::Entry* entry; @@ -940,7 +940,7 @@ void DiskCacheBackendTest::BackendInvalidEntryEnumeration() { ASSERT_EQ(net::OK, CreateEntry(key, &entry1)); const int kSize = 50; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); memset(buffer1->data(), 0, kSize); base::strlcpy(buffer1->data(), "And the data to save", kSize); EXPECT_EQ(kSize, WriteData(entry1, 0, 0, buffer1, kSize, false)); @@ -1574,7 +1574,7 @@ void DiskCacheBackendTest::BackendDisable4() { ASSERT_EQ(net::OK, CreateEntry(key3, &entry3)); const int kBufSize = 20000; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kBufSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kBufSize)); memset(buf->data(), 0, kBufSize); EXPECT_EQ(100, WriteData(entry2, 0, 0, buf, 100, false)); EXPECT_EQ(kBufSize, WriteData(entry3, 0, 0, buf, kBufSize, false)); @@ -1840,7 +1840,7 @@ TEST_F(DiskCacheBackendTest, TotalBuffersSize1) { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 200; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, true); for (int i = 0; i < 10; i++) { diff --git a/net/disk_cache/disk_cache_perftest.cc b/net/disk_cache/disk_cache_perftest.cc index 1f1514d..c86955f 100644 --- a/net/disk_cache/disk_cache_perftest.cc +++ b/net/disk_cache/disk_cache_perftest.cc @@ -44,8 +44,8 @@ const int kMaxSize = 16 * 1024 - 1; int TimeWrite(int num_entries, disk_cache::Backend* cache, TestEntries* entries) { const int kSize1 = 200; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kMaxSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kMaxSize)); CacheTestFillBuffer(buffer1->data(), kSize1, false); CacheTestFillBuffer(buffer2->data(), kMaxSize, false); @@ -95,8 +95,8 @@ int TimeWrite(int num_entries, disk_cache::Backend* cache, int TimeRead(int num_entries, disk_cache::Backend* cache, const TestEntries& entries, bool cold) { const int kSize1 = 200; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kMaxSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kMaxSize)); CacheTestFillBuffer(buffer1->data(), kSize1, false); CacheTestFillBuffer(buffer2->data(), kMaxSize, false); diff --git a/net/disk_cache/entry_unittest.cc b/net/disk_cache/entry_unittest.cc index c4dc705f..41f9077 100644 --- a/net/disk_cache/entry_unittest.cc +++ b/net/disk_cache/entry_unittest.cc @@ -76,7 +76,7 @@ class InternalSyncIOTask : public SyncIOTask { // This part of the test runs on the background thread. void DiskCacheEntryTest::InternalSyncIOBackground(disk_cache::Entry* entry) { const int kSize1 = 10; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); CacheTestFillBuffer(buffer1->data(), kSize1, false); EXPECT_EQ(0, entry->ReadData(0, 0, buffer1, kSize1, NULL)); base::strlcpy(buffer1->data(), "the data", kSize1); @@ -87,8 +87,8 @@ void DiskCacheEntryTest::InternalSyncIOBackground(disk_cache::Entry* entry) { const int kSize2 = 5000; const int kSize3 = 10000; - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); - scoped_refptr<net::IOBuffer> buffer3 = new net::IOBuffer(kSize3); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); + scoped_refptr<net::IOBuffer> buffer3(new net::IOBuffer(kSize3)); memset(buffer3->data(), 0, kSize3); CacheTestFillBuffer(buffer2->data(), kSize2, false); base::strlcpy(buffer2->data(), "The really big data goes here", kSize2); @@ -179,9 +179,9 @@ void DiskCacheEntryTest::InternalAsyncIO() { const int kSize1 = 10; const int kSize2 = 5000; const int kSize3 = 10000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); - scoped_refptr<net::IOBuffer> buffer3 = new net::IOBuffer(kSize3); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); + scoped_refptr<net::IOBuffer> buffer3(new net::IOBuffer(kSize3)); CacheTestFillBuffer(buffer1->data(), kSize1, false); CacheTestFillBuffer(buffer2->data(), kSize2, false); CacheTestFillBuffer(buffer3->data(), kSize3, false); @@ -298,8 +298,8 @@ class ExternalSyncIOTask : public SyncIOTask { void DiskCacheEntryTest::ExternalSyncIOBackground(disk_cache::Entry* entry) { const int kSize1 = 17000; const int kSize2 = 25000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); CacheTestFillBuffer(buffer1->data(), kSize1, false); CacheTestFillBuffer(buffer2->data(), kSize2, false); base::strlcpy(buffer1->data(), "the data", kSize1); @@ -383,9 +383,9 @@ void DiskCacheEntryTest::ExternalAsyncIO() { const int kSize1 = 17000; const int kSize2 = 25000; const int kSize3 = 25000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); - scoped_refptr<net::IOBuffer> buffer3 = new net::IOBuffer(kSize3); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); + scoped_refptr<net::IOBuffer> buffer3(new net::IOBuffer(kSize3)); CacheTestFillBuffer(buffer1->data(), kSize1, false); CacheTestFillBuffer(buffer2->data(), kSize2, false); CacheTestFillBuffer(buffer3->data(), kSize3, false); @@ -481,8 +481,8 @@ void DiskCacheEntryTest::StreamAccess() { ASSERT_TRUE(NULL != entry); const int kBufferSize = 1024; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kBufferSize); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kBufferSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kBufferSize)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kBufferSize)); const int kNumStreams = 3; for (int i = 0; i < kNumStreams; i++) { @@ -579,7 +579,7 @@ void DiskCacheEntryTest::GetTimes() { Time t3 = Time::Now(); EXPECT_TRUE(t3 > t2); const int kSize = 200; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); EXPECT_EQ(kSize, ReadData(entry, 0, 0, buffer, kSize)); if (type_ == net::APP_CACHE) { EXPECT_TRUE(entry->GetLastUsed() < t2); @@ -614,8 +614,8 @@ void DiskCacheEntryTest::GrowData() { ASSERT_EQ(net::OK, CreateEntry(key1, &entry)); const int kSize = 20000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer1->data(), kSize, false); memset(buffer2->data(), 0, kSize); @@ -699,8 +699,8 @@ void DiskCacheEntryTest::TruncateData() { const int kSize1 = 20000; const int kSize2 = 20000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); CacheTestFillBuffer(buffer1->data(), kSize1, false); memset(buffer2->data(), 0, kSize2); @@ -801,7 +801,7 @@ void DiskCacheEntryTest::ZeroLengthIO() { // Lets verify the actual content. const int kSize = 20; const char zeros[kSize] = {}; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, false); EXPECT_EQ(kSize, ReadData(entry, 0, 500, buffer, kSize)); @@ -843,8 +843,8 @@ void DiskCacheEntryTest::Buffering() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 200; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer1->data(), kSize, true); CacheTestFillBuffer(buffer2->data(), kSize, true); @@ -924,8 +924,8 @@ void DiskCacheEntryTest::SizeChanges() { const int kSize = 200; const char zeros[kSize] = {}; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer1->data(), kSize, true); CacheTestFillBuffer(buffer2->data(), kSize, true); @@ -1013,7 +1013,7 @@ void DiskCacheEntryTest::ReuseEntry(int size) { std::string key2("the second key"); ASSERT_EQ(net::OK, CreateEntry(key2, &entry)); - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(size); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(size)); CacheTestFillBuffer(buffer->data(), size, false); for (int i = 0; i < 15; i++) { @@ -1067,9 +1067,9 @@ void DiskCacheEntryTest::InvalidData() { const int kSize1 = 20000; const int kSize2 = 20000; const int kSize3 = 20000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); - scoped_refptr<net::IOBuffer> buffer3 = new net::IOBuffer(kSize3); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); + scoped_refptr<net::IOBuffer> buffer3(new net::IOBuffer(kSize3)); CacheTestFillBuffer(buffer1->data(), kSize1, false); memset(buffer2->data(), 0, kSize2); @@ -1149,7 +1149,7 @@ TEST_F(DiskCacheEntryTest, ReadWriteDestroyBuffer) { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 200; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, false); TestCompletionCallback cb; @@ -1179,7 +1179,7 @@ void DiskCacheEntryTest::DoomNormalEntry() { entry->Close(); const int kSize = 20000; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); CacheTestFillBuffer(buffer->data(), kSize, true); buffer->data()[19999] = '\0'; @@ -1220,8 +1220,8 @@ void DiskCacheEntryTest::DoomedEntry() { const int kSize1 = 2000; const int kSize2 = 2000; - scoped_refptr<net::IOBuffer> buffer1 = new net::IOBuffer(kSize1); - scoped_refptr<net::IOBuffer> buffer2 = new net::IOBuffer(kSize2); + scoped_refptr<net::IOBuffer> buffer1(new net::IOBuffer(kSize1)); + scoped_refptr<net::IOBuffer> buffer2(new net::IOBuffer(kSize2)); CacheTestFillBuffer(buffer1->data(), kSize1, false); memset(buffer2->data(), 0, kSize2); @@ -1254,7 +1254,7 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyEnumerationWithSparseEntries) { InitCache(); const int kSize = 4096; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); std::string key("the first key"); @@ -1308,7 +1308,7 @@ void VerifyContentSparseIO(disk_cache::Entry* entry, int64 offset, char* buffer, int size) { TestCompletionCallback cb; - scoped_refptr<net::IOBuffer> buf_1 = new net::IOBuffer(size); + scoped_refptr<net::IOBuffer> buf_1(new net::IOBuffer(size)); memset(buf_1->data(), 0, size); int ret = entry->ReadSparseData(offset, buf_1, size, &cb); EXPECT_EQ(size, cb.GetResult(ret)); @@ -1322,8 +1322,8 @@ void DiskCacheEntryTest::BasicSparseIO() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 2048; - scoped_refptr<net::IOBuffer> buf_1 = new net::IOBuffer(kSize); - scoped_refptr<net::IOBuffer> buf_2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf_1(new net::IOBuffer(kSize)); + scoped_refptr<net::IOBuffer> buf_2(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf_1->data(), kSize, false); // Write at offset 0. @@ -1363,8 +1363,8 @@ void DiskCacheEntryTest::HugeSparseIO() { // Write 1.2 MB so that we cover multiple entries. const int kSize = 1200 * 1024; - scoped_refptr<net::IOBuffer> buf_1 = new net::IOBuffer(kSize); - scoped_refptr<net::IOBuffer> buf_2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf_1(new net::IOBuffer(kSize)); + scoped_refptr<net::IOBuffer> buf_2(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf_1->data(), kSize, false); // Write at offset 0x20F0000 (33 MB - 64 KB). @@ -1394,7 +1394,7 @@ void DiskCacheEntryTest::GetAvailableRange() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 16 * 1024; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); // Write at offset 0x20F0000 (33 MB - 64 KB), and 0x20F4400 (33 MB - 47 KB). @@ -1456,7 +1456,7 @@ void DiskCacheEntryTest::CouldBeSparse() { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 16 * 1024; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); // Write at offset 0x20F0000 (33 MB - 64 KB). @@ -1502,8 +1502,8 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyMisalignedSparseIO) { InitCache(); const int kSize = 8192; - scoped_refptr<net::IOBuffer> buf_1 = new net::IOBuffer(kSize); - scoped_refptr<net::IOBuffer> buf_2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf_1(new net::IOBuffer(kSize)); + scoped_refptr<net::IOBuffer> buf_2(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf_1->data(), kSize, false); std::string key("the first key"); @@ -1512,8 +1512,8 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyMisalignedSparseIO) { // This loop writes back to back starting from offset 0 and 9000. for (int i = 0; i < kSize; i += 1024) { - scoped_refptr<net::WrappedIOBuffer> buf_3 = - new net::WrappedIOBuffer(buf_1->data() + i); + scoped_refptr<net::WrappedIOBuffer> buf_3( + new net::WrappedIOBuffer(buf_1->data() + i)); VerifySparseIO(entry, i, buf_3, 1024, buf_2); VerifySparseIO(entry, 9000 + i, buf_3, 1024, buf_2); } @@ -1533,7 +1533,7 @@ TEST_F(DiskCacheEntryTest, MemoryOnlyMisalignedGetAvailableRange) { InitCache(); const int kSize = 8192; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); disk_cache::Entry* entry; @@ -1594,7 +1594,7 @@ void DiskCacheEntryTest::DoomSparseEntry() { ASSERT_EQ(net::OK, CreateEntry(key2, &entry2)); const int kSize = 4 * 1024; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); int64 offset = 1024; @@ -1681,7 +1681,7 @@ TEST_F(DiskCacheEntryTest, DoomSparseEntry2) { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 4 * 1024; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); int64 offset = 1024; @@ -1711,7 +1711,7 @@ void DiskCacheEntryTest::PartialSparseEntry() { // of a sparse entry, at least to write a big range without leaving holes. const int kSize = 4 * 1024; const int kSmallSize = 128; - scoped_refptr<net::IOBuffer> buf1 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf1(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf1->data(), kSize, false); // The first write is just to extend the entry. The third write occupies @@ -1723,7 +1723,7 @@ void DiskCacheEntryTest::PartialSparseEntry() { entry->Close(); ASSERT_EQ(net::OK, OpenEntry(key, &entry)); - scoped_refptr<net::IOBuffer> buf2 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf2(new net::IOBuffer(kSize)); memset(buf2->data(), 0, kSize); EXPECT_EQ(0, ReadSparseData(entry, 8000, buf2, kSize)); @@ -1805,7 +1805,7 @@ TEST_F(DiskCacheEntryTest, CleanupSparseEntry) { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 4 * 1024; - scoped_refptr<net::IOBuffer> buf1 = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf1(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf1->data(), kSize, false); const int k1Meg = 1024 * 1024; @@ -1856,7 +1856,7 @@ TEST_F(DiskCacheEntryTest, CancelSparseIO) { ASSERT_EQ(net::OK, CreateEntry(key, &entry)); const int kSize = 40 * 1024; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); CacheTestFillBuffer(buf->data(), kSize, false); // This will open and write two "real" entries. diff --git a/net/disk_cache/file_posix.cc b/net/disk_cache/file_posix.cc index 9d810c7..bade848 100644 --- a/net/disk_cache/file_posix.cc +++ b/net/disk_cache/file_posix.cc @@ -182,8 +182,8 @@ void BackgroundIO::OnIOSignalled() { void InFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len, size_t offset, disk_cache::FileIOCallback *callback) { - scoped_refptr<BackgroundIO> operation = - new BackgroundIO(file, buf, buf_len, offset, callback, this); + scoped_refptr<BackgroundIO> operation( + new BackgroundIO(file, buf, buf_len, offset, callback, this)); io_list_.insert(operation.get()); file->AddRef(); // Balanced on InvokeCallback() @@ -198,8 +198,8 @@ void InFlightIO::PostRead(disk_cache::File *file, void* buf, size_t buf_len, void InFlightIO::PostWrite(disk_cache::File* file, const void* buf, size_t buf_len, size_t offset, disk_cache::FileIOCallback* callback) { - scoped_refptr<BackgroundIO> operation = - new BackgroundIO(file, buf, buf_len, offset, callback, this); + scoped_refptr<BackgroundIO> operation( + new BackgroundIO(file, buf, buf_len, offset, callback, this)); io_list_.insert(operation.get()); file->AddRef(); // Balanced on InvokeCallback() diff --git a/net/disk_cache/in_flight_backend_io.cc b/net/disk_cache/in_flight_backend_io.cc index fe53829..8fafa4d 100644 --- a/net/disk_cache/in_flight_backend_io.cc +++ b/net/disk_cache/in_flight_backend_io.cc @@ -291,34 +291,34 @@ InFlightBackendIO::~InFlightBackendIO() { } void InFlightBackendIO::Init(CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->Init(); QueueOperation(operation); } void InFlightBackendIO::OpenEntry(const std::string& key, Entry** entry, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenEntry(key, entry); QueueOperation(operation); } void InFlightBackendIO::CreateEntry(const std::string& key, Entry** entry, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->CreateEntry(key, entry); QueueOperation(operation); } void InFlightBackendIO::DoomEntry(const std::string& key, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntry(key); QueueOperation(operation); } void InFlightBackendIO::DoomAllEntries(CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomAllEntries(); QueueOperation(operation); } @@ -326,58 +326,58 @@ void InFlightBackendIO::DoomAllEntries(CompletionCallback* callback) { void InFlightBackendIO::DoomEntriesBetween(const base::Time initial_time, const base::Time end_time, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntriesBetween(initial_time, end_time); QueueOperation(operation); } void InFlightBackendIO::DoomEntriesSince(const base::Time initial_time, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->DoomEntriesSince(initial_time); QueueOperation(operation); } void InFlightBackendIO::OpenNextEntry(void** iter, Entry** next_entry, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenNextEntry(iter, next_entry); QueueOperation(operation); } void InFlightBackendIO::OpenPrevEntry(void** iter, Entry** prev_entry, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->OpenPrevEntry(iter, prev_entry); QueueOperation(operation); } void InFlightBackendIO::EndEnumeration(void* iterator) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL)); operation->EndEnumeration(iterator); QueueOperation(operation); } void InFlightBackendIO::CloseEntryImpl(EntryImpl* entry) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL)); operation->CloseEntryImpl(entry); QueueOperation(operation); } void InFlightBackendIO::DoomEntryImpl(EntryImpl* entry) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL)); operation->DoomEntryImpl(entry); QueueOperation(operation); } void InFlightBackendIO::FlushQueue(net::CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->FlushQueue(); QueueOperation(operation); } void InFlightBackendIO::RunTask(Task* task, net::CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->RunTask(task); QueueOperation(operation); } @@ -385,7 +385,7 @@ void InFlightBackendIO::RunTask(Task* task, net::CompletionCallback* callback) { void InFlightBackendIO::ReadData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, int buf_len, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->ReadData(entry, index, offset, buf, buf_len); QueueOperation(operation); } @@ -394,7 +394,7 @@ void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset, net::IOBuffer* buf, int buf_len, bool truncate, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->WriteData(entry, index, offset, buf, buf_len, truncate); QueueOperation(operation); } @@ -402,7 +402,7 @@ void InFlightBackendIO::WriteData(EntryImpl* entry, int index, int offset, void InFlightBackendIO::ReadSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, int buf_len, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->ReadSparseData(entry, offset, buf, buf_len); QueueOperation(operation); } @@ -410,7 +410,7 @@ void InFlightBackendIO::ReadSparseData(EntryImpl* entry, int64 offset, void InFlightBackendIO::WriteSparseData(EntryImpl* entry, int64 offset, net::IOBuffer* buf, int buf_len, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->WriteSparseData(entry, offset, buf, buf_len); QueueOperation(operation); } @@ -418,20 +418,20 @@ void InFlightBackendIO::WriteSparseData(EntryImpl* entry, int64 offset, void InFlightBackendIO::GetAvailableRange(EntryImpl* entry, int64 offset, int len, int64* start, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->GetAvailableRange(entry, offset, len, start); QueueOperation(operation); } void InFlightBackendIO::CancelSparseIO(EntryImpl* entry) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, NULL); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, NULL)); operation->CancelSparseIO(entry); QueueOperation(operation); } void InFlightBackendIO::ReadyForSparseIO(EntryImpl* entry, CompletionCallback* callback) { - scoped_refptr<BackendIO> operation = new BackendIO(this, backend_, callback); + scoped_refptr<BackendIO> operation(new BackendIO(this, backend_, callback)); operation->ReadyForSparseIO(entry); QueueOperation(operation); } diff --git a/net/disk_cache/mem_entry_impl.cc b/net/disk_cache/mem_entry_impl.cc index 8d8bb4c..a9e599c 100644 --- a/net/disk_cache/mem_entry_impl.cc +++ b/net/disk_cache/mem_entry_impl.cc @@ -172,8 +172,8 @@ int MemEntryImpl::ReadSparseData(int64 offset, net::IOBuffer* buf, int buf_len, return net::ERR_INVALID_ARGUMENT; // We will keep using this buffer and adjust the offset in this buffer. - scoped_refptr<net::DrainableIOBuffer> io_buf = - new net::DrainableIOBuffer(buf, buf_len); + scoped_refptr<net::DrainableIOBuffer> io_buf( + new net::DrainableIOBuffer(buf, buf_len)); // Iterate until we have read enough. while (io_buf->BytesRemaining()) { @@ -218,8 +218,8 @@ int MemEntryImpl::WriteSparseData(int64 offset, net::IOBuffer* buf, int buf_len, if (offset < 0 || buf_len < 0) return net::ERR_INVALID_ARGUMENT; - scoped_refptr<net::DrainableIOBuffer> io_buf = - new net::DrainableIOBuffer(buf, buf_len); + scoped_refptr<net::DrainableIOBuffer> io_buf( + new net::DrainableIOBuffer(buf, buf_len)); // This loop walks through child entries continuously starting from |offset| // and writes blocks of data (of maximum size kMaxSparseEntrySize) into each diff --git a/net/disk_cache/sparse_control.cc b/net/disk_cache/sparse_control.cc index e94a1bc..32f44ab 100644 --- a/net/disk_cache/sparse_control.cc +++ b/net/disk_cache/sparse_control.cc @@ -319,8 +319,8 @@ int SparseControl::CreateSparseEntry() { children_map_.Resize(kNumSparseBits, true); // Save the header. The bitmap is saved in the destructor. - scoped_refptr<net::IOBuffer> buf = - new net::WrappedIOBuffer(reinterpret_cast<char*>(&sparse_header_)); + scoped_refptr<net::IOBuffer> buf( + new net::WrappedIOBuffer(reinterpret_cast<char*>(&sparse_header_))); int rv = entry_->WriteData(kSparseIndex, 0, buf, sizeof(sparse_header_), NULL, false); @@ -349,8 +349,8 @@ int SparseControl::OpenSparseEntry(int data_len) { if (map_len > kMaxMapSize || map_len % 4) return net::ERR_CACHE_OPERATION_NOT_SUPPORTED; - scoped_refptr<net::IOBuffer> buf = - new net::WrappedIOBuffer(reinterpret_cast<char*>(&sparse_header_)); + scoped_refptr<net::IOBuffer> buf( + new net::WrappedIOBuffer(reinterpret_cast<char*>(&sparse_header_))); // Read header. int rv = entry_->ReadData(kSparseIndex, 0, buf, sizeof(sparse_header_), NULL); @@ -402,8 +402,8 @@ bool SparseControl::OpenChild() { static_cast<int>(sizeof(child_data_))) return KillChildAndContinue(key, false); - scoped_refptr<net::WrappedIOBuffer> buf = - new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)); + scoped_refptr<net::WrappedIOBuffer> buf( + new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_))); // Read signature. int rv = child_->ReadData(kSparseIndex, 0, buf, sizeof(child_data_), NULL); @@ -425,8 +425,8 @@ bool SparseControl::OpenChild() { } void SparseControl::CloseChild() { - scoped_refptr<net::WrappedIOBuffer> buf = - new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)); + scoped_refptr<net::WrappedIOBuffer> buf( + new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_))); // Save the allocation bitmap before closing the child entry. int rv = child_->WriteData(kSparseIndex, 0, buf, sizeof(child_data_), @@ -492,8 +492,8 @@ void SparseControl::SetChildBit(bool value) { } void SparseControl::WriteSparseData() { - scoped_refptr<net::IOBuffer> buf = new net::WrappedIOBuffer( - reinterpret_cast<const char*>(children_map_.GetMap())); + scoped_refptr<net::IOBuffer> buf(new net::WrappedIOBuffer( + reinterpret_cast<const char*>(children_map_.GetMap()))); int len = children_map_.ArraySize() * 4; int rv = entry_->WriteData(kSparseIndex, sizeof(sparse_header_), buf, len, @@ -597,8 +597,8 @@ void SparseControl::InitChildData() { memset(&child_data_, 0, sizeof(child_data_)); child_data_.header = sparse_header_; - scoped_refptr<net::WrappedIOBuffer> buf = - new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_)); + scoped_refptr<net::WrappedIOBuffer> buf( + new net::WrappedIOBuffer(reinterpret_cast<char*>(&child_data_))); int rv = child_->WriteData(kSparseIndex, 0, buf, sizeof(child_data_), NULL, false); diff --git a/net/disk_cache/stats_histogram.cc b/net/disk_cache/stats_histogram.cc index 06ed1b3..bc3f5d3 100644 --- a/net/disk_cache/stats_histogram.cc +++ b/net/disk_cache/stats_histogram.cc @@ -42,7 +42,7 @@ scoped_refptr<StatsHistogram> StatsHistogram::StatsHistogramFactoryGet( Histogram* temp_histogram = histogram.get(); StatsHistogram* temp_stats_histogram = static_cast<StatsHistogram*>(temp_histogram); - scoped_refptr<StatsHistogram> return_histogram = temp_stats_histogram; + scoped_refptr<StatsHistogram> return_histogram(temp_stats_histogram); return return_histogram; } diff --git a/net/disk_cache/stress_cache.cc b/net/disk_cache/stress_cache.cc index dcde1e1..ae2f981 100644 --- a/net/disk_cache/stress_cache.cc +++ b/net/disk_cache/stress_cache.cc @@ -130,7 +130,7 @@ void StressTheCache(int iteration) { } const int kSize = 4000; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(kSize)); memset(buffer->data(), 'k', kSize); for (int i = 0;; i++) { diff --git a/net/http/http_cache_transaction.cc b/net/http/http_cache_transaction.cc index 58288f4..873ccf4 100644 --- a/net/http/http_cache_transaction.cc +++ b/net/http/http_cache_transaction.cc @@ -1801,7 +1801,7 @@ int HttpCache::Transaction::WriteResponseInfoToEntry(bool truncated) { DCHECK_EQ(200, response_.headers->response_code()); } - scoped_refptr<PickledIOBuffer> data = new PickledIOBuffer(); + scoped_refptr<PickledIOBuffer> data(new PickledIOBuffer()); response_.Persist(data->pickle(), skip_transient_headers, truncated); data->Done(); diff --git a/net/http/http_cache_unittest.cc b/net/http/http_cache_unittest.cc index eec8098..f71cec9 100644 --- a/net/http/http_cache_unittest.cc +++ b/net/http/http_cache_unittest.cc @@ -573,7 +573,7 @@ class MockHttpCache { int size = disk_entry->GetDataSize(0); TestCompletionCallback cb; - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(size); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(size)); int rv = disk_entry->ReadData(0, 0, buffer, size, &cb); rv = cb.GetResult(rv); EXPECT_EQ(size, rv); @@ -593,8 +593,8 @@ class MockHttpCache { &pickle, skip_transient_headers, response_truncated); TestCompletionCallback cb; - scoped_refptr<net::WrappedIOBuffer> data = new net::WrappedIOBuffer( - reinterpret_cast<const char*>(pickle.data())); + scoped_refptr<net::WrappedIOBuffer> data(new net::WrappedIOBuffer( + reinterpret_cast<const char*>(pickle.data()))); int len = static_cast<int>(pickle.size()); int rv = disk_entry->WriteData(0, 0, data, len, &cb, true); @@ -951,8 +951,8 @@ const MockTransaction kRangeGET_TransactionOK = { void Verify206Response(std::string response, int start, int end) { std::string raw_headers(net::HttpUtil::AssembleRawHeaders(response.data(), response.size())); - scoped_refptr<net::HttpResponseHeaders> headers = - new net::HttpResponseHeaders(raw_headers); + scoped_refptr<net::HttpResponseHeaders> headers( + new net::HttpResponseHeaders(raw_headers)); ASSERT_EQ(206, headers->response_code()); @@ -1854,7 +1854,7 @@ TEST(HttpCache, SimpleGET_AbandonedCacheRead) { rv = callback.WaitForResult(); ASSERT_EQ(net::OK, rv); - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(256); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256)); rv = trans->Read(buf, 256, &callback); EXPECT_EQ(net::ERR_IO_PENDING, rv); @@ -3544,7 +3544,7 @@ TEST(HttpCache, RangeGET_Cancel) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure that the entry has some data stored. - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(10); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10)); rv = c->trans->Read(buf, buf->size(), &c->callback); if (rv == net::ERR_IO_PENDING) rv = c->callback.WaitForResult(); @@ -3585,7 +3585,7 @@ TEST(HttpCache, RangeGET_Cancel2) { // Make sure that we revalidate the entry and read from the cache (a single // read will return while waiting for the network). - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(5); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(5)); rv = c->trans->Read(buf, buf->size(), &c->callback); EXPECT_EQ(5, c->callback.GetResult(rv)); rv = c->trans->Read(buf, buf->size(), &c->callback); @@ -3631,7 +3631,7 @@ TEST(HttpCache, RangeGET_Cancel3) { // Make sure that we revalidate the entry and read from the cache (a single // read will return while waiting for the network). - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(5); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(5)); rv = c->trans->Read(buf, buf->size(), &c->callback); EXPECT_EQ(5, c->callback.GetResult(rv)); rv = c->trans->Read(buf, buf->size(), &c->callback); @@ -4029,7 +4029,7 @@ TEST(HttpCache, DoomOnDestruction2) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure that the entry has some data stored. - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(10); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10)); rv = c->trans->Read(buf, buf->size(), &c->callback); if (rv == net::ERR_IO_PENDING) rv = c->callback.WaitForResult(); @@ -4073,7 +4073,7 @@ TEST(HttpCache, DoomOnDestruction3) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure that the entry has some data stored. - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(10); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10)); rv = c->trans->Read(buf, buf->size(), &c->callback); if (rv == net::ERR_IO_PENDING) rv = c->callback.WaitForResult(); @@ -4117,7 +4117,7 @@ TEST(HttpCache, Set_Truncated_Flag) { EXPECT_EQ(1, cache.disk_cache()->create_count()); // Make sure that the entry has some data stored. - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(10); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(10)); rv = c->trans->Read(buf, buf->size(), &c->callback); if (rv == net::ERR_IO_PENDING) rv = c->callback.WaitForResult(); diff --git a/net/http/http_network_transaction.cc b/net/http/http_network_transaction.cc index 43eae30..16d9171 100644 --- a/net/http/http_network_transaction.cc +++ b/net/http/http_network_transaction.cc @@ -285,7 +285,7 @@ int HttpNetworkTransaction::Read(IOBuffer* buf, int buf_len, State next_state = STATE_NONE; - scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); + scoped_refptr<HttpResponseHeaders> headers(GetResponseHeaders()); if (headers_valid_ && headers.get() && stream_request_.get()) { // We're trying to read the body of the response but we're still trying // to establish an SSL tunnel through the proxy. We can't read these @@ -1078,7 +1078,7 @@ bool HttpNetworkTransaction::ShouldApplyServerAuth() const { } int HttpNetworkTransaction::HandleAuthChallenge() { - scoped_refptr<HttpResponseHeaders> headers = GetResponseHeaders(); + scoped_refptr<HttpResponseHeaders> headers(GetResponseHeaders()); DCHECK(headers); int status = headers->response_code(); diff --git a/net/http/http_network_transaction_unittest.cc b/net/http/http_network_transaction_unittest.cc index 1510186..0ba698c 100644 --- a/net/http/http_network_transaction_unittest.cc +++ b/net/http/http_network_transaction_unittest.cc @@ -605,7 +605,7 @@ TEST_F(HttpNetworkTransactionTest, Head) { TEST_F(HttpNetworkTransactionTest, ReuseConnection) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); MockRead data_reads[] = { MockRead("HTTP/1.1 200 OK\r\nContent-Length: 5\r\n\r\n"), @@ -794,7 +794,7 @@ TEST_F(HttpNetworkTransactionTest, EmptyResponse) { void HttpNetworkTransactionTest::KeepAliveConnectionResendRequestTest( const MockRead& read_failure) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); HttpRequestInfo request; request.method = "GET"; @@ -911,7 +911,7 @@ TEST_F(HttpNetworkTransactionTest, NonKeepAliveConnectionEOF) { // reading the body. TEST_F(HttpNetworkTransactionTest, KeepAliveAfterUnreadBody) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); HttpRequestInfo request; request.method = "GET"; @@ -3250,7 +3250,7 @@ TEST_F(HttpNetworkTransactionTest, ResendRequestOnWriteBodyError) { request[1].load_flags = 0; SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); // The first socket is used for transaction 1 and the first attempt of // transaction 2. @@ -3518,7 +3518,7 @@ TEST_F(HttpNetworkTransactionTest, WrongAuthIdentityInURL) { // Test that previously tried username/passwords for a realm get re-used. TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); // Transaction 1: authenticate (foo, bar) on MyRealm1 { @@ -3911,7 +3911,7 @@ TEST_F(HttpNetworkTransactionTest, BasicAuthCacheAndPreauth) { // are started with the same nonce. TEST_F(HttpNetworkTransactionTest, DigestPreAuthNonceCount) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); HttpAuthHandlerDigest::SetFixedCnonce(true); // Transaction 1: authenticate (foo, bar) on MyRealm1 @@ -4065,7 +4065,7 @@ TEST_F(HttpNetworkTransactionTest, ResetStateForRestart) { HttpRequestInfo request; std::string temp("HTTP/1.1 200 OK\nVary: foo, bar\n\n"); std::replace(temp.begin(), temp.end(), '\n', '\0'); - scoped_refptr<HttpResponseHeaders> headers = new HttpResponseHeaders(temp); + scoped_refptr<HttpResponseHeaders> headers(new HttpResponseHeaders(temp)); request.extra_headers.SetHeader("Foo", "1"); request.extra_headers.SetHeader("bar", "23"); EXPECT_TRUE(response->vary_data.Init(request, *headers)); @@ -5378,7 +5378,7 @@ TEST_F(HttpNetworkTransactionTest, BypassHostCacheOnRefresh3) { // Make sure we can handle an error when writing the request. TEST_F(HttpNetworkTransactionTest, RequestWriteError) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); HttpRequestInfo request; request.method = "GET"; @@ -5407,7 +5407,7 @@ TEST_F(HttpNetworkTransactionTest, RequestWriteError) { // Check that a connection closed after the start of the headers finishes ok. TEST_F(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); HttpRequestInfo request; request.method = "GET"; @@ -5449,7 +5449,7 @@ TEST_F(HttpNetworkTransactionTest, ConnectionClosedAfterStartOfHeaders) { // restart does the right thing. TEST_F(HttpNetworkTransactionTest, DrainResetOK) { SessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); HttpRequestInfo request; request.method = "GET"; @@ -6473,8 +6473,8 @@ TEST_F(HttpNetworkTransactionTest, scoped_refptr<SpdySession> spdy_session = session->spdy_session_pool()->Get(pair, session->mutable_spdy_settings(), BoundNetLog()); - scoped_refptr<TCPSocketParams> tcp_params = - new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false); + scoped_refptr<TCPSocketParams> tcp_params( + new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false)); scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); EXPECT_EQ(ERR_IO_PENDING, @@ -6948,7 +6948,7 @@ TEST_F(HttpNetworkTransactionTest, MultiRoundAuth) { origin, BoundNetLog()); auth_factory->set_mock_handler(auth_handler, HttpAuth::AUTH_SERVER); - scoped_refptr<HttpNetworkSession> session = CreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session(CreateSession(&session_deps)); scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); int rv = OK; @@ -7649,8 +7649,8 @@ TEST_F(HttpNetworkTransactionTest, PreconnectWithExistingSpdySession) { scoped_refptr<SpdySession> spdy_session = session->spdy_session_pool()->Get(pair, session->mutable_spdy_settings(), BoundNetLog()); - scoped_refptr<TCPSocketParams> tcp_params = - new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false); + scoped_refptr<TCPSocketParams> tcp_params( + new TCPSocketParams("www.google.com", 443, MEDIUM, GURL(), false)); TestCompletionCallback callback; scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); diff --git a/net/http/http_response_headers_unittest.cc b/net/http/http_response_headers_unittest.cc index 18cd1c4..6986723 100644 --- a/net/http/http_response_headers_unittest.cc +++ b/net/http/http_response_headers_unittest.cc @@ -51,8 +51,8 @@ void TestCommon(const TestData& test) { string expected_headers(test.expected_headers); string headers; - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(raw_headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(raw_headers)); parsed->GetNormalizedHeaders(&headers); // Transform to readable output format (so it's easier to see diffs). @@ -281,7 +281,7 @@ TEST(HttpResponseHeadersTest, GetNormalizedHeader) { "Cache-control: private\n" "cache-Control: no-store\n"; HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); std::string value; EXPECT_TRUE(parsed->GetNormalizedHeader("cache-control", &value)); @@ -448,15 +448,15 @@ TEST(HttpResponseHeadersTest, Persist) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { std::string headers = tests[i].raw_headers; HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed1 = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed1( + new HttpResponseHeaders(headers)); Pickle pickle; parsed1->Persist(&pickle, tests[i].options); void* iter = NULL; - scoped_refptr<HttpResponseHeaders> parsed2 = - new HttpResponseHeaders(pickle, &iter); + scoped_refptr<HttpResponseHeaders> parsed2( + new HttpResponseHeaders(pickle, &iter)); std::string h2; parsed2->GetNormalizedHeaders(&h2); @@ -472,7 +472,7 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_Coalesced) { "Cache-control:private , no-cache=\"set-cookie,server\" \n" "cache-Control: no-store\n"; HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); void* iter = NULL; std::string value; @@ -493,7 +493,7 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_Challenge) { "WWW-Authenticate:Digest realm=foobar, nonce=x, domain=y\n" "WWW-Authenticate:Basic realm=quatar\n"; HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); void* iter = NULL; std::string value; @@ -512,7 +512,7 @@ TEST(HttpResponseHeadersTest, EnumerateHeader_DateValued) { "Date: Tue, 07 Aug 2007 23:10:55 GMT\n" "Last-Modified: Wed, 01 Aug 2007 23:23:45 GMT\n"; HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); std::string value; EXPECT_TRUE(parsed->EnumerateHeader(NULL, "date", &value)); @@ -656,8 +656,8 @@ TEST(HttpResponseHeadersTest, GetMimeType) { for (size_t i = 0; i < arraysize(tests); ++i) { string headers(tests[i].raw_headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); std::string value; EXPECT_EQ(tests[i].has_mimetype, parsed->GetMimeType(&value)); @@ -807,8 +807,8 @@ TEST(HttpResponseHeadersTest, RequiresValidation) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); bool requires_validation = parsed->RequiresValidation(request_time, response_time, current_time); @@ -871,13 +871,13 @@ TEST(HttpResponseHeadersTest, Update) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string orig_headers(tests[i].orig_headers); HeadersToRaw(&orig_headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(orig_headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(orig_headers)); string new_headers(tests[i].new_headers); HeadersToRaw(&new_headers); - scoped_refptr<HttpResponseHeaders> new_parsed = - new HttpResponseHeaders(new_headers); + scoped_refptr<HttpResponseHeaders> new_parsed( + new HttpResponseHeaders(new_headers)); parsed->Update(*new_parsed); @@ -917,8 +917,8 @@ TEST(HttpResponseHeadersTest, EnumerateHeaderLines) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); string name, value, lines; @@ -1001,8 +1001,8 @@ TEST(HttpResponseHeadersTest, IsRedirect) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); std::string location; EXPECT_EQ(parsed->IsRedirect(&location), tests[i].is_redirect); @@ -1087,8 +1087,8 @@ TEST(HttpResponseHeadersTest, GetContentLength) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); EXPECT_EQ(tests[i].expected_len, parsed->GetContentLength()); } @@ -1338,8 +1338,8 @@ TEST(HttpResponseHeaders, GetContentRange) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); int64 first_byte_position; int64 last_byte_position; @@ -1420,8 +1420,8 @@ TEST(HttpResponseHeadersTest, IsKeepAlive) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); EXPECT_EQ(tests[i].expected_keep_alive, parsed->IsKeepAlive()); } @@ -1473,8 +1473,8 @@ TEST(HttpResponseHeadersTest, HasStrongValidators) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string headers(tests[i].headers); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(headers)); EXPECT_EQ(tests[i].expected_result, parsed->HasStrongValidators()) << "Failed test case " << i; @@ -1484,14 +1484,14 @@ TEST(HttpResponseHeadersTest, HasStrongValidators) { TEST(HttpResponseHeadersTest, GetStatusText) { std::string headers("HTTP/1.1 404 Not Found"); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); EXPECT_EQ(std::string("Not Found"), parsed->GetStatusText()); } TEST(HttpResponseHeadersTest, GetStatusTextMissing) { std::string headers("HTTP/1.1 404"); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); // Since the status line gets normalized, we have OK EXPECT_EQ(std::string("OK"), parsed->GetStatusText()); } @@ -1499,14 +1499,14 @@ TEST(HttpResponseHeadersTest, GetStatusTextMissing) { TEST(HttpResponseHeadersTest, GetStatusTextMultiSpace) { std::string headers("HTTP/1.0 404 Not Found"); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); EXPECT_EQ(std::string("Not Found"), parsed->GetStatusText()); } TEST(HttpResponseHeadersTest, GetStatusBadStatusLine) { std::string headers("Foo bar."); HeadersToRaw(&headers); - scoped_refptr<HttpResponseHeaders> parsed = new HttpResponseHeaders(headers); + scoped_refptr<HttpResponseHeaders> parsed(new HttpResponseHeaders(headers)); // The bad status line would have gotten rewritten as // HTTP/1.0 200 OK. EXPECT_EQ(std::string("OK"), parsed->GetStatusText()); @@ -1545,8 +1545,8 @@ TEST(HttpResponseHeadersTest, AddHeader) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string orig_headers(tests[i].orig_headers); HeadersToRaw(&orig_headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(orig_headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(orig_headers)); string new_header(tests[i].new_header); parsed->AddHeader(new_header); @@ -1590,8 +1590,8 @@ TEST(HttpResponseHeadersTest, RemoveHeader) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string orig_headers(tests[i].orig_headers); HeadersToRaw(&orig_headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(orig_headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(orig_headers)); string name(tests[i].to_remove); parsed->RemoveHeader(name); @@ -1645,8 +1645,8 @@ TEST(HttpResponseHeadersTest, ReplaceStatus) { for (size_t i = 0; i < ARRAYSIZE_UNSAFE(tests); ++i) { string orig_headers(tests[i].orig_headers); HeadersToRaw(&orig_headers); - scoped_refptr<HttpResponseHeaders> parsed = - new HttpResponseHeaders(orig_headers); + scoped_refptr<HttpResponseHeaders> parsed( + new HttpResponseHeaders(orig_headers)); string name(tests[i].new_status); parsed->ReplaceStatusLine(name); diff --git a/net/http/http_stream_parser.cc b/net/http/http_stream_parser.cc index 4470199..d3e4abd 100644 --- a/net/http/http_stream_parser.cc +++ b/net/http/http_stream_parser.cc @@ -53,7 +53,7 @@ int HttpStreamParser::SendRequest(const std::string& headers, DCHECK(response); response_ = response; - scoped_refptr<StringIOBuffer> headers_io_buf = new StringIOBuffer(headers); + scoped_refptr<StringIOBuffer> headers_io_buf(new StringIOBuffer(headers)); request_headers_ = new DrainableIOBuffer(headers_io_buf, headers_io_buf->size()); request_body_.reset(request_body); diff --git a/net/http/http_stream_request.cc b/net/http/http_stream_request.cc index 3517b4e..71bbdda 100644 --- a/net/http/http_stream_request.cc +++ b/net/http/http_stream_request.cc @@ -480,9 +480,9 @@ int HttpStreamRequest::DoInitConnection() { } else { ProxyServer proxy_server = proxy_info()->proxy_server(); proxy_host_port.reset(new HostPortPair(proxy_server.host_port_pair())); - scoped_refptr<TCPSocketParams> proxy_tcp_params = + scoped_refptr<TCPSocketParams> proxy_tcp_params( new TCPSocketParams(*proxy_host_port, request_info().priority, - request_info().referrer, disable_resolver_cache); + request_info().referrer, disable_resolver_cache)); if (proxy_info()->is_http() || proxy_info()->is_https()) { GURL authentication_url = request_info().url; @@ -857,12 +857,12 @@ scoped_refptr<SSLSocketParams> HttpStreamRequest::GenerateSslParams( ssl_config()->mitm_proxies_allowed = true; } - scoped_refptr<SSLSocketParams> ssl_params = + scoped_refptr<SSLSocketParams> ssl_params( new SSLSocketParams(tcp_params, socks_params, http_proxy_params, proxy_scheme, hostname, *ssl_config(), load_flags, force_spdy_always_ && force_spdy_over_ssl_, - want_spdy_over_npn); + want_spdy_over_npn)); return ssl_params; } diff --git a/net/http/http_transaction_unittest.cc b/net/http/http_transaction_unittest.cc index 4d9daa5..518c1f8 100644 --- a/net/http/http_transaction_unittest.cc +++ b/net/http/http_transaction_unittest.cc @@ -147,7 +147,7 @@ int ReadTransaction(net::HttpTransaction* trans, std::string* result) { std::string content; do { - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(256); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(256)); rv = trans->Read(buf, 256, &callback); if (rv == net::ERR_IO_PENDING) rv = callback.WaitForResult(); diff --git a/net/proxy/multi_threaded_proxy_resolver.cc b/net/proxy/multi_threaded_proxy_resolver.cc index 95071b1..22fe5e4 100644 --- a/net/proxy/multi_threaded_proxy_resolver.cc +++ b/net/proxy/multi_threaded_proxy_resolver.cc @@ -410,8 +410,8 @@ int MultiThreadedProxyResolver::GetProxyForURL(const GURL& url, DCHECK(current_script_data_.get()) << "Resolver is un-initialized. Must call SetPacScript() first!"; - scoped_refptr<GetProxyForURLJob> job = - new GetProxyForURLJob(url, results, callback, net_log); + scoped_refptr<GetProxyForURLJob> job( + new GetProxyForURLJob(url, results, callback, net_log)); // Completion will be notified through |callback|, unless the caller cancels // the request using |request|. diff --git a/net/proxy/proxy_script_fetcher_impl_unittest.cc b/net/proxy/proxy_script_fetcher_impl_unittest.cc index f9828ee..2642f4d 100644 --- a/net/proxy/proxy_script_fetcher_impl_unittest.cc +++ b/net/proxy/proxy_script_fetcher_impl_unittest.cc @@ -78,7 +78,7 @@ class ProxyScriptFetcherImplTest : public PlatformTest { }; TEST_F(ProxyScriptFetcherImplTest, FileUrl) { - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcher> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -107,7 +107,7 @@ TEST_F(ProxyScriptFetcherImplTest, FileUrl) { TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcher> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -143,7 +143,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpMimeType) { TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcher> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -170,7 +170,7 @@ TEST_F(ProxyScriptFetcherImplTest, HttpStatusCode) { TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcher> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -188,7 +188,7 @@ TEST_F(ProxyScriptFetcherImplTest, ContentDisposition) { TEST_F(ProxyScriptFetcherImplTest, NoCache) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcher> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -221,7 +221,7 @@ TEST_F(ProxyScriptFetcherImplTest, NoCache) { TEST_F(ProxyScriptFetcherImplTest, TooLarge) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcherImpl> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -263,7 +263,7 @@ TEST_F(ProxyScriptFetcherImplTest, TooLarge) { TEST_F(ProxyScriptFetcherImplTest, Hang) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcherImpl> pac_fetcher( new ProxyScriptFetcherImpl(context)); @@ -302,7 +302,7 @@ TEST_F(ProxyScriptFetcherImplTest, Hang) { TEST_F(ProxyScriptFetcherImplTest, Encodings) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new RequestContext; + scoped_refptr<URLRequestContext> context(new RequestContext); scoped_ptr<ProxyScriptFetcher> pac_fetcher( new ProxyScriptFetcherImpl(context)); diff --git a/net/proxy/proxy_service.cc b/net/proxy/proxy_service.cc index db22cc1..e28e325 100644 --- a/net/proxy/proxy_service.cc +++ b/net/proxy/proxy_service.cc @@ -512,8 +512,8 @@ int ProxyService::ResolveProxy(const GURL& raw_url, if (rv != ERR_IO_PENDING) return DidFinishResolvingProxy(result, rv, net_log); - scoped_refptr<PacRequest> req = - new PacRequest(this, url, result, callback, net_log); + scoped_refptr<PacRequest> req( + new PacRequest(this, url, result, callback, net_log)); if (current_state_ == STATE_READY) { // Start the resolve request. @@ -818,8 +818,8 @@ ProxyConfigService* ProxyService::CreateSystemProxyConfigService( void ProxyService::OnProxyConfigChanged(const ProxyConfig& config) { // Emit the proxy settings change to the NetLog stream. if (net_log_) { - scoped_refptr<NetLog::EventParameters> params = - new ProxyConfigChangedNetLogParam(fetched_config_, config); + scoped_refptr<NetLog::EventParameters> params( + new ProxyConfigChangedNetLogParam(fetched_config_, config)); net_log_->AddEntry(net::NetLog::TYPE_PROXY_CONFIG_CHANGED, base::TimeTicks::Now(), NetLog::Source(), diff --git a/net/server/http_listen_socket.cc b/net/server/http_listen_socket.cc index b4f05d9..f35582b 100644 --- a/net/server/http_listen_socket.cc +++ b/net/server/http_listen_socket.cc @@ -37,8 +37,8 @@ void HttpListenSocket::Accept() { if (conn == ListenSocket::kInvalidSocket) { // TODO } else { - scoped_refptr<HttpListenSocket> sock = - new HttpListenSocket(conn, delegate_); + scoped_refptr<HttpListenSocket> sock( + new HttpListenSocket(conn, delegate_)); #if defined(OS_POSIX) sock->WatchSocket(WAITING_READ); #endif 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); diff --git a/net/socket_stream/socket_stream_unittest.cc b/net/socket_stream/socket_stream_unittest.cc index 25ce17b..832b0ab 100644 --- a/net/socket_stream/socket_stream_unittest.cc +++ b/net/socket_stream/socket_stream_unittest.cc @@ -240,8 +240,8 @@ TEST_F(SocketStreamTest, CloseFlushPendingWrite) { MockHostResolver host_resolver; - scoped_refptr<SocketStream> socket_stream = - new SocketStream(GURL("ws://example.com/demo"), delegate.get()); + scoped_refptr<SocketStream> socket_stream( + new SocketStream(GURL("ws://example.com/demo"), delegate.get())); socket_stream->set_context(new TestURLRequestContext()); socket_stream->SetHostResolver(&host_resolver); @@ -331,8 +331,8 @@ TEST_F(SocketStreamTest, BasicAuthProxy) { NewCallback(delegate.get(), &SocketStreamEventRecorder::DoRestartWithAuth)); - scoped_refptr<SocketStream> socket_stream = - new SocketStream(GURL("ws://example.com/demo"), delegate.get()); + scoped_refptr<SocketStream> socket_stream( + new SocketStream(GURL("ws://example.com/demo"), delegate.get())); socket_stream->set_context(new TestURLRequestContext("myproxy:70")); MockHostResolver host_resolver; diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc index 82be0c1..8b2dc92 100644 --- a/net/spdy/spdy_network_transaction_unittest.cc +++ b/net/spdy/spdy_network_transaction_unittest.cc @@ -346,7 +346,7 @@ class SpdyNetworkTransactionTest const int kSize = 3000; int bytes_read = 0; - scoped_refptr<net::IOBufferWithSize> buf = new net::IOBufferWithSize(kSize); + scoped_refptr<net::IOBufferWithSize> buf(new net::IOBufferWithSize(kSize)); TestCompletionCallback callback; while (true) { int rv = trans->Read(buf, kSize, &callback); @@ -462,8 +462,8 @@ INSTANTIATE_TEST_CASE_P(Spdy, // Verify HttpNetworkTransaction constructor. TEST_P(SpdyNetworkTransactionTest, Constructor) { SpdySessionDependencies session_deps; - scoped_refptr<HttpNetworkSession> session = - SpdySessionDependencies::SpdyCreateSession(&session_deps); + scoped_refptr<HttpNetworkSession> session( + SpdySessionDependencies::SpdyCreateSession(&session_deps)); scoped_ptr<HttpTransaction> trans(new HttpNetworkTransaction(session)); } @@ -1709,7 +1709,7 @@ TEST_P(SpdyNetworkTransactionTest, WindowUpdateSent) { // Issue a read which will cause a WINDOW_UPDATE to be sent and window // size increased to default. - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kUploadDataSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kUploadDataSize)); rv = trans->Read(buf, kUploadDataSize, NULL); EXPECT_EQ(kUploadDataSize, rv); std::string content(buf->data(), buf->data()+kUploadDataSize); @@ -2075,7 +2075,7 @@ TEST_P(SpdyNetworkTransactionTest, StartTransactionOnReadCallback) { StartTransactionCallback callback2(helper.session(), helper); const int kSize = 3000; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); rv = trans->Read(buf, kSize, &callback2); // This forces an err_IO_pending, which sets the callback. data->CompleteRead(); @@ -2135,7 +2135,7 @@ TEST_P(SpdyNetworkTransactionTest, DeleteSessionOnReadCallback) { // memory holding the stream object. Note that the callback deletes trans. DeleteSessionCallback callback2(helper); const int kSize = 3000; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSize)); rv = trans->Read(buf, kSize, &callback2); ASSERT_EQ(ERR_IO_PENDING, rv); data->CompleteRead(); @@ -3418,7 +3418,7 @@ TEST_P(SpdyNetworkTransactionTest, BufferFull) { do { // Read small chunks at a time. const int kSmallReadSize = 3; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSmallReadSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, &read_callback); if (rv == net::ERR_IO_PENDING) { data->CompleteRead(); @@ -3584,7 +3584,7 @@ TEST_P(SpdyNetworkTransactionTest, Buffering) { do { // Read small chunks at a time. const int kSmallReadSize = 14; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSmallReadSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, &read_callback); if (rv == net::ERR_IO_PENDING) { data->CompleteRead(); @@ -3679,7 +3679,7 @@ TEST_P(SpdyNetworkTransactionTest, BufferedAll) { do { // Read small chunks at a time. const int kSmallReadSize = 14; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSmallReadSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, &read_callback); if (rv > 0) { EXPECT_EQ(kSmallReadSize, rv); @@ -3768,7 +3768,7 @@ TEST_P(SpdyNetworkTransactionTest, BufferedClosed) { do { // Read small chunks at a time. const int kSmallReadSize = 14; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kSmallReadSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kSmallReadSize)); rv = trans->Read(buf, kSmallReadSize, &read_callback); if (rv == net::ERR_IO_PENDING) { data->CompleteRead(); @@ -3844,7 +3844,7 @@ TEST_P(SpdyNetworkTransactionTest, BufferedCancelled) { do { const int kReadSize = 256; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(kReadSize); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(kReadSize)); rv = trans->Read(buf, kReadSize, &read_callback); if (rv == net::ERR_IO_PENDING) { // Complete the read now, which causes buffering to start. @@ -4382,8 +4382,8 @@ TEST_P(SpdyNetworkTransactionTest, DirectConnectProxyReconnect) { request_proxy.load_flags = 0; scoped_ptr<SpdySessionDependencies> ssd_proxy(new SpdySessionDependencies()); // Ensure that this transaction uses the same SpdySessionPool. - scoped_refptr<HttpNetworkSession> session_proxy = - SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get()); + scoped_refptr<HttpNetworkSession> session_proxy( + SpdySessionDependencies::SpdyCreateSession(ssd_proxy.get())); NormalSpdyTransactionHelper helper_proxy(request_proxy, BoundNetLog(), GetParam()); HttpNetworkSessionPeer session_peer(session_proxy); diff --git a/net/spdy/spdy_proxy_client_socket.cc b/net/spdy/spdy_proxy_client_socket.cc index 91936a0..69e93a6 100644 --- a/net/spdy/spdy_proxy_client_socket.cc +++ b/net/spdy/spdy_proxy_client_socket.cc @@ -404,7 +404,7 @@ int SpdyProxyClientSocket::OnResponseReceived( void SpdyProxyClientSocket::OnDataReceived(const char* data, int length) { if (length > 0) { // Save the received data. - scoped_refptr<IOBuffer> io_buffer = new IOBuffer(length); + scoped_refptr<IOBuffer> io_buffer(new IOBuffer(length)); memcpy(io_buffer->data(), data, length); read_buffer_.push_back(new DrainableIOBuffer(io_buffer, length)); } diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc index 41de78d..3af9079 100644 --- a/net/spdy/spdy_session.cc +++ b/net/spdy/spdy_session.cc @@ -1054,8 +1054,8 @@ void SpdySession::OnSyn(const spdy::SpdySynStreamControlFrame& frame, return; } - scoped_refptr<SpdyStream> stream = - new SpdyStream(this, stream_id, true, net_log_); + scoped_refptr<SpdyStream> stream( + new SpdyStream(this, stream_id, true, net_log_)); stream->set_path(path); diff --git a/net/spdy/spdy_session_unittest.cc b/net/spdy/spdy_session_unittest.cc index 4a66406..0cfbe48 100644 --- a/net/spdy/spdy_session_unittest.cc +++ b/net/spdy/spdy_session_unittest.cc @@ -91,8 +91,8 @@ TEST_F(SpdySessionTest, GoAway) { BoundNetLog()); EXPECT_TRUE(spdy_session_pool->HasSession(pair)); - scoped_refptr<TCPSocketParams> tcp_params = - new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false); + scoped_refptr<TCPSocketParams> tcp_params( + new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, @@ -200,8 +200,8 @@ TEST_F(SpdySessionTest, OnSettings) { BoundNetLog()); ASSERT_TRUE(spdy_session_pool->HasSession(pair)); - scoped_refptr<TCPSocketParams> tcp_params = - new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false); + scoped_refptr<TCPSocketParams> tcp_params( + new TCPSocketParams(kTestHost, kTestPort, MEDIUM, GURL(), false)); scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); EXPECT_EQ(OK, connection->Init(test_host_port_pair.ToString(), tcp_params, MEDIUM, diff --git a/net/spdy/spdy_stream_unittest.cc b/net/spdy/spdy_stream_unittest.cc index 5ece945..cdb116f 100644 --- a/net/spdy/spdy_stream_unittest.cc +++ b/net/spdy/spdy_stream_unittest.cc @@ -192,8 +192,8 @@ TEST_F(SpdyStreamTest, SendDataAfterOpen) { GURL url("http://www.google.com/"); HostPortPair host_port_pair("www.google.com", 80); - scoped_refptr<TCPSocketParams> tcp_params = - new TCPSocketParams(host_port_pair, LOWEST, GURL(), false); + scoped_refptr<TCPSocketParams> tcp_params( + new TCPSocketParams(host_port_pair, LOWEST, GURL(), false)); scoped_ptr<ClientSocketHandle> connection(new ClientSocketHandle); EXPECT_EQ(OK, diff --git a/net/tools/fetch/http_listen_socket.cc b/net/tools/fetch/http_listen_socket.cc index fd788c8..0db714f 100644 --- a/net/tools/fetch/http_listen_socket.cc +++ b/net/tools/fetch/http_listen_socket.cc @@ -30,8 +30,8 @@ void HttpListenSocket::Accept() { if (conn == ListenSocket::kInvalidSocket) { // TODO } else { - scoped_refptr<HttpListenSocket> sock = - new HttpListenSocket(conn, delegate_); + scoped_refptr<HttpListenSocket> sock( + new HttpListenSocket(conn, delegate_)); // it's up to the delegate to AddRef if it wants to keep it around DidAccept(this, sock); } diff --git a/net/url_request/url_request_ftp_job.cc b/net/url_request/url_request_ftp_job.cc index 37d6ab0..aec8248 100644 --- a/net/url_request/url_request_ftp_job.cc +++ b/net/url_request/url_request_ftp_job.cc @@ -82,7 +82,7 @@ void URLRequestFtpJob::GetAuthChallengeInfo( scoped_refptr<net::AuthChallengeInfo>* result) { DCHECK((server_auth_ != NULL) && (server_auth_->state == net::AUTH_STATE_NEED_AUTH)); - scoped_refptr<net::AuthChallengeInfo> auth_info = new net::AuthChallengeInfo; + scoped_refptr<net::AuthChallengeInfo> auth_info(new net::AuthChallengeInfo); auth_info->is_proxy = false; auth_info->host_and_port = ASCIIToWide( net::GetHostAndPort(request_->url())); diff --git a/net/url_request/url_request_job.cc b/net/url_request/url_request_job.cc index 2a4d036..a059a00 100644 --- a/net/url_request/url_request_job.cc +++ b/net/url_request/url_request_job.cc @@ -452,7 +452,7 @@ void URLRequestJob::NotifyHeadersComplete() { // check the request pointer to see if it still exists, and return // immediately if it has been destroyed. self_preservation ensures our // survival until we can get out of this method. - scoped_refptr<URLRequestJob> self_preservation = this; + scoped_refptr<URLRequestJob> self_preservation(this); GURL new_location; int http_status_code; @@ -558,7 +558,7 @@ void URLRequestJob::NotifyReadComplete(int bytes_read) { // check the request pointer to see if it still exists, and return // immediately if it has been destroyed. self_preservation ensures our // survival until we can get out of this method. - scoped_refptr<URLRequestJob> self_preservation = this; + scoped_refptr<URLRequestJob> self_preservation(this); prefilter_bytes_read_ += bytes_read; if (filter_.get()) { diff --git a/net/url_request/url_request_unittest.cc b/net/url_request/url_request_unittest.cc index 1cb0aa6..f3828dc 100644 --- a/net/url_request/url_request_unittest.cc +++ b/net/url_request/url_request_unittest.cc @@ -89,7 +89,7 @@ void FillBuffer(char* buffer, size_t len) { } scoped_refptr<net::UploadData> CreateSimpleUploadData(const char* data) { - scoped_refptr<net::UploadData> upload = new net::UploadData; + scoped_refptr<net::UploadData> upload(new net::UploadData); upload->AppendBytes(data, strlen(data)); return upload; } @@ -146,7 +146,7 @@ class URLRequestTestHTTP : public URLRequestTest { } uploadBytes[kMsgSize] = '\0'; - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); for (int i = 0; i < kIterations; ++i) { TestDelegate d; @@ -527,7 +527,7 @@ TEST_F(URLRequestTestHTTP, CancelTest4) { TEST_F(URLRequestTestHTTP, CancelTest5) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); // populate cache { @@ -1134,7 +1134,7 @@ TEST_F(URLRequestTestHTTP, CancelDeferredRedirect) { TEST_F(URLRequestTestHTTP, VaryHeader) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); // populate the cache { @@ -1180,7 +1180,7 @@ TEST_F(URLRequestTestHTTP, VaryHeader) { TEST_F(URLRequestTestHTTP, BasicAuth) { ASSERT_TRUE(test_server_.Start()); - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); // populate the cache { @@ -1230,7 +1230,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { // Request a page that will give a 401 containing a Set-Cookie header. // Verify that when the transaction is restarted, it includes the new cookie. { - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); TestDelegate d; d.set_username(kUser); d.set_password(kSecret); @@ -1251,7 +1251,7 @@ TEST_F(URLRequestTestHTTP, BasicAuthWithCookies) { // Same test as above, except this time the restart is initiated earlier // (without user intervention since identity is embedded in the URL). { - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); TestDelegate d; GURL::Replacements replacements; @@ -1279,7 +1279,7 @@ TEST_F(URLRequestTest, DoNotSendCookies) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); // Set up a cookie. { @@ -1328,7 +1328,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<URLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<URLRequestContext> context(new TestURLRequestContext()); // Set up a cookie. { @@ -1384,7 +1384,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); // Set up a cookie. { @@ -1438,7 +1438,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); // Set up a cookie. { @@ -1495,7 +1495,7 @@ TEST_F(URLRequestTest, DoNotSaveEmptyCookies) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); // Set up an empty cookie. { @@ -1515,7 +1515,7 @@ TEST_F(URLRequestTest, DoNotSendCookies_ViaPolicy_Async) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); // Set up a cookie. { @@ -1570,7 +1570,7 @@ TEST_F(URLRequestTest, DoNotSaveCookies_ViaPolicy_Async) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); // Set up a cookie. { @@ -1627,7 +1627,7 @@ TEST_F(URLRequestTest, CancelTest_During_CookiePolicy) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); TestCookiePolicy cookie_policy(TestCookiePolicy::ASYNC); context->set_cookie_policy(&cookie_policy); @@ -1658,7 +1658,7 @@ TEST_F(URLRequestTest, CancelTest_During_OnGetCookies) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); TestCookiePolicy cookie_policy(TestCookiePolicy::NO_GET_COOKIES); context->set_cookie_policy(&cookie_policy); @@ -1687,7 +1687,7 @@ TEST_F(URLRequestTest, CancelTest_During_OnSetCookie) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); TestCookiePolicy cookie_policy(TestCookiePolicy::NO_SET_COOKIE); context->set_cookie_policy(&cookie_policy); @@ -1721,7 +1721,7 @@ TEST_F(URLRequestTest, CookiePolicy_ForceSession) { net::TestServer test_server(net::TestServer::TYPE_HTTP, FilePath()); ASSERT_TRUE(test_server.Start()); - scoped_refptr<TestURLRequestContext> context = new TestURLRequestContext(); + scoped_refptr<TestURLRequestContext> context(new TestURLRequestContext()); TestCookiePolicy cookie_policy(TestCookiePolicy::FORCE_SESSION); context->set_cookie_policy(&cookie_policy); diff --git a/net/url_request/view_cache_helper_unittest.cc b/net/url_request/view_cache_helper_unittest.cc index e82ff15..5338ee5 100644 --- a/net/url_request/view_cache_helper_unittest.cc +++ b/net/url_request/view_cache_helper_unittest.cc @@ -40,8 +40,8 @@ void WriteHeaders(disk_cache::Entry* entry, int flags, const std::string data) { pickle.WriteInt64(0); pickle.WriteString(data); - scoped_refptr<net::WrappedIOBuffer> buf = new net::WrappedIOBuffer( - reinterpret_cast<const char*>(pickle.data())); + scoped_refptr<net::WrappedIOBuffer> buf(new net::WrappedIOBuffer( + reinterpret_cast<const char*>(pickle.data()))); int len = static_cast<int>(pickle.size()); TestCompletionCallback cb; diff --git a/net/websockets/websocket_throttle_unittest.cc b/net/websockets/websocket_throttle_unittest.cc index c4bf59f..7eb18fa5 100644 --- a/net/websockets/websocket_throttle_unittest.cc +++ b/net/websockets/websocket_throttle_unittest.cc @@ -83,9 +83,9 @@ TEST_F(WebSocketThrottleTest, Throttle) { struct addrinfo* addr = AddAddr(1, 2, 3, 4, NULL); addr = AddAddr(1, 2, 3, 5, addr); addr = AddAddr(1, 2, 3, 6, addr); - scoped_refptr<WebSocketJob> w1 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s1 = - new SocketStream(GURL("ws://host1/"), w1.get()); + scoped_refptr<WebSocketJob> w1(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s1( + new SocketStream(GURL("ws://host1/"), w1.get())); w1->InitSocketStream(s1.get()); WebSocketThrottleTest::MockSocketStreamConnect(s1, addr); DeleteAddrInfo(addr); @@ -103,9 +103,9 @@ TEST_F(WebSocketThrottleTest, Throttle) { // For host2: 1.2.3.4 addr = AddAddr(1, 2, 3, 4, NULL); - scoped_refptr<WebSocketJob> w2 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s2 = - new SocketStream(GURL("ws://host2/"), w2.get()); + scoped_refptr<WebSocketJob> w2(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s2( + new SocketStream(GURL("ws://host2/"), w2.get())); w2->InitSocketStream(s2.get()); WebSocketThrottleTest::MockSocketStreamConnect(s2, addr); DeleteAddrInfo(addr); @@ -122,9 +122,9 @@ TEST_F(WebSocketThrottleTest, Throttle) { // For host3: 1.2.3.5 addr = AddAddr(1, 2, 3, 5, NULL); - scoped_refptr<WebSocketJob> w3 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s3 = - new SocketStream(GURL("ws://host3/"), w3.get()); + scoped_refptr<WebSocketJob> w3(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s3( + new SocketStream(GURL("ws://host3/"), w3.get())); w3->InitSocketStream(s3.get()); WebSocketThrottleTest::MockSocketStreamConnect(s3, addr); DeleteAddrInfo(addr); @@ -141,9 +141,9 @@ TEST_F(WebSocketThrottleTest, Throttle) { // For host4: 1.2.3.4, 1.2.3.6 addr = AddAddr(1, 2, 3, 4, NULL); addr = AddAddr(1, 2, 3, 6, addr); - scoped_refptr<WebSocketJob> w4 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s4 = - new SocketStream(GURL("ws://host4/"), w4.get()); + scoped_refptr<WebSocketJob> w4(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s4( + new SocketStream(GURL("ws://host4/"), w4.get())); w4->InitSocketStream(s4.get()); WebSocketThrottleTest::MockSocketStreamConnect(s4, addr); DeleteAddrInfo(addr); @@ -159,9 +159,9 @@ TEST_F(WebSocketThrottleTest, Throttle) { // For host5: 1.2.3.6 addr = AddAddr(1, 2, 3, 6, NULL); - scoped_refptr<WebSocketJob> w5 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s5 = - new SocketStream(GURL("ws://host5/"), w5.get()); + scoped_refptr<WebSocketJob> w5(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s5( + new SocketStream(GURL("ws://host5/"), w5.get())); w5->InitSocketStream(s5.get()); WebSocketThrottleTest::MockSocketStreamConnect(s5, addr); DeleteAddrInfo(addr); @@ -177,9 +177,9 @@ TEST_F(WebSocketThrottleTest, Throttle) { // For host6: 1.2.3.6 addr = AddAddr(1, 2, 3, 6, NULL); - scoped_refptr<WebSocketJob> w6 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s6 = - new SocketStream(GURL("ws://host6/"), w6.get()); + scoped_refptr<WebSocketJob> w6(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s6( + new SocketStream(GURL("ws://host6/"), w6.get())); w6->InitSocketStream(s6.get()); WebSocketThrottleTest::MockSocketStreamConnect(s6, addr); DeleteAddrInfo(addr); @@ -286,9 +286,9 @@ TEST_F(WebSocketThrottleTest, NoThrottleForDuplicateAddress) { // For localhost: 127.0.0.1, 127.0.0.1 struct addrinfo* addr = AddAddr(127, 0, 0, 1, NULL); addr = AddAddr(127, 0, 0, 1, addr); - scoped_refptr<WebSocketJob> w1 = new WebSocketJob(&delegate); - scoped_refptr<SocketStream> s1 = - new SocketStream(GURL("ws://localhost/"), w1.get()); + scoped_refptr<WebSocketJob> w1(new WebSocketJob(&delegate)); + scoped_refptr<SocketStream> s1( + new SocketStream(GURL("ws://localhost/"), w1.get())); w1->InitSocketStream(s1.get()); WebSocketThrottleTest::MockSocketStreamConnect(s1, addr); DeleteAddrInfo(addr); |