diff options
182 files changed, 991 insertions, 990 deletions
diff --git a/base/message_loop_proxy_impl.cc b/base/message_loop_proxy_impl.cc index 761cc71..2e0f809 100644 --- a/base/message_loop_proxy_impl.cc +++ b/base/message_loop_proxy_impl.cc @@ -93,7 +93,7 @@ void MessageLoopProxyImpl::WillDestroyCurrentMessageLoop() { scoped_refptr<MessageLoopProxy> MessageLoopProxy::CreateForCurrentThread() { - scoped_refptr<MessageLoopProxy> ret = new MessageLoopProxyImpl(); + scoped_refptr<MessageLoopProxy> ret(new MessageLoopProxyImpl()); return ret; } diff --git a/base/message_loop_unittest.cc b/base/message_loop_unittest.cc index 8cce8ea..a3c3307 100644 --- a/base/message_loop_unittest.cc +++ b/base/message_loop_unittest.cc @@ -95,7 +95,7 @@ void RunTest_PostTask(MessageLoop::Type message_loop_type) { MessageLoop loop(message_loop_type); // Add tests to message loop - scoped_refptr<Foo> foo = new Foo(); + scoped_refptr<Foo> foo(new Foo()); std::string a("a"), b("b"), c("c"), d("d"); MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( foo.get(), &Foo::Test0)); @@ -111,7 +111,7 @@ void RunTest_PostTask(MessageLoop::Type message_loop_type) { foo.get(), &Foo::Test2Mixed, a, &d)); // After all tests, post a message that will shut down the message loop - scoped_refptr<QuitMsgLoop> quit = new QuitMsgLoop(); + scoped_refptr<QuitMsgLoop> quit(new QuitMsgLoop()); MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( quit.get(), &QuitMsgLoop::QuitNow)); @@ -126,7 +126,7 @@ void RunTest_PostTask_SEH(MessageLoop::Type message_loop_type) { MessageLoop loop(message_loop_type); // Add tests to message loop - scoped_refptr<Foo> foo = new Foo(); + scoped_refptr<Foo> foo(new Foo()); std::string a("a"), b("b"), c("c"), d("d"); MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( foo.get(), &Foo::Test0)); @@ -142,7 +142,7 @@ void RunTest_PostTask_SEH(MessageLoop::Type message_loop_type) { foo.get(), &Foo::Test2Mixed, a, &d)); // After all tests, post a message that will shut down the message loop - scoped_refptr<QuitMsgLoop> quit = new QuitMsgLoop(); + scoped_refptr<QuitMsgLoop> quit(new QuitMsgLoop()); MessageLoop::current()->PostTask(FROM_HERE, NewRunnableMethod( quit.get(), &QuitMsgLoop::QuitNow)); diff --git a/base/metrics/field_trial_unittest.cc b/base/metrics/field_trial_unittest.cc index aea8e85..a8138bb 100644 --- a/base/metrics/field_trial_unittest.cc +++ b/base/metrics/field_trial_unittest.cc @@ -100,7 +100,7 @@ TEST_F(FieldTrialTest, FiftyFiftyProbability) { int counter = 0; do { std::string name = base::StringPrintf("FiftyFifty%d", ++counter); - scoped_refptr<FieldTrial> trial = new FieldTrial(name, 2); + scoped_refptr<FieldTrial> trial(new FieldTrial(name, 2)); trial->AppendGroup("first", 1); // 50% chance of being chosen. if (trial->group() != FieldTrial::kNotParticipating) { first_winner = true; diff --git a/base/ref_counted_unittest.cc b/base/ref_counted_unittest.cc index f2739fce..cd6f922 100644 --- a/base/ref_counted_unittest.cc +++ b/base/ref_counted_unittest.cc @@ -26,7 +26,7 @@ class CheckDerivedMemberAccess : public scoped_refptr<SelfAssign> { TEST(RefCountedUnitTest, TestSelfAssignment) { SelfAssign* p = new SelfAssign; - scoped_refptr<SelfAssign> var = p; + scoped_refptr<SelfAssign> var(p); var = var; EXPECT_EQ(var.get(), p); } diff --git a/chrome/browser/automation/automation_resource_message_filter.cc b/chrome/browser/automation/automation_resource_message_filter.cc index e77d07a..ecbbddc 100644 --- a/chrome/browser/automation/automation_resource_message_filter.cc +++ b/chrome/browser/automation/automation_resource_message_filter.cc @@ -294,8 +294,8 @@ void AutomationResourceMessageFilter::RegisterRenderViewInIOThread( bool pending_view) { RendererId renderer_key(renderer_pid, renderer_id); - scoped_refptr<net::CookieStore> cookie_store = - new AutomationCookieStore(filter, tab_handle); + scoped_refptr<net::CookieStore> cookie_store( + new AutomationCookieStore(filter, tab_handle)); RenderViewMap::iterator automation_details_iter( filtered_render_views_.Get().find(renderer_key)); @@ -350,8 +350,8 @@ bool AutomationResourceMessageFilter::ResumePendingRenderViewInIOThread( DCHECK(automation_details_iter->second.is_pending_render_view); - scoped_refptr<net::CookieStore> cookie_store = - new AutomationCookieStore(filter, tab_handle); + scoped_refptr<net::CookieStore> cookie_store( + new AutomationCookieStore(filter, tab_handle)); AutomationResourceMessageFilter* old_filter = automation_details_iter->second.filter; diff --git a/chrome/browser/automation/testing_automation_provider.cc b/chrome/browser/automation/testing_automation_provider.cc index ec10dfa..241a4b1 100644 --- a/chrome/browser/automation/testing_automation_provider.cc +++ b/chrome/browser/automation/testing_automation_provider.cc @@ -1549,9 +1549,9 @@ void TestingAutomationProvider::GetBookmarksAsJSON( if (!browser->profile()->GetBookmarkModel()->IsLoaded()) { return; } - scoped_refptr<BookmarkStorage> storage = new BookmarkStorage( + scoped_refptr<BookmarkStorage> storage(new BookmarkStorage( browser->profile(), - browser->profile()->GetBookmarkModel()); + browser->profile()->GetBookmarkModel())); *success = storage->SerializeData(bookmarks_as_json); } } diff --git a/chrome/browser/bookmarks/bookmark_html_writer.cc b/chrome/browser/bookmarks/bookmark_html_writer.cc index d66c35f..38899bf 100644 --- a/chrome/browser/bookmarks/bookmark_html_writer.cc +++ b/chrome/browser/bookmarks/bookmark_html_writer.cc @@ -249,7 +249,7 @@ class Writer : public Task { BookmarkFaviconFetcher::URLFaviconMap::iterator itr = favicons_map_->find(url_string); if (itr != favicons_map_->end()) { - scoped_refptr<RefCountedMemory> data = itr->second.get(); + scoped_refptr<RefCountedMemory> data(itr->second.get()); std::string favicon_data; favicon_data.assign(reinterpret_cast<const char*>(data->front()), data->size()); diff --git a/chrome/browser/browser_about_handler.cc b/chrome/browser/browser_about_handler.cc index 9590b87..bb42ea8 100644 --- a/chrome/browser/browser_about_handler.cc +++ b/chrome/browser/browser_about_handler.cc @@ -305,8 +305,8 @@ std::string AboutNetwork(const std::string& query) { class AboutDnsHandler : public base::RefCountedThreadSafe<AboutDnsHandler> { public: static void Start(AboutSource* source, int request_id) { - scoped_refptr<AboutDnsHandler> handler = - new AboutDnsHandler(source, request_id); + scoped_refptr<AboutDnsHandler> handler( + new AboutDnsHandler(source, request_id)); handler->StartOnUIThread(); } diff --git a/chrome/browser/browser_main.cc b/chrome/browser/browser_main.cc index 57a9200..f22a6ed 100644 --- a/chrome/browser/browser_main.cc +++ b/chrome/browser/browser_main.cc @@ -214,8 +214,8 @@ void BrowserMainParts::ConnectionFieldTrial() { const base::FieldTrial::Probability kConnectDivisor = 100; const base::FieldTrial::Probability kConnectProbability = 1; // 1% prob. - scoped_refptr<base::FieldTrial> connect_trial = - new base::FieldTrial("ConnCountImpact", kConnectDivisor); + scoped_refptr<base::FieldTrial> connect_trial( + new base::FieldTrial("ConnCountImpact", kConnectDivisor)); const int connect_5 = connect_trial->AppendGroup("conn_count_5", kConnectProbability); @@ -259,8 +259,8 @@ void BrowserMainParts::SocketTimeoutFieldTrial() { // 1% probability for all experimental settings. const base::FieldTrial::Probability kSocketTimeoutProbability = 1; - scoped_refptr<base::FieldTrial> socket_timeout_trial = - new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor); + scoped_refptr<base::FieldTrial> socket_timeout_trial( + new base::FieldTrial("IdleSktToImpact", kIdleSocketTimeoutDivisor)); const int socket_timeout_5 = socket_timeout_trial->AppendGroup("idle_timeout_5", @@ -295,8 +295,8 @@ void BrowserMainParts::ProxyConnectionsFieldTrial() { // 25% probability const base::FieldTrial::Probability kProxyConnectionProbability = 1; - scoped_refptr<base::FieldTrial> proxy_connection_trial = - new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor); + scoped_refptr<base::FieldTrial> proxy_connection_trial( + new base::FieldTrial("ProxyConnectionImpact", kProxyConnectionsDivisor)); // The number of max sockets per group cannot be greater than the max number // of sockets per proxy server. We tried using 8, and it can easily @@ -346,8 +346,8 @@ void BrowserMainParts::SpdyFieldTrial() { const base::FieldTrial::Probability kSpdyDivisor = 100; // 10% to preclude SPDY. base::FieldTrial::Probability npnhttp_probability = 10; - scoped_refptr<base::FieldTrial> trial = - new base::FieldTrial("SpdyImpact", kSpdyDivisor); + scoped_refptr<base::FieldTrial> trial( + new base::FieldTrial("SpdyImpact", kSpdyDivisor)); // npn with only http support, no spdy. int npn_http_grp = trial->AppendGroup("npn_with_http", npnhttp_probability); // npn with spdy support. @@ -384,8 +384,8 @@ void BrowserMainParts::PrefetchFieldTrial() { } else { const base::FieldTrial::Probability kPrefetchDivisor = 1000; const base::FieldTrial::Probability no_prefetch_probability = 500; - scoped_refptr<base::FieldTrial> trial = - new base::FieldTrial("Prefetch", kPrefetchDivisor); + scoped_refptr<base::FieldTrial> trial( + new base::FieldTrial("Prefetch", kPrefetchDivisor)); trial->AppendGroup("ContentPrefetchDisabled", no_prefetch_probability); const int yes_prefetch_grp = trial->AppendGroup("ContentPrefetchEnabled", @@ -411,9 +411,9 @@ void BrowserMainParts::ConnectBackupJobsFieldTrial() { const base::FieldTrial::Probability kConnectBackupJobsDivisor = 100; // 1% probability. const base::FieldTrial::Probability kConnectBackupJobsProbability = 1; - scoped_refptr<base::FieldTrial> trial = + scoped_refptr<base::FieldTrial> trial( new base::FieldTrial("ConnnectBackupJobs", - kConnectBackupJobsDivisor); + kConnectBackupJobsDivisor)); trial->AppendGroup("ConnectBackupJobsDisabled", kConnectBackupJobsProbability); const int connect_backup_jobs_enabled = @@ -1084,8 +1084,8 @@ int BrowserMain(const MainFunctionParams& parameters) { // for posting tasks via NewRunnableMethod. Its deleted when it goes out of // scope. Even though NewRunnableMethod does AddRef and Release, the object // will not be deleted after the Task is executed. - scoped_refptr<HistogramSynchronizer> histogram_synchronizer = - new HistogramSynchronizer(); + scoped_refptr<HistogramSynchronizer> histogram_synchronizer( + new HistogramSynchronizer()); // Initialize the prefs of the local state. browser::RegisterLocalState(local_state); @@ -1388,8 +1388,8 @@ int BrowserMain(const MainFunctionParams& parameters) { // layout globally. base::FieldTrial::Probability kSDCH_DIVISOR = 1000; base::FieldTrial::Probability kSDCH_DISABLE_PROBABILITY = 1; // 0.1% prob. - scoped_refptr<base::FieldTrial> sdch_trial = - new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR); + scoped_refptr<base::FieldTrial> sdch_trial( + new base::FieldTrial("GlobalSdch", kSDCH_DIVISOR)); // Use default of "" so that all domains are supported. std::string sdch_supported_domain(""); diff --git a/chrome/browser/browser_thread.cc b/chrome/browser/browser_thread.cc index 003b1ad..7ba53e0 100644 --- a/chrome/browser/browser_thread.cc +++ b/chrome/browser/browser_thread.cc @@ -176,8 +176,8 @@ bool BrowserThread::GetCurrentThreadIdentifier(ID* identifier) { scoped_refptr<base::MessageLoopProxy> BrowserThread::GetMessageLoopProxyForThread( ID identifier) { - scoped_refptr<base::MessageLoopProxy> proxy = - new BrowserThreadMessageLoopProxy(identifier); + scoped_refptr<base::MessageLoopProxy> proxy( + new BrowserThreadMessageLoopProxy(identifier)); return proxy; } diff --git a/chrome/browser/browsing_data_appcache_helper_unittest.cc b/chrome/browser/browsing_data_appcache_helper_unittest.cc index 8373485..0e6dab3 100644 --- a/chrome/browser/browsing_data_appcache_helper_unittest.cc +++ b/chrome/browser/browsing_data_appcache_helper_unittest.cc @@ -34,8 +34,8 @@ TEST(CannedBrowsingDataAppCacheHelperTest, SetInfo) { GURL manifest2("http://example2.com/path1/manifest.xml"); GURL manifest3("http://example2.com/path2/manifest.xml"); - scoped_refptr<CannedBrowsingDataAppCacheHelper> helper = - new CannedBrowsingDataAppCacheHelper(&profile); + scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( + new CannedBrowsingDataAppCacheHelper(&profile)); helper->AddAppCache(manifest1); helper->AddAppCache(manifest2); helper->AddAppCache(manifest3); @@ -67,8 +67,8 @@ TEST(CannedBrowsingDataAppCacheHelperTest, Unique) { GURL manifest("http://example.com/manifest.xml"); - scoped_refptr<CannedBrowsingDataAppCacheHelper> helper = - new CannedBrowsingDataAppCacheHelper(&profile); + scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( + new CannedBrowsingDataAppCacheHelper(&profile)); helper->AddAppCache(manifest); helper->AddAppCache(manifest); @@ -91,8 +91,8 @@ TEST(CannedBrowsingDataAppCacheHelperTest, Empty) { GURL manifest("http://example.com/manifest.xml"); - scoped_refptr<CannedBrowsingDataAppCacheHelper> helper = - new CannedBrowsingDataAppCacheHelper(&profile); + scoped_refptr<CannedBrowsingDataAppCacheHelper> helper( + new CannedBrowsingDataAppCacheHelper(&profile)); ASSERT_TRUE(helper->empty()); helper->AddAppCache(manifest); diff --git a/chrome/browser/browsing_data_database_helper_unittest.cc b/chrome/browser/browsing_data_database_helper_unittest.cc index c8f1c18..ca23f39 100644 --- a/chrome/browser/browsing_data_database_helper_unittest.cc +++ b/chrome/browser/browsing_data_database_helper_unittest.cc @@ -46,8 +46,8 @@ TEST(CannedBrowsingDataDatabaseTest, AddDatabase) { const char db2[] = "db2"; const char db3[] = "db3"; - scoped_refptr<CannedBrowsingDataDatabaseHelper> helper = - new CannedBrowsingDataDatabaseHelper(&profile); + scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( + new CannedBrowsingDataDatabaseHelper(&profile)); helper->AddDatabase(origin1, db1, ""); helper->AddDatabase(origin1, db2, ""); helper->AddDatabase(origin2, db3, ""); @@ -76,8 +76,8 @@ TEST(CannedBrowsingDataDatabaseTest, Unique) { const char origin_str[] = "http_host1_1"; const char db[] = "db1"; - scoped_refptr<CannedBrowsingDataDatabaseHelper> helper = - new CannedBrowsingDataDatabaseHelper(&profile); + scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( + new CannedBrowsingDataDatabaseHelper(&profile)); helper->AddDatabase(origin, db, ""); helper->AddDatabase(origin, db, ""); @@ -100,8 +100,8 @@ TEST(CannedBrowsingDataDatabaseTest, Empty) { const GURL origin("http://host1:1/"); const char db[] = "db1"; - scoped_refptr<CannedBrowsingDataDatabaseHelper> helper = - new CannedBrowsingDataDatabaseHelper(&profile); + scoped_refptr<CannedBrowsingDataDatabaseHelper> helper( + new CannedBrowsingDataDatabaseHelper(&profile)); ASSERT_TRUE(helper->empty()); helper->AddDatabase(origin, db, ""); diff --git a/chrome/browser/browsing_data_local_storage_helper_unittest.cc b/chrome/browser/browsing_data_local_storage_helper_unittest.cc index fe110c3..6fbb1ee 100644 --- a/chrome/browser/browsing_data_local_storage_helper_unittest.cc +++ b/chrome/browser/browsing_data_local_storage_helper_unittest.cc @@ -45,8 +45,8 @@ TEST(CannedBrowsingDataLocalStorageTest, AddLocalStorage) { const FilePath::CharType file2[] = FILE_PATH_LITERAL("http_host2_1.localstorage"); - scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper = - new CannedBrowsingDataLocalStorageHelper(&profile); + scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper( + new CannedBrowsingDataLocalStorageHelper(&profile)); helper->AddLocalStorage(origin1); helper->AddLocalStorage(origin2); @@ -70,8 +70,8 @@ TEST(CannedBrowsingDataLocalStorageTest, Unique) { const FilePath::CharType file[] = FILE_PATH_LITERAL("http_host1_1.localstorage"); - scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper = - new CannedBrowsingDataLocalStorageHelper(&profile); + scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper( + new CannedBrowsingDataLocalStorageHelper(&profile)); helper->AddLocalStorage(origin); helper->AddLocalStorage(origin); @@ -92,8 +92,8 @@ TEST(CannedBrowsingDataLocalStorageTest, Empty) { const GURL origin("http://host1:1/"); - scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper = - new CannedBrowsingDataLocalStorageHelper(&profile); + scoped_refptr<CannedBrowsingDataLocalStorageHelper> helper( + new CannedBrowsingDataLocalStorageHelper(&profile)); ASSERT_TRUE(helper->empty()); helper->AddLocalStorage(origin); diff --git a/chrome/browser/cocoa/first_run_dialog.mm b/chrome/browser/cocoa/first_run_dialog.mm index 7f72bb4..5b97bde 100644 --- a/chrome/browser/cocoa/first_run_dialog.mm +++ b/chrome/browser/cocoa/first_run_dialog.mm @@ -77,7 +77,7 @@ void FirstRunShowBridge::ShowDialog() { // -[NSApplication runModalForWindow:] we will hang <http://crbug.com/54248>. // Therefore the main MessageLoop is run so things work. - scoped_refptr<FirstRunShowBridge> bridge = new FirstRunShowBridge(self); + scoped_refptr<FirstRunShowBridge> bridge(new FirstRunShowBridge(self)); MessageLoop::current()->PostTask( FROM_HERE, NewRunnableMethod(bridge.get(), diff --git a/chrome/browser/cocoa/web_drag_source.mm b/chrome/browser/cocoa/web_drag_source.mm index a2402da..95ab0d1 100644 --- a/chrome/browser/cocoa/web_drag_source.mm +++ b/chrome/browser/cocoa/web_drag_source.mm @@ -307,13 +307,13 @@ void PromiseWriterTask::Run() { if (downloadURL_.is_valid()) { TabContents* tabContents = [contentsView_ tabContents]; - scoped_refptr<DragDownloadFile> dragFileDownloader = new DragDownloadFile( + scoped_refptr<DragDownloadFile> dragFileDownloader(new DragDownloadFile( filePath, linked_ptr<net::FileStream>(fileStream), downloadURL_, tabContents->GetURL(), tabContents->encoding(), - tabContents); + tabContents)); // The finalizer will take care of closing and deletion. dragFileDownloader->Start( diff --git a/chrome/browser/debugger/devtools_manager_unittest.cc b/chrome/browser/debugger/devtools_manager_unittest.cc index ddcc54f..a66b986 100644 --- a/chrome/browser/debugger/devtools_manager_unittest.cc +++ b/chrome/browser/debugger/devtools_manager_unittest.cc @@ -71,7 +71,7 @@ class DevToolsManagerTest : public RenderViewHostTestHarness { }; TEST_F(DevToolsManagerTest, OpenAndManuallyCloseDevToolsClientHost) { - scoped_refptr<DevToolsManager> manager = new DevToolsManager(); + scoped_refptr<DevToolsManager> manager(new DevToolsManager()); DevToolsClientHost* host = manager->GetDevToolsClientHostFor(rvh()); EXPECT_TRUE(NULL == host); @@ -95,7 +95,7 @@ TEST_F(DevToolsManagerTest, OpenAndManuallyCloseDevToolsClientHost) { } TEST_F(DevToolsManagerTest, ForwardMessageToClient) { - scoped_refptr<DevToolsManager> manager = new DevToolsManager(); + scoped_refptr<DevToolsManager> manager(new DevToolsManager()); TestDevToolsClientHost client_host; manager->RegisterDevToolsClientHostFor(rvh(), &client_host); diff --git a/chrome/browser/debugger/devtools_netlog_observer.cc b/chrome/browser/debugger/devtools_netlog_observer.cc index 776cc9f..83a7fbb 100644 --- a/chrome/browser/debugger/devtools_netlog_observer.cc +++ b/chrome/browser/debugger/devtools_netlog_observer.cc @@ -53,7 +53,7 @@ void DevToolsNetLogObserver::OnAddEntry(net::NetLog::EventType type, "larger than expected, resetting"; request_to_info_.clear(); } - scoped_refptr<ResourceInfo> new_record = new ResourceInfo(); + scoped_refptr<ResourceInfo> new_record(new ResourceInfo()); request_to_info_.insert(std::make_pair(source.id, new_record)); return; } diff --git a/chrome/browser/debugger/devtools_remote_listen_socket.cc b/chrome/browser/debugger/devtools_remote_listen_socket.cc index bce2ba4..8ea1821 100644 --- a/chrome/browser/debugger/devtools_remote_listen_socket.cc +++ b/chrome/browser/debugger/devtools_remote_listen_socket.cc @@ -209,9 +209,9 @@ void DevToolsRemoteListenSocket::HandleMessage() { void DevToolsRemoteListenSocket::Accept() { SOCKET conn = ListenSocket::Accept(socket_); if (conn != INVALID_SOCKET) { - scoped_refptr<DevToolsRemoteListenSocket> sock = + scoped_refptr<DevToolsRemoteListenSocket> sock( new DevToolsRemoteListenSocket(conn, - message_listener_); + message_listener_)); // 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/chrome/browser/device_orientation/device_orientation_browsertest.cc b/chrome/browser/device_orientation/device_orientation_browsertest.cc index d33f5d3..6fe92ea 100644 --- a/chrome/browser/device_orientation/device_orientation_browsertest.cc +++ b/chrome/browser/device_orientation/device_orientation_browsertest.cc @@ -49,7 +49,7 @@ class DeviceOrientationBrowserTest : public InProcessBrowserTest { IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) { const Orientation kTestOrientation(true, 1, true, 2, true, 3); - scoped_refptr<MockProvider> provider = new MockProvider(kTestOrientation); + scoped_refptr<MockProvider> provider(new MockProvider(kTestOrientation)); Provider::SetInstanceForTests(provider.get()); // The test page will register an event handler for orientation events, diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.cc b/chrome/browser/dom_ui/chrome_url_data_manager.cc index dfa7785..b793ed8 100644 --- a/chrome/browser/dom_ui/chrome_url_data_manager.cc +++ b/chrome/browser/dom_ui/chrome_url_data_manager.cc @@ -269,7 +269,7 @@ void ChromeURLDataManager::DataAvailable( if (i != pending_requests_.end()) { // We acquire a reference to the job so that it doesn't disappear under the // feet of any method invoked here (we could trigger a callback). - scoped_refptr<URLRequestChromeJob> job = i->second; + scoped_refptr<URLRequestChromeJob> job(i->second); pending_requests_.erase(i); job->DataAvailable(bytes); } diff --git a/chrome/browser/dom_ui/dom_ui_factory.cc b/chrome/browser/dom_ui/dom_ui_factory.cc index aaeb4e3..cb2e30d 100644 --- a/chrome/browser/dom_ui/dom_ui_factory.cc +++ b/chrome/browser/dom_ui/dom_ui_factory.cc @@ -242,8 +242,8 @@ void DOMUIFactory::GetFaviconForURL(Profile* profile, page_url.host() != extension_misc::kBookmarkManagerId) { ExtensionDOMUI::GetFaviconForURL(profile, request, page_url); } else { - scoped_refptr<RefCountedMemory> icon_data = - DOMUIFactory::GetFaviconResourceBytes(profile, page_url); + scoped_refptr<RefCountedMemory> icon_data( + DOMUIFactory::GetFaviconResourceBytes(profile, page_url)); bool know_icon = icon_data.get() != NULL && icon_data->size() > 0; request->ForwardResultAsync( FaviconService::FaviconDataCallback::TupleType(request->handle(), diff --git a/chrome/browser/dom_ui/fileicon_source.cc b/chrome/browser/dom_ui/fileicon_source.cc index 599c755..7572cdc 100644 --- a/chrome/browser/dom_ui/fileicon_source.cc +++ b/chrome/browser/dom_ui/fileicon_source.cc @@ -43,7 +43,7 @@ void FileIconSource::StartDataRequest(const std::string& path, SkBitmap* icon = im->LookupIcon(escaped_filepath, IconLoader::NORMAL); if (icon) { - scoped_refptr<RefCountedBytes> icon_data = new RefCountedBytes; + scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes); gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data); SendResponse(request_id, icon_data); @@ -65,7 +65,7 @@ void FileIconSource::OnFileIconDataAvailable(IconManager::Handle handle, int request_id = cancelable_consumer_.GetClientData(im, handle); if (icon) { - scoped_refptr<RefCountedBytes> icon_data = new RefCountedBytes; + scoped_refptr<RefCountedBytes> icon_data(new RefCountedBytes); gfx::PNGCodec::EncodeBGRASkBitmap(*icon, false, &icon_data->data); SendResponse(request_id, icon_data); diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc index b7471b7..a662102 100644 --- a/chrome/browser/dom_ui/new_tab_ui.cc +++ b/chrome/browser/dom_ui/new_tab_ui.cc @@ -627,8 +627,8 @@ void NewTabUI::NewTabHTMLSource::StartDataRequest(const std::string& path, return; } - scoped_refptr<RefCountedBytes> html_bytes = - profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record); + scoped_refptr<RefCountedBytes> html_bytes( + profile_->GetNTPResourceCache()->GetNewTabHTML(is_off_the_record)); SendResponse(request_id, html_bytes); } diff --git a/chrome/browser/extensions/extension_process_manager.cc b/chrome/browser/extensions/extension_process_manager.cc index 12ff5c0..c4e0799 100644 --- a/chrome/browser/extensions/extension_process_manager.cc +++ b/chrome/browser/extensions/extension_process_manager.cc @@ -254,8 +254,8 @@ RenderProcessHost* ExtensionProcessManager::GetExtensionProcess( const GURL& url) { if (!browsing_instance_->HasSiteInstance(url)) return NULL; - scoped_refptr<SiteInstance> site = - browsing_instance_->GetSiteInstanceForURL(url); + scoped_refptr<SiteInstance> site( + browsing_instance_->GetSiteInstanceForURL(url)); if (site->HasProcess()) return site->GetProcess(); return NULL; diff --git a/chrome/browser/extensions/extension_updater.cc b/chrome/browser/extensions/extension_updater.cc index df19489..3c678e5 100644 --- a/chrome/browser/extensions/extension_updater.cc +++ b/chrome/browser/extensions/extension_updater.cc @@ -518,8 +518,8 @@ void ExtensionUpdater::OnManifestFetchComplete(const GURL& url, // We want to try parsing the manifest, and if it indicates updates are // available, we want to fire off requests to fetch those updates. if (status.status() == URLRequestStatus::SUCCESS && response_code == 200) { - scoped_refptr<SafeManifestParser> safe_parser = - new SafeManifestParser(data, current_manifest_fetch_.release(), this); + scoped_refptr<SafeManifestParser> safe_parser( + new SafeManifestParser(data, current_manifest_fetch_.release(), this)); safe_parser->Start(); } else { // TODO(asargent) Do exponential backoff here. (http://crbug.com/12546). diff --git a/chrome/browser/extensions/extension_updater_unittest.cc b/chrome/browser/extensions/extension_updater_unittest.cc index 581be2b..ed96b0d 100644 --- a/chrome/browser/extensions/extension_updater_unittest.cc +++ b/chrome/browser/extensions/extension_updater_unittest.cc @@ -308,8 +308,8 @@ class ExtensionUpdaterTest : public testing::Test { TestURLFetcherFactory factory; URLFetcher::set_factory(&factory); - scoped_refptr<ExtensionUpdater> updater = - new ExtensionUpdater(&service, service.pref_service(), 60*60*24); + scoped_refptr<ExtensionUpdater> updater( + new ExtensionUpdater(&service, service.pref_service(), 60*60*24)); updater->Start(); // Tell the update that it's time to do update checks. @@ -356,8 +356,8 @@ class ExtensionUpdaterTest : public testing::Test { TestURLFetcherFactory factory; URLFetcher::set_factory(&factory); - scoped_refptr<ExtensionUpdater> updater = - new ExtensionUpdater(&service, service.pref_service(), 60*60*24); + scoped_refptr<ExtensionUpdater> updater( + new ExtensionUpdater(&service, service.pref_service(), 60*60*24)); updater->Start(); // Tell the updater that it's time to do update checks. @@ -408,9 +408,9 @@ class ExtensionUpdaterTest : public testing::Test { service.set_extensions(tmp); MessageLoop message_loop; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); // Check passing an empty list of parse results to DetermineUpdates ManifestFetchData fetch_data(GURL("http://localhost/foo")); @@ -445,9 +445,9 @@ class ExtensionUpdaterTest : public testing::Test { service.set_pending_extensions(pending_extensions); MessageLoop message_loop; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); ManifestFetchData fetch_data(GURL("http://localhost/foo")); UpdateManifest::Results updates; @@ -479,9 +479,9 @@ class ExtensionUpdaterTest : public testing::Test { TestURLFetcher* fetcher = NULL; URLFetcher::set_factory(&factory); ServiceForDownloadTests service; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); GURL url1("http://localhost/manifest1"); GURL url2("http://localhost/manifest2"); @@ -543,9 +543,9 @@ class ExtensionUpdaterTest : public testing::Test { TestURLFetcher* fetcher = NULL; URLFetcher::set_factory(&factory); ServiceForDownloadTests service; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); GURL test_url("http://localhost/extension.crx"); @@ -606,9 +606,9 @@ class ExtensionUpdaterTest : public testing::Test { TestURLFetcher* fetcher = NULL; URLFetcher::set_factory(&factory); ServiceForBlacklistTests service; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); service.pref_service()-> RegisterStringPref(prefs::kExtensionBlacklistUpdateVersion, "0"); GURL test_url("http://localhost/extension.crx"); @@ -653,9 +653,9 @@ class ExtensionUpdaterTest : public testing::Test { TestURLFetcher* fetcher = NULL; URLFetcher::set_factory(&factory); ServiceForDownloadTests service; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); GURL url1("http://localhost/extension1.crx"); GURL url2("http://localhost/extension2.crx"); @@ -740,9 +740,9 @@ class ExtensionUpdaterTest : public testing::Test { } MessageLoop message_loop; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); updater->set_blacklist_checks_enabled(false); // Make the updater do manifest fetching, and note the urls it tries to @@ -792,9 +792,9 @@ class ExtensionUpdaterTest : public testing::Test { // >= 1 day for the extension. static void TestHandleManifestResults() { ServiceForManifestTests service; - scoped_refptr<ExtensionUpdater> updater = + scoped_refptr<ExtensionUpdater> updater( new ExtensionUpdater(&service, service.pref_service(), - kUpdateFrequencySecs); + kUpdateFrequencySecs)); GURL update_url("http://www.google.com/manifest"); ExtensionList tmp; diff --git a/chrome/browser/extensions/extensions_service.cc b/chrome/browser/extensions/extensions_service.cc index 5c81670..4b5b2c1 100644 --- a/chrome/browser/extensions/extensions_service.cc +++ b/chrome/browser/extensions/extensions_service.cc @@ -295,11 +295,11 @@ void ExtensionsServiceBackend::LoadSingleExtension( file_util::AbsolutePath(&extension_path); std::string error; - scoped_refptr<const Extension> extension = extension_file_util::LoadExtension( + scoped_refptr<const Extension> extension(extension_file_util::LoadExtension( extension_path, Extension::LOAD, false, // Don't require id - &error); + &error)); if (!extension) { ReportExtensionLoadError(extension_path, error); diff --git a/chrome/browser/extensions/extensions_startup.cc b/chrome/browser/extensions/extensions_startup.cc index 1286179..9faeac6 100644 --- a/chrome/browser/extensions/extensions_startup.cc +++ b/chrome/browser/extensions/extensions_startup.cc @@ -83,8 +83,8 @@ bool HandlePackExtension(const CommandLine& cmd_line) { // Launch a job to perform the packing on the file thread. PackExtensionLogger pack_client; - scoped_refptr<PackExtensionJob> pack_job = - new PackExtensionJob(&pack_client, src_dir, private_key_path); + scoped_refptr<PackExtensionJob> pack_job( + new PackExtensionJob(&pack_client, src_dir, private_key_path)); pack_job->Start(); // The job will post a notification task to the current thread's message diff --git a/chrome/browser/first_run/first_run.cc b/chrome/browser/first_run/first_run.cc index 54f030e..525c091 100644 --- a/chrome/browser/first_run/first_run.cc +++ b/chrome/browser/first_run/first_run.cc @@ -405,7 +405,7 @@ int FirstRun::ImportFromFile(Profile* profile, const CommandLine& cmdline) { NOTREACHED(); return false; } - scoped_refptr<ImporterHost> importer_host = new ImporterHost(); + scoped_refptr<ImporterHost> importer_host(new ImporterHost()); FirstRunImportObserver observer; importer_host->set_headless(); diff --git a/chrome/browser/geolocation/access_token_store.cc b/chrome/browser/geolocation/access_token_store.cc index af76e54..9b4eea7 100644 --- a/chrome/browser/geolocation/access_token_store.cc +++ b/chrome/browser/geolocation/access_token_store.cc @@ -94,8 +94,8 @@ void AccessTokenStore::RegisterPrefs(PrefService* prefs) { AccessTokenStore::Handle AccessTokenStore::LoadAccessTokens( CancelableRequestConsumerBase* consumer, LoadAccessTokensCallbackType* callback) { - scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request = - new CancelableRequest<LoadAccessTokensCallbackType>(callback); + scoped_refptr<CancelableRequest<LoadAccessTokensCallbackType> > request( + new CancelableRequest<LoadAccessTokensCallbackType>(callback)); AddRequest(request, consumer); DCHECK(request->handle()); diff --git a/chrome/browser/geolocation/access_token_store_browsertest.cc b/chrome/browser/geolocation/access_token_store_browsertest.cc index b4449e5..802d16d 100644 --- a/chrome/browser/geolocation/access_token_store_browsertest.cc +++ b/chrome/browser/geolocation/access_token_store_browsertest.cc @@ -57,7 +57,7 @@ struct TokenLoadClientForTest { void RunCancelTestInClientTread() { ASSERT_TRUE(BrowserThread::CurrentlyOn(kExpectedClientThreadId)); - scoped_refptr<AccessTokenStore> store = NewChromePrefsAccessTokenStore(); + scoped_refptr<AccessTokenStore> store(NewChromePrefsAccessTokenStore()); CancelableRequestConsumer consumer; TokenLoadClientForTest load_client; @@ -117,8 +117,8 @@ void GeolocationAccessTokenStoreTest::OnAccessTokenStoresLoaded( } if (token_to_set_) { - scoped_refptr<AccessTokenStore> store = - NewChromePrefsAccessTokenStore(); + scoped_refptr<AccessTokenStore> store( + NewChromePrefsAccessTokenStore()); store->SaveAccessToken(ref_url_, *token_to_set_); } BrowserThread::PostTask( diff --git a/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc index f24a403..68bc752 100644 --- a/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc +++ b/chrome/browser/geolocation/geolocation_exceptions_table_model_unittest.cc @@ -40,8 +40,8 @@ class GeolocationExceptionsTableModelTest : public RenderViewHostTestHarness { } void CreateAllowedSamples() { - scoped_refptr<GeolocationContentSettingsMap> map = - profile()->GetGeolocationContentSettingsMap(); + scoped_refptr<GeolocationContentSettingsMap> map( + profile()->GetGeolocationContentSettingsMap()); map->SetContentSetting(kUrl0, kUrl0, CONTENT_SETTING_ALLOW); map->SetContentSetting(kUrl0, kUrl1, CONTENT_SETTING_ALLOW); map->SetContentSetting(kUrl0, kUrl2, CONTENT_SETTING_ALLOW); @@ -57,8 +57,8 @@ class GeolocationExceptionsTableModelTest : public RenderViewHostTestHarness { TEST_F(GeolocationExceptionsTableModelTest, CanRemoveException) { EXPECT_EQ(0, model_->RowCount()); - scoped_refptr<GeolocationContentSettingsMap> map = - profile()->GetGeolocationContentSettingsMap(); + scoped_refptr<GeolocationContentSettingsMap> map( + profile()->GetGeolocationContentSettingsMap()); // Ensure a single entry can be removed. map->SetContentSetting(kUrl0, kUrl0, CONTENT_SETTING_ALLOW); @@ -86,8 +86,8 @@ TEST_F(GeolocationExceptionsTableModelTest, CanRemoveException) { TEST_F(GeolocationExceptionsTableModelTest, RemoveExceptions) { CreateAllowedSamples(); - scoped_refptr<GeolocationContentSettingsMap> map = - profile()->GetGeolocationContentSettingsMap(); + scoped_refptr<GeolocationContentSettingsMap> map( + profile()->GetGeolocationContentSettingsMap()); // Test removing parent exception. GeolocationExceptionsTableModel::Rows rows; @@ -113,8 +113,8 @@ TEST_F(GeolocationExceptionsTableModelTest, RemoveExceptions) { TEST_F(GeolocationExceptionsTableModelTest, RemoveAll) { CreateAllowedSamples(); - scoped_refptr<GeolocationContentSettingsMap> map = - profile()->GetGeolocationContentSettingsMap(); + scoped_refptr<GeolocationContentSettingsMap> map( + profile()->GetGeolocationContentSettingsMap()); model_->RemoveAll(); EXPECT_EQ(CONTENT_SETTING_ASK, map->GetContentSetting(kUrl0, kUrl0)); diff --git a/chrome/browser/host_content_settings_map_unittest.cc b/chrome/browser/host_content_settings_map_unittest.cc index ea829d4..b5c74a0 100644 --- a/chrome/browser/host_content_settings_map_unittest.cc +++ b/chrome/browser/host_content_settings_map_unittest.cc @@ -527,8 +527,8 @@ TEST_F(HostContentSettingsMapTest, OffTheRecord) { HostContentSettingsMap* host_content_settings_map = profile.GetHostContentSettingsMap(); profile.set_off_the_record(true); - scoped_refptr<HostContentSettingsMap> otr_map = - new HostContentSettingsMap(&profile); + scoped_refptr<HostContentSettingsMap> otr_map( + new HostContentSettingsMap(&profile)); profile.set_off_the_record(false); GURL host("http://example.com/"); diff --git a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc index e35f7a7..fbe3d3d 100644 --- a/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc +++ b/chrome/browser/importer/firefox_importer_unittest_utils_mac.cc @@ -178,8 +178,8 @@ bool FFUnitTestDecryptorProxy::WaitForClientResponse() { // the future and cancel it if an RPC message comes back earlier. // This relies on the IPC listener class to quit the message loop itself when // a message comes in. - scoped_refptr<CancellableQuitMsgLoop> quit_task = - new CancellableQuitMsgLoop(); + scoped_refptr<CancellableQuitMsgLoop> quit_task( + new CancellableQuitMsgLoop()); MessageLoop::current()->PostDelayedTask( FROM_HERE, NewRunnableMethod(quit_task.get(), &CancellableQuitMsgLoop::QuitNow), diff --git a/chrome/browser/importer/importer_unittest.cc b/chrome/browser/importer/importer_unittest.cc index 2bad8ee..5261c03 100644 --- a/chrome/browser/importer/importer_unittest.cc +++ b/chrome/browser/importer/importer_unittest.cc @@ -115,7 +115,7 @@ class ImporterTest : public testing::Test { profile_info.browser_type = FIREFOX3; profile_info.app_path = app_path_; profile_info.source_path = profile_path_; - scoped_refptr<ImporterHost> host = new ImporterHost(); + scoped_refptr<ImporterHost> host(new ImporterHost()); host->SetObserver(observer); int items = HISTORY | PASSWORDS | FAVORITES; if (import_search_plugins) @@ -697,7 +697,7 @@ TEST_F(ImporterTest, MAYBE(Firefox2Importer)) { ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); MessageLoop* loop = MessageLoop::current(); - scoped_refptr<ImporterHost> host = new ImporterHost(); + scoped_refptr<ImporterHost> host(new ImporterHost()); FirefoxObserver* observer = new FirefoxObserver(); host->SetObserver(observer); ProfileInfo profile_info; @@ -880,15 +880,15 @@ class Firefox3Observer : public ProfileWriter, }; TEST_F(ImporterTest, MAYBE(Firefox30Importer)) { - scoped_refptr<Firefox3Observer> observer = new Firefox3Observer(); + scoped_refptr<Firefox3Observer> observer(new Firefox3Observer()); Firefox3xImporterTest("firefox3_profile", observer.get(), observer.get(), true); } TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { bool import_search_engines = false; - scoped_refptr<Firefox3Observer> observer = - new Firefox3Observer(import_search_engines); + scoped_refptr<Firefox3Observer> observer( + new Firefox3Observer(import_search_engines)); Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), import_search_engines); } diff --git a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc index eb696ac4..365c91c 100644 --- a/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc +++ b/chrome/browser/in_process_webkit/browser_webkitclient_impl.cc @@ -1,6 +1,6 @@ -// Copyright (c) 2009 The Chromium Authors. All rights reserved. Use of this -// source code is governed by a BSD-style license that can be found in the -// LICENSE file. +// Copyright (c) 2010 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. #include "chrome/browser/in_process_webkit/browser_webkitclient_impl.h" @@ -150,8 +150,8 @@ void BrowserWebKitClientImpl::createIDBKeysFromSerializedValuesAndKeyPath( WebKit::WebVector<WebKit::WebIDBKey>& keys) { // TODO(bulach): we need to figure out a way to keep the utility process // running for longer, and shut it down when no longer used. - scoped_refptr<IndexedDBKeyUtilityClient> indexed_db_key_utility_client = - new IndexedDBKeyUtilityClient(); + scoped_refptr<IndexedDBKeyUtilityClient> indexed_db_key_utility_client( + new IndexedDBKeyUtilityClient()); indexed_db_key_utility_client->StartUtilityProcess(); std::vector<SerializedScriptValue> std_values; diff --git a/chrome/browser/io_thread.cc b/chrome/browser/io_thread.cc index 3c7fdc6..55713b7 100644 --- a/chrome/browser/io_thread.cc +++ b/chrome/browser/io_thread.cc @@ -62,8 +62,8 @@ net::HostResolver* CreateGlobalHostResolver(net::NetLog* net_log) { // For each option (i.e., non-default), we have a fixed probability. base::FieldTrial::Probability kProbabilityPerGroup = 100; // 10%. - scoped_refptr<base::FieldTrial> trial = - new base::FieldTrial("DnsParallelism", kDivisor); + scoped_refptr<base::FieldTrial> trial( + new base::FieldTrial("DnsParallelism", kDivisor)); // List options with different counts. // Firefox limits total to 8 in parallel, and default is currently 50. diff --git a/chrome/browser/metrics/metrics_service.cc b/chrome/browser/metrics/metrics_service.cc index 1ddc987..9cafefc 100644 --- a/chrome/browser/metrics/metrics_service.cc +++ b/chrome/browser/metrics/metrics_service.cc @@ -970,7 +970,7 @@ void MetricsService::LogTransmissionTimerDone() { Task* task = log_sender_factory_. NewRunnableMethod(&MetricsService::OnMemoryDetailCollectionDone); - scoped_refptr<MetricsMemoryDetails> details = new MetricsMemoryDetails(task); + scoped_refptr<MetricsMemoryDetails> details(new MetricsMemoryDetails(task)); details->StartFetch(); // Collect WebCore cache information to put into a histogram. diff --git a/chrome/browser/net/connection_tester.cc b/chrome/browser/net/connection_tester.cc index 889494d..8f762ef 100644 --- a/chrome/browser/net/connection_tester.cc +++ b/chrome/browser/net/connection_tester.cc @@ -277,8 +277,8 @@ void ConnectionTester::TestRunner::OnReadCompleted(URLRequest* request, void ConnectionTester::TestRunner::ReadBody(URLRequest* request) { // Read the response body |kReadBufferSize| bytes at a time. - scoped_refptr<net::IOBuffer> unused_buffer = - new net::IOBuffer(kReadBufferSize); + scoped_refptr<net::IOBuffer> unused_buffer( + new net::IOBuffer(kReadBufferSize)); int num_bytes; if (request->Read(unused_buffer, kReadBufferSize, &num_bytes)) { OnReadCompleted(request, num_bytes); @@ -299,8 +299,8 @@ void ConnectionTester::TestRunner::OnResponseCompleted(URLRequest* request) { void ConnectionTester::TestRunner::Run(const Experiment& experiment) { // Try to create a URLRequestContext for this experiment. - scoped_refptr<ExperimentURLRequestContext> context = - new ExperimentURLRequestContext(tester_->io_thread_); + scoped_refptr<ExperimentURLRequestContext> context( + new ExperimentURLRequestContext(tester_->io_thread_)); int rv = context->Init(experiment); if (rv != net::OK) { // Complete the experiment with a failure. diff --git a/chrome/browser/net/connection_tester_unittest.cc b/chrome/browser/net/connection_tester_unittest.cc index fe6e8cc..4191484 100644 --- a/chrome/browser/net/connection_tester_unittest.cc +++ b/chrome/browser/net/connection_tester_unittest.cc @@ -76,8 +76,8 @@ class ConnectionTesterTest : public PlatformTest { : test_server_(net::TestServer::TYPE_HTTP, FilePath(FILE_PATH_LITERAL("net/data/url_request_unittest"))), message_loop_(MessageLoop::TYPE_IO) { - scoped_refptr<net::RuleBasedHostResolverProc> catchall_resolver = - new net::RuleBasedHostResolverProc(NULL); + scoped_refptr<net::RuleBasedHostResolverProc> catchall_resolver( + new net::RuleBasedHostResolverProc(NULL)); catchall_resolver->AddRule("*", "127.0.0.1"); diff --git a/chrome/browser/net/predictor_unittest.cc b/chrome/browser/net/predictor_unittest.cc index 38f0281..bbc798e 100644 --- a/chrome/browser/net/predictor_unittest.cc +++ b/chrome/browser/net/predictor_unittest.cc @@ -109,25 +109,25 @@ class PredictorTest : public testing::Test { //------------------------------------------------------------------------------ TEST_F(PredictorTest, StartupShutdownTest) { - scoped_refptr<Predictor> testing_master = + scoped_refptr<Predictor> testing_master( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); testing_master->Shutdown(); } TEST_F(PredictorTest, ShutdownWhenResolutionIsPendingTest) { - scoped_refptr<net::WaitingHostResolverProc> resolver_proc = - new net::WaitingHostResolverProc(NULL); + scoped_refptr<net::WaitingHostResolverProc> resolver_proc( + new net::WaitingHostResolverProc(NULL)); host_resolver_->Reset(resolver_proc); - scoped_refptr<Predictor> testing_master = + scoped_refptr<Predictor> testing_master( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); GURL localhost("http://localhost:80"); UrlList names; @@ -149,11 +149,11 @@ TEST_F(PredictorTest, ShutdownWhenResolutionIsPendingTest) { } TEST_F(PredictorTest, SingleLookupTest) { - scoped_refptr<Predictor> testing_master = + scoped_refptr<Predictor> testing_master( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); GURL goog("http://www.google.com:80"); @@ -181,11 +181,11 @@ TEST_F(PredictorTest, SingleLookupTest) { TEST_F(PredictorTest, ConcurrentLookupTest) { host_resolver_->rules()->AddSimulatedFailure("*.notfound"); - scoped_refptr<Predictor> testing_master = + scoped_refptr<Predictor> testing_master( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); GURL goog("http://www.google.com:80"), goog2("http://gmail.google.com.com:80"), @@ -231,11 +231,11 @@ TEST_F(PredictorTest, ConcurrentLookupTest) { TEST_F(PredictorTest, MassiveConcurrentLookupTest) { host_resolver_->rules()->AddSimulatedFailure("*.notfound"); - scoped_refptr<Predictor> testing_master = + scoped_refptr<Predictor> testing_master( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); UrlList names; for (int i = 0; i < 100; i++) @@ -351,11 +351,11 @@ static bool GetDataFromSerialization(const GURL& motivation, // Make sure nil referral lists really have no entries, and no latency listed. TEST_F(PredictorTest, ReferrerSerializationNilTest) { - scoped_refptr<Predictor> predictor = + scoped_refptr<Predictor> predictor( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); scoped_ptr<ListValue> referral_list(NewEmptySerializationList()); predictor->SerializeReferrers(referral_list.get()); EXPECT_EQ(1U, referral_list->GetSize()); @@ -370,11 +370,11 @@ TEST_F(PredictorTest, ReferrerSerializationNilTest) { // deserialized into the database, and can be extracted back out via // serialization without being changed. TEST_F(PredictorTest, ReferrerSerializationSingleReferrerTest) { - scoped_refptr<Predictor> predictor = + scoped_refptr<Predictor> predictor( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); const GURL motivation_url("http://www.google.com:91"); const GURL subresource_url("http://icons.google.com:90"); const double kUseRate = 23.4; @@ -398,11 +398,11 @@ TEST_F(PredictorTest, ReferrerSerializationSingleReferrerTest) { // Make sure the Trim() functionality works as expected. TEST_F(PredictorTest, ReferrerSerializationTrimTest) { - scoped_refptr<Predictor> predictor = + scoped_refptr<Predictor> predictor( new Predictor(host_resolver_.get(), default_max_queueing_delay_, PredictorInit::kMaxSpeculativeParallelResolves, - false); + false)); GURL motivation_url("http://www.google.com:110"); GURL icon_subresource_url("http://icons.google.com:111"); diff --git a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc index 9c0ab55..fd5088b 100644 --- a/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc +++ b/chrome/browser/net/websocket_experiment/websocket_experiment_runner.cc @@ -28,8 +28,8 @@ static scoped_refptr<WebSocketExperimentRunner> runner; void WebSocketExperimentRunner::Start() { DCHECK(!runner.get()); - scoped_refptr<base::FieldTrial> trial = - new base::FieldTrial("WebSocketExperiment", 1000); + scoped_refptr<base::FieldTrial> trial( + new base::FieldTrial("WebSocketExperiment", 1000)); trial->AppendGroup("active", 5); // 0.5% in active group. bool run_experiment = diff --git a/chrome/browser/renderer_host/browser_render_process_host.cc b/chrome/browser/renderer_host/browser_render_process_host.cc index 47b0b8b..cb451c3 100644 --- a/chrome/browser/renderer_host/browser_render_process_host.cc +++ b/chrome/browser/renderer_host/browser_render_process_host.cc @@ -297,14 +297,14 @@ bool BrowserRenderProcessHost::Init( // Construct the AudioRendererHost with the IO thread. audio_renderer_host_ = new AudioRendererHost(); - scoped_refptr<ResourceMessageFilter> resource_message_filter = + scoped_refptr<ResourceMessageFilter> resource_message_filter( new ResourceMessageFilter(g_browser_process->resource_dispatcher_host(), id(), audio_renderer_host_.get(), PluginService::GetInstance(), g_browser_process->print_job_manager(), profile(), - widget_helper_); + widget_helper_)); CommandLine::StringType renderer_prefix; #if defined(OS_POSIX) @@ -335,8 +335,8 @@ bool BrowserRenderProcessHost::Init( // be doing. channel_->set_sync_messages_with_no_timeout_allowed(false); - scoped_refptr<PepperFileMessageFilter> pepper_file_message_filter = - new PepperFileMessageFilter(id(), profile()); + scoped_refptr<PepperFileMessageFilter> pepper_file_message_filter( + new PepperFileMessageFilter(id(), profile())); channel_->AddFilter(pepper_file_message_filter); if (run_renderer_in_process()) { diff --git a/chrome/browser/renderer_host/resource_dispatcher_host.cc b/chrome/browser/renderer_host/resource_dispatcher_host.cc index b9d75b7..28252b8 100644 --- a/chrome/browser/renderer_host/resource_dispatcher_host.cc +++ b/chrome/browser/renderer_host/resource_dispatcher_host.cc @@ -707,7 +707,7 @@ void ResourceDispatcherHost::BeginDownload( request_id_--; - scoped_refptr<ResourceHandler> handler = + scoped_refptr<ResourceHandler> handler( new DownloadResourceHandler(this, child_id, route_id, @@ -716,7 +716,7 @@ void ResourceDispatcherHost::BeginDownload( download_file_manager_.get(), request, prompt_for_save_location, - save_info); + save_info)); if (safe_browsing_->enabled()) { handler = CreateSafeBrowsingResourceHandler(handler, child_id, route_id, @@ -757,11 +757,11 @@ void ResourceDispatcherHost::BeginSaveFile(const GURL& url, // requests. Does nothing if they are already loaded. PluginService::GetInstance()->LoadChromePlugins(this); - scoped_refptr<ResourceHandler> handler = + scoped_refptr<ResourceHandler> handler( new SaveFileResourceHandler(child_id, route_id, url, - save_file_manager_.get()); + save_file_manager_.get())); request_id_--; bool known_proto = URLRequest::IsHandledURL(url); @@ -1023,7 +1023,7 @@ void ResourceDispatcherHost::OnReceivedRedirect(URLRequest* request, return; } - scoped_refptr<ResourceResponse> response = new ResourceResponse; + scoped_refptr<ResourceResponse> response(new ResourceResponse); PopulateResourceResponse(request, info->replace_extension_localization_templates(), response); if (!info->resource_handler()->OnRequestRedirected(info->request_id(), @@ -1123,7 +1123,7 @@ void ResourceDispatcherHost::OnResponseStarted(URLRequest* request) { bool ResourceDispatcherHost::CompleteResponseStarted(URLRequest* request) { ResourceDispatcherHostRequestInfo* info = InfoForRequest(request); - scoped_refptr<ResourceResponse> response = new ResourceResponse; + scoped_refptr<ResourceResponse> response(new ResourceResponse); PopulateResourceResponse(request, info->replace_extension_localization_templates(), response); diff --git a/chrome/browser/renderer_host/resource_message_filter.cc b/chrome/browser/renderer_host/resource_message_filter.cc index d6334fd..adbe1cf 100644 --- a/chrome/browser/renderer_host/resource_message_filter.cc +++ b/chrome/browser/renderer_host/resource_message_filter.cc @@ -1478,7 +1478,7 @@ void ResourceMessageFilter::OnCacheableMetadataAvailable( http_transaction_factory()->GetCache(); DCHECK(cache); - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(data.size()); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(data.size())); memcpy(buf->data(), &data.front(), data.size()); cache->WriteMetadata( url, base::Time::FromDoubleT(expected_response_time), buf, data.size()); diff --git a/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc b/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc index 1c61bea..9e1cccc 100644 --- a/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc +++ b/chrome/browser/renderer_host/x509_user_cert_resource_handler.cc @@ -103,9 +103,9 @@ bool X509UserCertResourceHandler::OnResponseCompleted( // TODO(gauravsh): Verify that 'request_id' was actually a keygen form post // and only then import the certificate. AssembleResource(); - scoped_refptr<net::X509Certificate> cert = + scoped_refptr<net::X509Certificate> cert( net::X509Certificate::CreateFromBytes(resource_buffer_->data(), - content_length_); + content_length_)); // The handler will run the UI and delete itself when it's finished. new SSLAddCertHandler(request_, cert, render_process_host_id_, render_view_id_); diff --git a/chrome/browser/safe_browsing/bloom_filter_unittest.cc b/chrome/browser/safe_browsing/bloom_filter_unittest.cc index 1268e02..97c1558 100644 --- a/chrome/browser/safe_browsing/bloom_filter_unittest.cc +++ b/chrome/browser/safe_browsing/bloom_filter_unittest.cc @@ -30,8 +30,8 @@ TEST(SafeBrowsingBloomFilter, BloomFilterUse) { int count = 1000; // Build up the bloom filter. - scoped_refptr<BloomFilter> filter = - new BloomFilter(count * BloomFilter::kBloomFilterSizeRatio); + scoped_refptr<BloomFilter> filter( + new BloomFilter(count * BloomFilter::kBloomFilterSizeRatio)); typedef std::set<SBPrefix> Values; Values values; @@ -44,8 +44,8 @@ TEST(SafeBrowsingBloomFilter, BloomFilterUse) { // Check serialization works. char* data_copy = new char[filter->size()]; memcpy(data_copy, filter->data(), filter->size()); - scoped_refptr<BloomFilter> filter_copy = - new BloomFilter(data_copy, filter->size(), filter->hash_keys_); + scoped_refptr<BloomFilter> filter_copy( + new BloomFilter(data_copy, filter->size(), filter->hash_keys_)); // Check no false negatives by ensuring that every time we inserted exists. for (Values::const_iterator i = values.begin(); i != values.end(); ++i) @@ -82,8 +82,8 @@ TEST(SafeBrowsingBloomFilter, BloomFilterUse) { TEST(SafeBrowsingBloomFilter, BloomFilterFile) { // Create initial filter. const int kTestEntries = BloomFilter::kBloomFilterMinSize; - scoped_refptr<BloomFilter> filter_write = - new BloomFilter(kTestEntries * BloomFilter::kBloomFilterSizeRatio); + scoped_refptr<BloomFilter> filter_write( + new BloomFilter(kTestEntries * BloomFilter::kBloomFilterSizeRatio)); for (int i = 0; i < kTestEntries; ++i) filter_write->Insert(GenHash()); @@ -99,7 +99,7 @@ TEST(SafeBrowsingBloomFilter, BloomFilterFile) { // Create new empty filter and load from disk. BloomFilter* filter = BloomFilter::LoadFile(filter_path); ASSERT_TRUE(filter != NULL); - scoped_refptr<BloomFilter> filter_read = filter; + scoped_refptr<BloomFilter> filter_read(filter); // Check data consistency. EXPECT_EQ(filter_write->hash_keys_.size(), filter_read->hash_keys_.size()); diff --git a/chrome/browser/safe_browsing/safe_browsing_service.cc b/chrome/browser/safe_browsing/safe_browsing_service.cc index 592bf22..aac28cd 100644 --- a/chrome/browser/safe_browsing/safe_browsing_service.cc +++ b/chrome/browser/safe_browsing/safe_browsing_service.cc @@ -669,8 +669,8 @@ void SafeBrowsingService::Start() { } // We will issue network fetches using the default profile's request context. - scoped_refptr<URLRequestContextGetter> request_context_getter = - GetDefaultProfile()->GetRequestContext(); + scoped_refptr<URLRequestContextGetter> request_context_getter( + GetDefaultProfile()->GetRequestContext()); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, diff --git a/chrome/browser/safe_browsing/safe_browsing_test.cc b/chrome/browser/safe_browsing/safe_browsing_test.cc index 49b93ea..7af8454 100644 --- a/chrome/browser/safe_browsing/safe_browsing_test.cc +++ b/chrome/browser/safe_browsing/safe_browsing_test.cc @@ -526,8 +526,8 @@ IN_PROC_BROWSER_TEST_F(SafeBrowsingServiceTest, SafeBrowsingSystemTest) { int server_port = SafeBrowsingTestServer::Port(); ASSERT_TRUE(InitSafeBrowsingService()); - scoped_refptr<SafeBrowsingServiceTestHelper> safe_browsing_helper = - new SafeBrowsingServiceTestHelper(this); + scoped_refptr<SafeBrowsingServiceTestHelper> safe_browsing_helper( + new SafeBrowsingServiceTestHelper(this)); int last_step = 0; FilePath datafile_path = FilePath(kDataFile); SafeBrowsingTestServer test_server(datafile_path); diff --git a/chrome/browser/sessions/session_service.cc b/chrome/browser/sessions/session_service.cc index 9b2db65..1cf4493 100644 --- a/chrome/browser/sessions/session_service.cc +++ b/chrome/browser/sessions/session_service.cc @@ -417,9 +417,9 @@ SessionService::Handle SessionService::GetCurrentSession( if (pending_window_close_ids_.empty()) { // If there are no pending window closes, we can get the current session // from memory. - scoped_refptr<InternalSessionRequest> request = new InternalSessionRequest( + scoped_refptr<InternalSessionRequest> request(new InternalSessionRequest( NewCallback(this, &SessionService::OnGotSessionCommands), - callback); + callback)); AddRequest(request, consumer); IdToRange tab_to_available_range; std::set<SessionID::id_type> windows_to_track; diff --git a/chrome/browser/ssl/ssl_host_state_unittest.cc b/chrome/browser/ssl/ssl_host_state_unittest.cc index 32e89ed..e239f90 100644 --- a/chrome/browser/ssl/ssl_host_state_unittest.cc +++ b/chrome/browser/ssl/ssl_host_state_unittest.cc @@ -112,9 +112,9 @@ TEST_F(SSLHostStateTest, DidHostRunInsecureContent) { } TEST_F(SSLHostStateTest, QueryPolicy) { - scoped_refptr<net::X509Certificate> google_cert = + scoped_refptr<net::X509Certificate> google_cert( net::X509Certificate::CreateFromBytes( - reinterpret_cast<const char*>(google_der), sizeof(google_der)); + reinterpret_cast<const char*>(google_der), sizeof(google_der))); SSLHostState state; diff --git a/chrome/browser/ssl/ssl_manager.cc b/chrome/browser/ssl/ssl_manager.cc index c894a44..208a9d2 100644 --- a/chrome/browser/ssl/ssl_manager.cc +++ b/chrome/browser/ssl/ssl_manager.cc @@ -210,14 +210,14 @@ void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) { // caches sub-resources. // This resource must have been loaded with no filtering because filtered // resouces aren't cachable. - scoped_refptr<SSLRequestInfo> info = new SSLRequestInfo( + scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( details->url(), ResourceType::SUB_RESOURCE, details->frame_origin(), details->main_frame_origin(), details->pid(), details->ssl_cert_id(), - details->ssl_cert_status()); + details->ssl_cert_status())); // Simulate loading this resource through the usual path. policy()->OnRequestStarted(info.get()); @@ -226,14 +226,14 @@ void SSLManager::DidLoadFromMemoryCache(LoadFromMemoryCacheDetails* details) { void SSLManager::DidStartResourceResponse(ResourceRequestDetails* details) { DCHECK(details); - scoped_refptr<SSLRequestInfo> info = new SSLRequestInfo( + scoped_refptr<SSLRequestInfo> info(new SSLRequestInfo( details->url(), details->resource_type(), details->frame_origin(), details->main_frame_origin(), details->origin_child_id(), details->ssl_cert_id(), - details->ssl_cert_status()); + details->ssl_cert_status())); // Notify our policy that we started a resource request. Ideally, the // policy should have the ability to cancel the request, but we can't do diff --git a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc index 9c6a776..d0ede1a 100644 --- a/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc +++ b/chrome/browser/sync/glue/autofill_data_type_controller_unittest.cc @@ -191,8 +191,8 @@ TEST_F(AutofillDataTypeControllerTest, AbortWhileWDSStarting) { WillRepeatedly(Return(personal_data_manager_.get())); EXPECT_CALL(*(personal_data_manager_.get()), IsDataLoaded()). WillRepeatedly(Return(true)); - scoped_refptr<WebDataServiceFake> web_data_service_not_loaded = - new WebDataServiceFake(false); + scoped_refptr<WebDataServiceFake> web_data_service_not_loaded( + new WebDataServiceFake(false)); EXPECT_CALL(profile_, GetWebDataService(_)). WillOnce(Return(web_data_service_not_loaded.get())); autofill_dtc_->Start(NewCallback(&start_callback_, &StartCallback::Run)); diff --git a/chrome/browser/sync/glue/history_model_worker.cc b/chrome/browser/sync/glue/history_model_worker.cc index b6f3e5e..1c39501 100644 --- a/chrome/browser/sync/glue/history_model_worker.cc +++ b/chrome/browser/sync/glue/history_model_worker.cc @@ -46,7 +46,7 @@ HistoryModelWorker::~HistoryModelWorker() { void HistoryModelWorker::DoWorkAndWaitUntilDone(Callback0::Type* work) { WaitableEvent done(false, false); - scoped_refptr<WorkerTask> task = new WorkerTask(work, &done); + scoped_refptr<WorkerTask> task(new WorkerTask(work, &done)); history_service_->ScheduleDBTask(task.get(), this); done.Wait(); } diff --git a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc index 6a7c862..e8e4ec00 100644 --- a/chrome/browser/sync/profile_sync_service_autofill_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_autofill_unittest.cc @@ -790,7 +790,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddEntry) { AutofillChangeList changes; changes.push_back(AutofillChange(AutofillChange::ADD, added_entry.key())); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -820,7 +820,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfile) { AutofillProfileChange change(AutofillProfileChange::ADD, added_profile.Label(), &added_profile, string16()); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -872,7 +872,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeAddProfileConflict) { WillOnce(DoAll(SaveArg<0>(&relabelled_profile), Return(true))); EXPECT_CALL(*personal_data_manager_, Refresh()); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -911,7 +911,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateEntry) { AutofillChangeList changes; changes.push_back(AutofillChange(AutofillChange::UPDATE, updated_entry.key())); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -950,7 +950,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfile) { AutofillProfileChange change(AutofillProfileChange::UPDATE, update_profile.Label(), &update_profile, ASCIIToUTF16("Billing")); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -990,7 +990,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeUpdateProfileRelabel) { AutofillProfileChange change(AutofillProfileChange::UPDATE, update_profile.Label(), &update_profile, ASCIIToUTF16("Billing")); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -1049,7 +1049,7 @@ TEST_F(ProfileSyncServiceAutofillTest, AutofillProfileChange change(AutofillProfileChange::UPDATE, josephine_update.Label(), &josephine_update, josephine.Label()); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -1087,7 +1087,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveEntry) { AutofillChangeList changes; changes.push_back(AutofillChange(AutofillChange::REMOVE, original_entry.key())); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -1127,7 +1127,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeRemoveProfile) { AutofillProfileChange change(AutofillProfileChange::REMOVE, sync_profile.Label(), NULL, string16()); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_PROFILE_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillProfileChange>(&change)); @@ -1155,7 +1155,7 @@ TEST_F(ProfileSyncServiceAutofillTest, ProcessUserChangeError) { AutofillChangeList changes; changes.push_back(AutofillChange(AutofillChange::ADD, evil_entry.key())); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&db_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&db_thread_)); notifier->Notify(NotificationType::AUTOFILL_ENTRIES_CHANGED, Source<WebDataService>(web_data_service_.get()), Details<AutofillChangeList>(&changes)); @@ -1187,8 +1187,8 @@ TEST_F(ProfileSyncServiceAutofillTest, DISABLED_ServerChangeRace) { // (true, false) means we have to reset after |Signal|, init to unsignaled. scoped_ptr<WaitableEvent> wait_for_start(new WaitableEvent(true, false)); scoped_ptr<WaitableEvent> wait_for_syncapi(new WaitableEvent(true, false)); - scoped_refptr<FakeServerUpdater> updater = new FakeServerUpdater( - service_.get(), &wait_for_start, &wait_for_syncapi); + scoped_refptr<FakeServerUpdater> updater(new FakeServerUpdater( + service_.get(), &wait_for_start, &wait_for_syncapi)); // This server side update will stall waiting for CommitWaiter. updater->CreateNewEntry(MakeAutofillEntry("server", "entry", 1)); diff --git a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc index 0224291..c8aa931 100644 --- a/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc +++ b/chrome/browser/sync/profile_sync_service_typed_url_unittest.cc @@ -427,7 +427,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeAdd) { history::URLsModifiedDetails details; details.changed_urls.push_back(added_entry); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&history_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); notifier->Notify(NotificationType::HISTORY_TYPED_URLS_MODIFIED, Details<history::URLsModifiedDetails>(&details)); @@ -460,7 +460,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeUpdate) { history::URLsModifiedDetails details; details.changed_urls.push_back(updated_entry); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&history_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); notifier->Notify(NotificationType::HISTORY_TYPED_URLS_MODIFIED, Details<history::URLsModifiedDetails>(&details)); @@ -495,7 +495,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemove) { history::URLsDeletedDetails changes; changes.all_history = false; changes.urls.insert(GURL("http://mine.com")); - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&history_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); notifier->Notify(NotificationType::HISTORY_URLS_DELETED, Details<history::URLsDeletedDetails>(&changes)); @@ -529,7 +529,7 @@ TEST_F(ProfileSyncServiceTypedUrlTest, ProcessUserChangeRemoveAll) { history::URLsDeletedDetails changes; changes.all_history = true; - scoped_refptr<ThreadNotifier> notifier = new ThreadNotifier(&history_thread_); + scoped_refptr<ThreadNotifier> notifier(new ThreadNotifier(&history_thread_)); notifier->Notify(NotificationType::HISTORY_URLS_DELETED, Details<history::URLsDeletedDetails>(&changes)); diff --git a/chrome/browser/themes/browser_theme_pack.cc b/chrome/browser/themes/browser_theme_pack.cc index 56cbdbf..c0b0081 100644 --- a/chrome/browser/themes/browser_theme_pack.cc +++ b/chrome/browser/themes/browser_theme_pack.cc @@ -368,7 +368,7 @@ BrowserThemePack* BrowserThemePack::BuildFromExtension( scoped_refptr<BrowserThemePack> BrowserThemePack::BuildFromDataPack( FilePath path, const std::string& expected_id) { DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); - scoped_refptr<BrowserThemePack> pack = new BrowserThemePack; + scoped_refptr<BrowserThemePack> pack(new BrowserThemePack); pack->data_pack_.reset(new base::DataPack); if (!pack->data_pack_->Load(path)) { diff --git a/chrome/browser/themes/browser_theme_pack_unittest.cc b/chrome/browser/themes/browser_theme_pack_unittest.cc index 5da6acf..5d4be22 100644 --- a/chrome/browser/themes/browser_theme_pack_unittest.cc +++ b/chrome/browser/themes/browser_theme_pack_unittest.cc @@ -410,8 +410,8 @@ TEST_F(BrowserThemePackTest, CanBuildAndReadPack) { ASSERT_TRUE(extension.get()); ASSERT_EQ("", error); - scoped_refptr<BrowserThemePack> pack = - BrowserThemePack::BuildFromExtension(extension.get()); + scoped_refptr<BrowserThemePack> pack( + BrowserThemePack::BuildFromExtension(extension.get())); ASSERT_TRUE(pack.get()); ASSERT_TRUE(pack->WriteToDisk(file)); VerifyStarGazing(pack.get()); diff --git a/chrome/browser/themes/browser_theme_provider.cc b/chrome/browser/themes/browser_theme_provider.cc index 134d954..ae40eef 100644 --- a/chrome/browser/themes/browser_theme_provider.cc +++ b/chrome/browser/themes/browser_theme_provider.cc @@ -602,8 +602,8 @@ void BrowserThemeProvider::SaveThemeID(const std::string& id) { } void BrowserThemeProvider::BuildFromExtension(const Extension* extension) { - scoped_refptr<BrowserThemePack> pack = - BrowserThemePack::BuildFromExtension(extension); + scoped_refptr<BrowserThemePack> pack( + BrowserThemePack::BuildFromExtension(extension)); if (!pack.get()) { // TODO(erg): We've failed to install the theme; perhaps we should tell the // user? http://crbug.com/34780 diff --git a/chrome/browser/user_style_sheet_watcher_unittest.cc b/chrome/browser/user_style_sheet_watcher_unittest.cc index ad55136..c791cb9 100644 --- a/chrome/browser/user_style_sheet_watcher_unittest.cc +++ b/chrome/browser/user_style_sheet_watcher_unittest.cc @@ -23,8 +23,8 @@ TEST(UserStyleSheetWatcherTest, StyleLoad) { ASSERT_TRUE(file_util::WriteFile(style_sheet_file, css_file_contents.data(), css_file_contents.length())); - scoped_refptr<UserStyleSheetWatcher> style_sheet_watcher = - new UserStyleSheetWatcher(dir.path()); + scoped_refptr<UserStyleSheetWatcher> style_sheet_watcher( + new UserStyleSheetWatcher(dir.path())); MessageLoop loop; BrowserThread ui_thread(BrowserThread::UI, &loop); BrowserThread file_thread(BrowserThread::FILE, &loop); diff --git a/chrome/common/database_util.cc b/chrome/common/database_util.cc index 412debc..ea4e2cc 100644 --- a/chrome/common/database_util.cc +++ b/chrome/common/database_util.cc @@ -18,8 +18,8 @@ WebKitClient::FileHandle DatabaseUtil::databaseOpenFile( IPC::PlatformFileForTransit file_handle = IPC::InvalidPlatformFileForTransit(); - scoped_refptr<IPC::SyncMessageFilter> filter = - ChildThread::current()->sync_message_filter(); + scoped_refptr<IPC::SyncMessageFilter> filter( + ChildThread::current()->sync_message_filter()); filter->Send(new ViewHostMsg_DatabaseOpenFile( vfs_file_name, desired_flags, &file_handle)); @@ -29,8 +29,8 @@ WebKitClient::FileHandle DatabaseUtil::databaseOpenFile( int DatabaseUtil::databaseDeleteFile( const WebString& vfs_file_name, bool sync_dir) { int rv = SQLITE_IOERR_DELETE; - scoped_refptr<IPC::SyncMessageFilter> filter = - ChildThread::current()->sync_message_filter(); + scoped_refptr<IPC::SyncMessageFilter> filter( + ChildThread::current()->sync_message_filter()); filter->Send(new ViewHostMsg_DatabaseDeleteFile( vfs_file_name, sync_dir, &rv)); return rv; @@ -38,16 +38,16 @@ int DatabaseUtil::databaseDeleteFile( long DatabaseUtil::databaseGetFileAttributes(const WebString& vfs_file_name) { int32 rv = -1; - scoped_refptr<IPC::SyncMessageFilter> filter = - ChildThread::current()->sync_message_filter(); + scoped_refptr<IPC::SyncMessageFilter> filter( + ChildThread::current()->sync_message_filter()); filter->Send(new ViewHostMsg_DatabaseGetFileAttributes(vfs_file_name, &rv)); return rv; } long long DatabaseUtil::databaseGetFileSize(const WebString& vfs_file_name) { int64 rv = 0LL; - scoped_refptr<IPC::SyncMessageFilter> filter = - ChildThread::current()->sync_message_filter(); + scoped_refptr<IPC::SyncMessageFilter> filter( + ChildThread::current()->sync_message_filter()); filter->Send(new ViewHostMsg_DatabaseGetFileSize(vfs_file_name, &rv)); return rv; } diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc index dc11856..5d87fd0 100644 --- a/chrome/common/extensions/extension.cc +++ b/chrome/common/extensions/extension.cc @@ -288,7 +288,7 @@ scoped_refptr<Extension> Extension::Create(const FilePath& path, const DictionaryValue& value, bool require_key, std::string* error) { - scoped_refptr<Extension> extension = new Extension(path, location); + scoped_refptr<Extension> extension(new Extension(path, location)); if (!extension->InitFromValue(value, require_key, error)) return NULL; return extension; diff --git a/chrome/common/webmessageportchannel_impl.cc b/chrome/common/webmessageportchannel_impl.cc index 888ab78..b7a9388 100644 --- a/chrome/common/webmessageportchannel_impl.cc +++ b/chrome/common/webmessageportchannel_impl.cc @@ -69,8 +69,8 @@ void WebMessagePortChannelImpl::entangle(WebMessagePortChannel* channel) { // The message port ids might not be set up yet, if this channel wasn't // created on the main thread. So need to wait until we're on the main thread // before getting the other message port id. - scoped_refptr<WebMessagePortChannelImpl> webchannel = - static_cast<WebMessagePortChannelImpl*>(channel); + scoped_refptr<WebMessagePortChannelImpl> webchannel( + static_cast<WebMessagePortChannelImpl*>(channel)); Entangle(webchannel); } diff --git a/chrome/plugin/plugin_channel.cc b/chrome/plugin/plugin_channel.cc index a3216c6..aa3b713 100644 --- a/chrome/plugin/plugin_channel.cc +++ b/chrome/plugin/plugin_channel.cc @@ -218,8 +218,8 @@ void PluginChannel::OnControlMessageReceived(const IPC::Message& msg) { void PluginChannel::OnCreateInstance(const std::string& mime_type, int* instance_id) { *instance_id = GenerateRouteID(); - scoped_refptr<WebPluginDelegateStub> stub = new WebPluginDelegateStub( - mime_type, *instance_id, this); + scoped_refptr<WebPluginDelegateStub> stub(new WebPluginDelegateStub( + mime_type, *instance_id, this)); AddRoute(*instance_id, stub, NULL); plugin_stubs_.push_back(stub); } diff --git a/chrome/plugin/plugin_thread.cc b/chrome/plugin/plugin_thread.cc index 954cf9f..0e169e4 100644 --- a/chrome/plugin/plugin_thread.cc +++ b/chrome/plugin/plugin_thread.cc @@ -97,8 +97,8 @@ PluginThread::PluginThread() ChromePluginLib::Create(plugin_path_, GetCPBrowserFuncsForPlugin()); - scoped_refptr<NPAPI::PluginLib> plugin = - NPAPI::PluginLib::CreatePluginLib(plugin_path_); + scoped_refptr<NPAPI::PluginLib> plugin( + NPAPI::PluginLib::CreatePluginLib(plugin_path_)); if (plugin.get()) { plugin->NP_Initialize(); @@ -150,8 +150,8 @@ void PluginThread::OnControlMessageReceived(const IPC::Message& msg) { void PluginThread::OnCreateChannel(int renderer_id, bool off_the_record) { - scoped_refptr<PluginChannel> channel = PluginChannel::GetPluginChannel( - renderer_id, ChildProcess::current()->io_message_loop()); + scoped_refptr<PluginChannel> channel(PluginChannel::GetPluginChannel( + renderer_id, ChildProcess::current()->io_message_loop())); IPC::ChannelHandle channel_handle; if (channel.get()) { channel_handle.name = channel->channel_name(); diff --git a/chrome/renderer/audio_message_filter_unittest.cc b/chrome/renderer/audio_message_filter_unittest.cc index eae1f91..8c6b271 100644 --- a/chrome/renderer/audio_message_filter_unittest.cc +++ b/chrome/renderer/audio_message_filter_unittest.cc @@ -94,7 +94,7 @@ TEST(AudioMessageFilterTest, Basic) { MessageLoop message_loop(MessageLoop::TYPE_IO); const int kRouteId = 0; - scoped_refptr<AudioMessageFilter> filter = new AudioMessageFilter(kRouteId); + scoped_refptr<AudioMessageFilter> filter(new AudioMessageFilter(kRouteId)); MockAudioDelegate delegate; int stream_id = filter->AddDelegate(&delegate); @@ -151,7 +151,7 @@ TEST(AudioMessageFilterTest, Delegates) { MessageLoop message_loop(MessageLoop::TYPE_IO); const int kRouteId = 0; - scoped_refptr<AudioMessageFilter> filter = new AudioMessageFilter(kRouteId); + scoped_refptr<AudioMessageFilter> filter(new AudioMessageFilter(kRouteId)); MockAudioDelegate delegate1; MockAudioDelegate delegate2; diff --git a/chrome/renderer/media/audio_renderer_impl_unittest.cc b/chrome/renderer/media/audio_renderer_impl_unittest.cc index 2c0ee96..6dd3dc7 100644 --- a/chrome/renderer/media/audio_renderer_impl_unittest.cc +++ b/chrome/renderer/media/audio_renderer_impl_unittest.cc @@ -127,7 +127,7 @@ TEST_F(AudioRendererImplTest, Stop) { renderer_->OnVolume(0.5); // It's possible that the upstream decoder replies right after being stopped. - scoped_refptr<media::Buffer> buffer = new media::DataBuffer(kSize); + scoped_refptr<media::Buffer> buffer(new media::DataBuffer(kSize)); renderer_->ConsumeAudioSamples(buffer); } @@ -152,7 +152,7 @@ TEST_F(AudioRendererImplTest, DestroyedMessageLoop_SetVolume) { TEST_F(AudioRendererImplTest, DestroyedMessageLoop_ConsumeAudioSamples) { // Kill the message loop and verify OnReadComplete() still works. message_loop_.reset(); - scoped_refptr<media::Buffer> buffer = new media::DataBuffer(kSize); + scoped_refptr<media::Buffer> buffer(new media::DataBuffer(kSize)); renderer_->ConsumeAudioSamples(buffer); EXPECT_CALL(stop_callback_, OnFilterCallback()); renderer_->Stop(stop_callback_.NewCallback()); diff --git a/chrome/renderer/render_view.cc b/chrome/renderer/render_view.cc index eed3618..d24b27b 100644 --- a/chrome/renderer/render_view.cc +++ b/chrome/renderer/render_view.cc @@ -594,8 +594,8 @@ RenderView* RenderView::Create( int64 session_storage_namespace_id, const string16& frame_name) { DCHECK(routing_id != MSG_ROUTING_NONE); - scoped_refptr<RenderView> view = new RenderView(render_thread, webkit_prefs, - session_storage_namespace_id); + scoped_refptr<RenderView> view(new RenderView(render_thread, webkit_prefs, + session_storage_namespace_id)); view->Init(parent_hwnd, opener_id, renderer_prefs, @@ -637,8 +637,8 @@ WebPlugin* RenderView::CreatePluginNoCheck(WebFrame* frame, &info, &setting, &mime_type)); if (!found || !info.enabled) return NULL; - scoped_refptr<pepper::PluginModule> pepper_module = - PepperPluginRegistry::GetInstance()->GetModule(info.path); + scoped_refptr<pepper::PluginModule> pepper_module( + PepperPluginRegistry::GetInstance()->GetModule(info.path)); if (pepper_module) return CreatePepperPlugin(frame, params, info.path, pepper_module.get()); else @@ -2538,8 +2538,8 @@ WebPlugin* RenderView::createPlugin(WebFrame* frame, if (info.path.value() == kDefaultPluginLibraryName || setting == CONTENT_SETTING_ALLOW) { - scoped_refptr<pepper::PluginModule> pepper_module = - PepperPluginRegistry::GetInstance()->GetModule(info.path); + scoped_refptr<pepper::PluginModule> pepper_module( + PepperPluginRegistry::GetInstance()->GetModule(info.path)); if (pepper_module) { return CreatePepperPlugin(frame, params, @@ -2658,14 +2658,14 @@ WebMediaPlayer* RenderView::createMediaPlayer( scoped_refptr<webkit_glue::WebVideoRenderer> video_renderer; if (cmd_line->HasSwitch(switches::kEnableVideoLayering)) { - scoped_refptr<IPCVideoRenderer> renderer = - new IPCVideoRenderer(routing_id_); + scoped_refptr<IPCVideoRenderer> renderer( + new IPCVideoRenderer(routing_id_)); collection.push_back(renderer); video_renderer = renderer; } else { bool pts_logging = cmd_line->HasSwitch(switches::kEnableVideoLogging); - scoped_refptr<webkit_glue::VideoRendererImpl> renderer = - new webkit_glue::VideoRendererImpl(pts_logging); + scoped_refptr<webkit_glue::VideoRendererImpl> renderer( + new webkit_glue::VideoRendererImpl(pts_logging)); collection.push_back(renderer); video_renderer = renderer; } diff --git a/chrome/renderer/render_widget.cc b/chrome/renderer/render_widget.cc index 8880a03..17c0ee7 100644 --- a/chrome/renderer/render_widget.cc +++ b/chrome/renderer/render_widget.cc @@ -94,8 +94,8 @@ RenderWidget* RenderWidget::Create(int32 opener_id, RenderThreadBase* render_thread, WebKit::WebPopupType popup_type) { DCHECK(opener_id != MSG_ROUTING_NONE); - scoped_refptr<RenderWidget> widget = new RenderWidget(render_thread, - popup_type); + scoped_refptr<RenderWidget> widget(new RenderWidget(render_thread, + popup_type)); widget->Init(opener_id); // adds reference return widget; } diff --git a/chrome/renderer/render_widget_browsertest.cc b/chrome/renderer/render_widget_browsertest.cc index ab7502c..ae955ad 100644 --- a/chrome/renderer/render_widget_browsertest.cc +++ b/chrome/renderer/render_widget_browsertest.cc @@ -128,7 +128,7 @@ bool RenderWidgetTest::ImageContainsColor(const SkBitmap& bitmap, void RenderWidgetTest::OutputBitmapToFile(const SkBitmap& bitmap, const FilePath& file_path) { - scoped_refptr<RefCountedBytes> bitmap_data = new RefCountedBytes(); + scoped_refptr<RefCountedBytes> bitmap_data(new RefCountedBytes()); SkAutoLockPixels lock(bitmap); ASSERT_TRUE(gfx::JPEGCodec::Encode( reinterpret_cast<unsigned char*>(bitmap.getAddr32(0, 0)), diff --git a/chrome/renderer/render_widget_fullscreen.cc b/chrome/renderer/render_widget_fullscreen.cc index ce6f367..5a233f3 100644 --- a/chrome/renderer/render_widget_fullscreen.cc +++ b/chrome/renderer/render_widget_fullscreen.cc @@ -15,8 +15,8 @@ RenderWidgetFullscreen* RenderWidgetFullscreen::Create( int32 opener_id, RenderThreadBase* render_thread, WebKit::WebPopupType popup_type) { DCHECK_NE(MSG_ROUTING_NONE, opener_id); - scoped_refptr<RenderWidgetFullscreen> widget = new RenderWidgetFullscreen( - render_thread, popup_type); + scoped_refptr<RenderWidgetFullscreen> widget(new RenderWidgetFullscreen( + render_thread, popup_type)); widget->Init(opener_id); return widget.release(); } diff --git a/chrome/renderer/render_widget_fullscreen_pepper.cc b/chrome/renderer/render_widget_fullscreen_pepper.cc index 5b1b1f3..8ab647e 100644 --- a/chrome/renderer/render_widget_fullscreen_pepper.cc +++ b/chrome/renderer/render_widget_fullscreen_pepper.cc @@ -162,8 +162,8 @@ RenderWidgetFullscreenPepper* RenderWidgetFullscreenPepper::Create( int32 opener_id, RenderThreadBase* render_thread, pepper::PluginInstance* plugin) { DCHECK_NE(MSG_ROUTING_NONE, opener_id); - scoped_refptr<RenderWidgetFullscreenPepper> widget = - new RenderWidgetFullscreenPepper(render_thread, plugin); + scoped_refptr<RenderWidgetFullscreenPepper> widget( + new RenderWidgetFullscreenPepper(render_thread, plugin)); widget->Init(opener_id); return widget.release(); } diff --git a/chrome/renderer/renderer_webkitclient_impl.cc b/chrome/renderer/renderer_webkitclient_impl.cc index 2fb5efc..02ae535 100644 --- a/chrome/renderer/renderer_webkitclient_impl.cc +++ b/chrome/renderer/renderer_webkitclient_impl.cc @@ -181,8 +181,8 @@ bool RendererWebKitClientImpl::SendSyncMessageFromAnyThread( if (render_thread) return render_thread->Send(msg); - scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter = - ChildThread::current()->sync_message_filter(); + scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter( + ChildThread::current()->sync_message_filter()); return sync_msg_filter->Send(msg); } diff --git a/chrome/renderer/webplugin_delegate_pepper.cc b/chrome/renderer/webplugin_delegate_pepper.cc index 082fc82..0085234 100644 --- a/chrome/renderer/webplugin_delegate_pepper.cc +++ b/chrome/renderer/webplugin_delegate_pepper.cc @@ -114,8 +114,8 @@ WebPluginDelegatePepper* WebPluginDelegatePepper::Create( const FilePath& filename, const std::string& mime_type, const base::WeakPtr<RenderView>& render_view) { - scoped_refptr<NPAPI::PluginLib> plugin_lib = - NPAPI::PluginLib::CreatePluginLib(filename); + scoped_refptr<NPAPI::PluginLib> plugin_lib( + NPAPI::PluginLib::CreatePluginLib(filename)); if (plugin_lib.get() == NULL) return NULL; @@ -123,8 +123,8 @@ WebPluginDelegatePepper* WebPluginDelegatePepper::Create( if (err != NPERR_NO_ERROR) return NULL; - scoped_refptr<NPAPI::PluginInstance> instance = - plugin_lib->CreateInstance(mime_type); + scoped_refptr<NPAPI::PluginInstance> instance( + plugin_lib->CreateInstance(mime_type)); return new WebPluginDelegatePepper(render_view, instance.get()); } diff --git a/chrome/renderer/webplugin_delegate_proxy.cc b/chrome/renderer/webplugin_delegate_proxy.cc index d53909c..eff2d29 100644 --- a/chrome/renderer/webplugin_delegate_proxy.cc +++ b/chrome/renderer/webplugin_delegate_proxy.cc @@ -294,9 +294,9 @@ bool WebPluginDelegateProxy::Initialize(const GURL& url, IPC::AddChannelSocket(channel_handle.name, channel_handle.socket.fd); #endif - scoped_refptr<PluginChannelHost> channel_host = + scoped_refptr<PluginChannelHost> channel_host( PluginChannelHost::GetPluginChannelHost( - channel_handle.name, ChildProcess::current()->io_message_loop()); + channel_handle.name, ChildProcess::current()->io_message_loop())); if (!channel_host.get()) return false; diff --git a/chrome/service/cloud_print/cloud_print_proxy_backend.cc b/chrome/service/cloud_print/cloud_print_proxy_backend.cc index 99158d3..3b950d2 100644 --- a/chrome/service/cloud_print/cloud_print_proxy_backend.cc +++ b/chrome/service/cloud_print/cloud_print_proxy_backend.cc @@ -277,17 +277,17 @@ void CloudPrintProxyBackend::Core::DoInitializeWithLsid( // the CloudPrintProxyCoreThread and we cannot really do anything else until // the GAIA signin is successful. std::string user_agent = "ChromiumBrowser"; - scoped_refptr<ServiceGaiaAuthenticator> gaia_auth_for_talk = + scoped_refptr<ServiceGaiaAuthenticator> gaia_auth_for_talk( new ServiceGaiaAuthenticator( user_agent, kSyncGaiaServiceId, kGaiaUrl, - g_service_process->io_thread()->message_loop_proxy()); + g_service_process->io_thread()->message_loop_proxy())); gaia_auth_for_talk->set_message_loop(MessageLoop::current()); bool auth_succeeded = false; if (gaia_auth_for_talk->AuthenticateWithLsid(lsid)) { - scoped_refptr<ServiceGaiaAuthenticator> gaia_auth_for_print = + scoped_refptr<ServiceGaiaAuthenticator> gaia_auth_for_print( new ServiceGaiaAuthenticator( user_agent, kCloudPrintGaiaServiceId, kGaiaUrl, - g_service_process->io_thread()->message_loop_proxy()); + g_service_process->io_thread()->message_loop_proxy())); gaia_auth_for_print->set_message_loop(MessageLoop::current()); if (gaia_auth_for_print->AuthenticateWithLsid(lsid)) { auth_succeeded = true; diff --git a/chrome/service/cloud_print/printer_job_handler.cc b/chrome/service/cloud_print/printer_job_handler.cc index f351c5c..a1c7768 100644 --- a/chrome/service/cloud_print/printer_job_handler.cc +++ b/chrome/service/cloud_print/printer_job_handler.cc @@ -417,10 +417,10 @@ PrinterJobHandler::HandleSuccessStatusUpdateResponse( << printer_info_cloud_.printer_id; // The print job has been spooled locally. We now need to create an object // that monitors the status of the job and updates the server. - scoped_refptr<JobStatusUpdater> job_status_updater = + scoped_refptr<JobStatusUpdater> job_status_updater( new JobStatusUpdater(printer_info_.printer_name, job_details_.job_id_, local_job_id_, auth_token_, cloud_print_server_url_, - print_system_.get(), this); + print_system_.get(), this)); job_status_updater_list_.push_back(job_status_updater); MessageLoop::current()->PostTask( FROM_HERE, NewRunnableMethod(job_status_updater.get(), diff --git a/chrome/worker/worker_webkitclient_impl.cc b/chrome/worker/worker_webkitclient_impl.cc index 1755002..cd188cd 100644 --- a/chrome/worker/worker_webkitclient_impl.cc +++ b/chrome/worker/worker_webkitclient_impl.cc @@ -48,8 +48,8 @@ static bool SendSyncMessageFromAnyThread(IPC::SyncMessage* msg) { if (worker_thread) return worker_thread->Send(msg); - scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter = - ChildThread::current()->sync_message_filter(); + scoped_refptr<IPC::SyncMessageFilter> sync_msg_filter( + ChildThread::current()->sync_message_filter()); return sync_msg_filter->Send(msg); } diff --git a/ipc/file_descriptor_set_posix_unittest.cc b/ipc/file_descriptor_set_posix_unittest.cc index b6077d1..31b8bf4 100644 --- a/ipc/file_descriptor_set_posix_unittest.cc +++ b/ipc/file_descriptor_set_posix_unittest.cc @@ -36,7 +36,7 @@ bool VerifyClosed(int fd) { static const int kFDBase = 50000; TEST(FileDescriptorSet, BasicAdd) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); ASSERT_EQ(set->size(), 0u); ASSERT_TRUE(set->empty()); @@ -50,7 +50,7 @@ TEST(FileDescriptorSet, BasicAdd) { } TEST(FileDescriptorSet, BasicAddAndClose) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); ASSERT_EQ(set->size(), 0u); ASSERT_TRUE(set->empty()); @@ -64,7 +64,7 @@ TEST(FileDescriptorSet, BasicAddAndClose) { ASSERT_TRUE(VerifyClosed(fd)); } TEST(FileDescriptorSet, MaxSize) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); for (unsigned i = 0; i < FileDescriptorSet::MAX_DESCRIPTORS_PER_MESSAGE; ++i) { @@ -77,7 +77,7 @@ TEST(FileDescriptorSet, MaxSize) { } TEST(FileDescriptorSet, SetDescriptors) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); ASSERT_TRUE(set->empty()); set->SetDescriptors(NULL, 0); @@ -95,7 +95,7 @@ TEST(FileDescriptorSet, SetDescriptors) { } TEST(FileDescriptorSet, GetDescriptors) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); set->GetDescriptors(NULL); ASSERT_TRUE(set->Add(kFDBase)); @@ -109,7 +109,7 @@ TEST(FileDescriptorSet, GetDescriptors) { } TEST(FileDescriptorSet, WalkInOrder) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); ASSERT_TRUE(set->Add(kFDBase)); ASSERT_TRUE(set->Add(kFDBase + 1)); @@ -123,7 +123,7 @@ TEST(FileDescriptorSet, WalkInOrder) { } TEST(FileDescriptorSet, WalkWrongOrder) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); ASSERT_TRUE(set->Add(kFDBase)); ASSERT_TRUE(set->Add(kFDBase + 1)); @@ -136,7 +136,7 @@ TEST(FileDescriptorSet, WalkWrongOrder) { } TEST(FileDescriptorSet, WalkCycle) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); ASSERT_TRUE(set->Add(kFDBase)); ASSERT_TRUE(set->Add(kFDBase + 1)); @@ -156,7 +156,7 @@ TEST(FileDescriptorSet, WalkCycle) { } TEST(FileDescriptorSet, DontClose) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); const int fd = GetSafeFd(); ASSERT_TRUE(set->Add(fd)); @@ -166,7 +166,7 @@ TEST(FileDescriptorSet, DontClose) { } TEST(FileDescriptorSet, DoClose) { - scoped_refptr<FileDescriptorSet> set = new FileDescriptorSet; + scoped_refptr<FileDescriptorSet> set(new FileDescriptorSet); const int fd = GetSafeFd(); ASSERT_TRUE(set->AddAndAutoClose(fd)); diff --git a/media/audio/audio_input_controller.cc b/media/audio/audio_input_controller.cc index fc4b97d..45ab2c4 100644 --- a/media/audio/audio_input_controller.cc +++ b/media/audio/audio_input_controller.cc @@ -42,8 +42,8 @@ scoped_refptr<AudioInputController> AudioInputController::Create( return factory_->Create(event_handler, params, samples_per_packet); } - scoped_refptr<AudioInputController> controller = new AudioInputController( - event_handler); + scoped_refptr<AudioInputController> controller(new AudioInputController( + event_handler)); // Start the thread and post a task to create the audio input stream. controller->thread_.Start(); diff --git a/media/audio/audio_output_controller.cc b/media/audio/audio_output_controller.cc index 602e232..4ba0f3e 100644 --- a/media/audio/audio_output_controller.cc +++ b/media/audio/audio_output_controller.cc @@ -58,8 +58,8 @@ scoped_refptr<AudioOutputController> AudioOutputController::Create( return NULL; // Starts the audio controller thread. - scoped_refptr<AudioOutputController> controller = new AudioOutputController( - event_handler, buffer_capacity, NULL); + scoped_refptr<AudioOutputController> controller(new AudioOutputController( + event_handler, buffer_capacity, NULL)); controller->message_loop_ = AudioManager::GetAudioManager()->GetMessageLoop(); @@ -83,8 +83,8 @@ scoped_refptr<AudioOutputController> AudioOutputController::CreateLowLatency( return NULL; // Starts the audio controller thread. - scoped_refptr<AudioOutputController> controller = new AudioOutputController( - event_handler, 0, sync_reader); + scoped_refptr<AudioOutputController> controller(new AudioOutputController( + event_handler, 0, sync_reader)); controller->message_loop_ = AudioManager::GetAudioManager()->GetMessageLoop(); diff --git a/media/base/data_buffer_unittest.cc b/media/base/data_buffer_unittest.cc index 2d014ffa..8e40d1a 100644 --- a/media/base/data_buffer_unittest.cc +++ b/media/base/data_buffer_unittest.cc @@ -15,7 +15,7 @@ TEST(DataBufferTest, StreamSampleImpl) { const base::TimeDelta kDurationB = base::TimeDelta::FromMicroseconds(5678); // Create a DataBuffer. - scoped_refptr<DataBuffer> buffer = new DataBuffer(0); + scoped_refptr<DataBuffer> buffer(new DataBuffer(0)); ASSERT_TRUE(buffer); buffer->SetTimestamp(kTimestampA); @@ -38,10 +38,10 @@ TEST(DataBufferTest, StreamSampleImpl) { TEST(DataBufferTest, Ctors) { const size_t kTestSize = 10; - scoped_refptr<DataBuffer> buffer = new DataBuffer(0); + scoped_refptr<DataBuffer> buffer(new DataBuffer(0)); EXPECT_FALSE(buffer->GetData()); - scoped_refptr<DataBuffer> buffer2 = new DataBuffer(kTestSize); + scoped_refptr<DataBuffer> buffer2(new DataBuffer(kTestSize)); EXPECT_EQ(0u, buffer2->GetDataSize()); EXPECT_EQ(kTestSize, buffer2->GetBufferSize()); } @@ -53,7 +53,7 @@ TEST(DataBufferTest, WritableBufferImpl) { const size_t kNewDataSize = arraysize(kNewData); // Create a DataBuffer. - scoped_refptr<DataBuffer> buffer = new DataBuffer(kDataSize); + scoped_refptr<DataBuffer> buffer(new DataBuffer(kDataSize)); ASSERT_TRUE(buffer); uint8* data = buffer->GetWritableData(); @@ -66,7 +66,7 @@ TEST(DataBufferTest, WritableBufferImpl) { ASSERT_EQ(0, memcmp(read_only_data, kData, kDataSize)); EXPECT_FALSE(buffer->IsEndOfStream()); - scoped_refptr<DataBuffer> buffer2 = new DataBuffer(kNewDataSize + 10); + scoped_refptr<DataBuffer> buffer2(new DataBuffer(kNewDataSize + 10)); data = buffer2->GetWritableData(); ASSERT_TRUE(data); ASSERT_EQ(kNewDataSize + 10, buffer2->GetBufferSize()); diff --git a/media/base/pipeline_impl_unittest.cc b/media/base/pipeline_impl_unittest.cc index 544e000..eef63566 100644 --- a/media/base/pipeline_impl_unittest.cc +++ b/media/base/pipeline_impl_unittest.cc @@ -118,7 +118,7 @@ class PipelineImplTest : public ::testing::Test { // Configure the demuxer to return the streams. for (size_t i = 0; i < streams->size(); ++i) { - scoped_refptr<DemuxerStream> stream = (*streams)[i]; + scoped_refptr<DemuxerStream> stream((*streams)[i]); EXPECT_CALL(*mocks_->demuxer(), GetStream(i)) .WillRepeatedly(Return(stream)); } diff --git a/media/base/seekable_buffer_unittest.cc b/media/base/seekable_buffer_unittest.cc index 50f5d15..9602d50 100644 --- a/media/base/seekable_buffer_unittest.cc +++ b/media/base/seekable_buffer_unittest.cc @@ -225,7 +225,7 @@ TEST_F(SeekableBufferTest, SeekBackward) { TEST_F(SeekableBufferTest, GetCurrentChunk) { const size_t kSeekSize = kWriteSize / 3; - scoped_refptr<media::DataBuffer> buffer = new media::DataBuffer(kWriteSize); + scoped_refptr<media::DataBuffer> buffer(new media::DataBuffer(kWriteSize)); memcpy(buffer->GetWritableData(), data_, kWriteSize); buffer->SetDataSize(kWriteSize); @@ -325,7 +325,7 @@ TEST_F(SeekableBufferTest, GetTime) { EXPECT_EQ(kInvalidTimestamp.ToInternalValue(), buffer_.current_time().ToInternalValue()); - scoped_refptr<media::DataBuffer> buffer = new media::DataBuffer(kWriteSize); + scoped_refptr<media::DataBuffer> buffer(new media::DataBuffer(kWriteSize)); memcpy(buffer->GetWritableData(), data_, kWriteSize); buffer->SetDataSize(kWriteSize); diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc index 57a4d0d..332c3c5 100644 --- a/media/base/video_frame.cc +++ b/media/base/video_frame.cc @@ -39,8 +39,8 @@ void VideoFrame::CreateFrame(VideoFrame::Format format, DCHECK(width * height < 100000000); DCHECK(frame_out); bool alloc_worked = false; - scoped_refptr<VideoFrame> frame = - new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY, format, width, height); + scoped_refptr<VideoFrame> frame( + new VideoFrame(VideoFrame::TYPE_SYSTEM_MEMORY, format, width, height)); if (frame) { frame->SetTimestamp(timestamp); frame->SetDuration(duration); @@ -85,8 +85,8 @@ void VideoFrame::CreateFrameExternal(SurfaceType type, void* private_buffer, scoped_refptr<VideoFrame>* frame_out) { DCHECK(frame_out); - scoped_refptr<VideoFrame> frame = - new VideoFrame(type, format, width, height); + scoped_refptr<VideoFrame> frame( + new VideoFrame(type, format, width, height)); if (frame) { frame->SetTimestamp(timestamp); frame->SetDuration(duration); @@ -108,8 +108,8 @@ void VideoFrame::CreateFrameGlTexture(Format format, GlTexture const textures[kMaxPlanes], scoped_refptr<VideoFrame>* frame_out) { DCHECK(frame_out); - scoped_refptr<VideoFrame> frame = - new VideoFrame(TYPE_GL_TEXTURE, format, width, height); + scoped_refptr<VideoFrame> frame( + new VideoFrame(TYPE_GL_TEXTURE, format, width, height)); if (frame) { frame->external_memory_ = true; frame->planes_ = GetNumberOfPlanes(format); diff --git a/media/filters/audio_renderer_base_unittest.cc b/media/filters/audio_renderer_base_unittest.cc index 03de168..de4f3c6 100644 --- a/media/filters/audio_renderer_base_unittest.cc +++ b/media/filters/audio_renderer_base_unittest.cc @@ -149,7 +149,7 @@ TEST_F(AudioRendererBaseTest, Initialize_Successful) { // Now satisfy the read requests. Our callback should be executed after // exiting this loop. while (pending_reads_) { - scoped_refptr<DataBuffer> buffer = new DataBuffer(1024); + scoped_refptr<DataBuffer> buffer(new DataBuffer(1024)); buffer->SetDataSize(1024); --pending_reads_; decoder_->consume_audio_samples_callback()->Run(buffer); @@ -190,7 +190,7 @@ TEST_F(AudioRendererBaseTest, OneCompleteReadCycle) { const uint32 kDataSize = 1024; uint32 bytes_buffered = 0; while (pending_reads_) { - scoped_refptr<DataBuffer> buffer = new DataBuffer(kDataSize); + scoped_refptr<DataBuffer> buffer(new DataBuffer(kDataSize)); buffer->SetDataSize(kDataSize); decoder_->consume_audio_samples_callback()->Run(buffer); --pending_reads_; @@ -219,7 +219,7 @@ TEST_F(AudioRendererBaseTest, OneCompleteReadCycle) { EXPECT_EQ(kMaxQueueSize, pending_reads_); // Fulfill the read with an end-of-stream packet. - scoped_refptr<DataBuffer> last_buffer = new DataBuffer(0); + scoped_refptr<DataBuffer> last_buffer(new DataBuffer(0)); decoder_->consume_audio_samples_callback()->Run(last_buffer); --pending_reads_; diff --git a/media/filters/decoder_base_unittest.cc b/media/filters/decoder_base_unittest.cc index 41dcf9a..d280895 100644 --- a/media/filters/decoder_base_unittest.cc +++ b/media/filters/decoder_base_unittest.cc @@ -96,7 +96,7 @@ ACTION(Initialize) { } ACTION_P(SaveDecodeRequest, list) { - scoped_refptr<Buffer> buffer = arg0; + scoped_refptr<Buffer> buffer(arg0); list->push_back(buffer); } @@ -120,11 +120,11 @@ ACTION(CompleteDemuxRequest) { // \ ReadCallback() -> client TEST(DecoderBaseTest, FlowControl) { MessageLoop message_loop; - scoped_refptr<MockDecoderImpl> decoder = new MockDecoderImpl(); + scoped_refptr<MockDecoderImpl> decoder(new MockDecoderImpl()); MockDecoderCallback read_callback; decoder->set_consume_audio_samples_callback( NewCallback(&read_callback, &MockDecoderCallback::OnReadComplete)); - scoped_refptr<MockDemuxerStream> demuxer_stream = new MockDemuxerStream(); + scoped_refptr<MockDemuxerStream> demuxer_stream(new MockDemuxerStream()); StrictMock<MockFilterCallback> callback; decoder->set_message_loop(&message_loop); diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc index 493108a..658bd8a 100644 --- a/media/filters/ffmpeg_demuxer.cc +++ b/media/filters/ffmpeg_demuxer.cc @@ -126,8 +126,8 @@ void FFmpegDemuxerStream::EnqueuePacket(AVPacket* packet) { } // Enqueue the callback and attempt to satisfy a read immediately. - scoped_refptr<Buffer> buffer = - new AVPacketBuffer(packet, timestamp, duration); + scoped_refptr<Buffer> buffer( + new AVPacketBuffer(packet, timestamp, duration)); if (!buffer) { NOTREACHED() << "Unable to allocate AVPacketBuffer"; return; diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc index ecf87b5..97f16d3 100644 --- a/media/filters/ffmpeg_demuxer_unittest.cc +++ b/media/filters/ffmpeg_demuxer_unittest.cc @@ -669,7 +669,7 @@ void RunCallback(size_t size, DataSource::ReadCallback* callback) { TEST_F(FFmpegDemuxerTest, ProtocolRead) { // Creates a demuxer. - scoped_refptr<MockFFmpegDemuxer> demuxer = new MockFFmpegDemuxer(); + scoped_refptr<MockFFmpegDemuxer> demuxer(new MockFFmpegDemuxer()); ASSERT_TRUE(demuxer); demuxer->set_host(&host_); demuxer->set_message_loop(&message_loop_); diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc index 45357f2..7ce8f1d 100644 --- a/media/filters/ffmpeg_video_decoder.cc +++ b/media/filters/ffmpeg_video_decoder.cc @@ -234,7 +234,7 @@ void FFmpegVideoDecoder::OnFormatChange(VideoStreamInfo stream_info) { } void FFmpegVideoDecoder::OnReadComplete(Buffer* buffer_in) { - scoped_refptr<Buffer> buffer = buffer_in; + scoped_refptr<Buffer> buffer(buffer_in); message_loop()->PostTask( FROM_HERE, NewRunnableMethod(this, diff --git a/media/filters/file_data_source_unittest.cc b/media/filters/file_data_source_unittest.cc index 48d999e..b606feb 100644 --- a/media/filters/file_data_source_unittest.cc +++ b/media/filters/file_data_source_unittest.cc @@ -62,7 +62,7 @@ TEST(FileDataSourceTest, OpenFile) { EXPECT_CALL(callback, OnFilterCallback()); EXPECT_CALL(callback, OnCallbackDestroyed()); - scoped_refptr<FileDataSource> filter = new FileDataSource(); + scoped_refptr<FileDataSource> filter(new FileDataSource()); filter->set_host(&host); filter->Initialize(TestFileURL(), callback.NewCallback()); @@ -79,7 +79,7 @@ TEST(FileDataSourceTest, ReadData) { // Create our mock filter host and initialize the data source. NiceMock<MockFilterHost> host; NiceMock<MockFilterCallback> callback; - scoped_refptr<FileDataSource> filter = new FileDataSource(); + scoped_refptr<FileDataSource> filter(new FileDataSource()); filter->set_host(&host); filter->Initialize(TestFileURL(), callback.NewCallback()); @@ -116,7 +116,7 @@ TEST(FileDataSourceTest, Seek) { EXPECT_CALL(callback, OnCallbackDestroyed()); const base::TimeDelta kZero; - scoped_refptr<FileDataSource> filter = new FileDataSource(); + scoped_refptr<FileDataSource> filter(new FileDataSource()); filter->Seek(kZero, callback.NewCallback()); EXPECT_CALL(callback, OnFilterCallback()); diff --git a/media/filters/video_renderer_base_unittest.cc b/media/filters/video_renderer_base_unittest.cc index e27e445..ba7280ad 100644 --- a/media/filters/video_renderer_base_unittest.cc +++ b/media/filters/video_renderer_base_unittest.cc @@ -113,7 +113,7 @@ TEST_F(VideoRendererBaseTest, Initialize_BadMediaFormat) { // Don't set a media format. MediaFormat media_format; - scoped_refptr<MockVideoDecoder> bad_decoder = new MockVideoDecoder(); + scoped_refptr<MockVideoDecoder> bad_decoder(new MockVideoDecoder()); EXPECT_CALL(*bad_decoder, media_format()) .WillRepeatedly(ReturnRef(media_format)); 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); diff --git a/remoting/host/heartbeat_sender_unittest.cc b/remoting/host/heartbeat_sender_unittest.cc index 6610607..c5f03a8 100644 --- a/remoting/host/heartbeat_sender_unittest.cc +++ b/remoting/host/heartbeat_sender_unittest.cc @@ -86,7 +86,7 @@ TEST_F(HeartbeatSenderTest, DoSendStanza) { // |iq_request| is freed by HeartbeatSender. MockIqRequest* iq_request = new MockIqRequest(jingle_client_); - scoped_refptr<HeartbeatSender> heartbeat_sender = new HeartbeatSender(); + scoped_refptr<HeartbeatSender> heartbeat_sender(new HeartbeatSender()); ASSERT_TRUE(heartbeat_sender->Init(config_, jingle_client_)); EXPECT_CALL(*jingle_client_, CreateIqRequest()) @@ -105,7 +105,7 @@ TEST_F(HeartbeatSenderTest, DoSendStanza) { TEST_F(HeartbeatSenderTest, CreateHeartbeatMessage) { // This test validates format of the heartbeat stanza. - scoped_refptr<HeartbeatSender> heartbeat_sender = new HeartbeatSender(); + scoped_refptr<HeartbeatSender> heartbeat_sender(new HeartbeatSender()); ASSERT_TRUE(heartbeat_sender->Init(config_, jingle_client_)); int64 start_time = static_cast<int64>(base::Time::Now().ToDoubleT()); diff --git a/remoting/host/json_host_config_unittest.cc b/remoting/host/json_host_config_unittest.cc index bd1bc14..14ee9bd 100644 --- a/remoting/host/json_host_config_unittest.cc +++ b/remoting/host/json_host_config_unittest.cc @@ -54,8 +54,8 @@ TEST_F(JsonHostConfigTest, InvalidFile) { ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); FilePath non_existent_file = test_dir_.path().AppendASCII("non_existent.json"); - scoped_refptr<JsonHostConfig> target = - new JsonHostConfig(non_existent_file, message_loop_proxy_.get()); + scoped_refptr<JsonHostConfig> target( + new JsonHostConfig(non_existent_file, message_loop_proxy_.get())); EXPECT_FALSE(target->Read()); } @@ -63,8 +63,8 @@ TEST_F(JsonHostConfigTest, Read) { ASSERT_TRUE(test_dir_.CreateUniqueTempDir()); FilePath test_file = test_dir_.path().AppendASCII("read.json"); WriteTestFile(test_file); - scoped_refptr<JsonHostConfig> target = - new JsonHostConfig(test_file, message_loop_proxy_.get()); + scoped_refptr<JsonHostConfig> target( + new JsonHostConfig(test_file, message_loop_proxy_.get())); ASSERT_TRUE(target->Read()); std::string value; diff --git a/remoting/host/simple_host_process.cc b/remoting/host/simple_host_process.cc index 744e100..d998ef9 100644 --- a/remoting/host/simple_host_process.cc +++ b/remoting/host/simple_host_process.cc @@ -133,12 +133,12 @@ int main(int argc, char** argv) { context.Start(); // Construct a chromoting host. - scoped_refptr<remoting::ChromotingHost> host = + scoped_refptr<remoting::ChromotingHost> host( new remoting::ChromotingHost(&context, config, capturer.release(), encoder.release(), - event_handler.release()); + event_handler.release())); // Let the chromoting host run until the shutdown task is executed. MessageLoop message_loop(MessageLoop::TYPE_UI); diff --git a/remoting/jingle_glue/channel_socket_adapter_unittest.cc b/remoting/jingle_glue/channel_socket_adapter_unittest.cc index ac2c591..867332f 100644 --- a/remoting/jingle_glue/channel_socket_adapter_unittest.cc +++ b/remoting/jingle_glue/channel_socket_adapter_unittest.cc @@ -64,7 +64,7 @@ class TransportChannelSocketAdapterTest : public testing::Test { // Verify that Read() returns net::ERR_IO_PENDING. TEST_F(TransportChannelSocketAdapterTest, Read) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kBufferSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize)); int result = target_->Read(buffer, kBufferSize, &callback_); ASSERT_EQ(net::ERR_IO_PENDING, result); @@ -75,7 +75,7 @@ TEST_F(TransportChannelSocketAdapterTest, Read) { // Verify that Read() after Close() returns error. TEST_F(TransportChannelSocketAdapterTest, ReadClose) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kBufferSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize)); int result = target_->Read(buffer, kBufferSize, &callback_); ASSERT_EQ(net::ERR_IO_PENDING, result); @@ -89,7 +89,7 @@ TEST_F(TransportChannelSocketAdapterTest, ReadClose) { // Verify that Write sends the packet and returns correct result. TEST_F(TransportChannelSocketAdapterTest, Write) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kTestDataSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kTestDataSize)); EXPECT_CALL(channel_, SendPacket(buffer->data(), kTestDataSize)) .WillOnce(Return(kTestDataSize)); @@ -101,7 +101,7 @@ TEST_F(TransportChannelSocketAdapterTest, Write) { // Verify that the message is still send if Write() is called while // socket is not open yet, and that the callback is called. TEST_F(TransportChannelSocketAdapterTest, WritePending) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kTestDataSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kTestDataSize)); EXPECT_CALL(channel_, SendPacket(buffer->data(), kTestDataSize)) .Times(2) diff --git a/remoting/jingle_glue/ssl_socket_adapter.cc b/remoting/jingle_glue/ssl_socket_adapter.cc index f7c324a..c67115f 100644 --- a/remoting/jingle_glue/ssl_socket_adapter.cc +++ b/remoting/jingle_glue/ssl_socket_adapter.cc @@ -84,7 +84,7 @@ int SSLSocketAdapter::Send(const void* buf, size_t len) { if (ssl_state_ != SSLSTATE_CONNECTED) { return AsyncSocketAdapter::Send(buf, len); } else { - scoped_refptr<net::IOBuffer> transport_buf = new net::IOBuffer(len); + scoped_refptr<net::IOBuffer> transport_buf(new net::IOBuffer(len)); memcpy(transport_buf->data(), buf, len); int result = ssl_socket_->Write(transport_buf, len, NULL); diff --git a/remoting/jingle_glue/stream_socket_adapter_unittest.cc b/remoting/jingle_glue/stream_socket_adapter_unittest.cc index 7d1dd62..01997dc 100644 --- a/remoting/jingle_glue/stream_socket_adapter_unittest.cc +++ b/remoting/jingle_glue/stream_socket_adapter_unittest.cc @@ -54,7 +54,7 @@ class StreamSocketAdapterTest : public testing::Test { // Verify that Read() calls Read() in stream. TEST_F(StreamSocketAdapterTest, Read) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kBufferSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize)); EXPECT_CALL(*stream_, Read(buffer->data(), kBufferSize, _, _)) .WillOnce(DoAll(SetArgumentPointee<2>(kTestDataSize), @@ -67,7 +67,7 @@ TEST_F(StreamSocketAdapterTest, Read) { // Verify that read callback is called for pending reads. TEST_F(StreamSocketAdapterTest, ReadPending) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kBufferSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize)); EXPECT_CALL(*stream_, Read(buffer->data(), kBufferSize, _, _)) .Times(2) @@ -84,7 +84,7 @@ TEST_F(StreamSocketAdapterTest, ReadPending) { // Verify that Read() returns error after Close(). TEST_F(StreamSocketAdapterTest, ReadClose) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kBufferSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kBufferSize)); EXPECT_CALL(*stream_, Read(buffer->data(), kBufferSize, _, _)) .WillOnce(Return(talk_base::SR_BLOCK)); @@ -102,7 +102,7 @@ TEST_F(StreamSocketAdapterTest, ReadClose) { // Verify that Write() calls stream's Write() and returns result. TEST_F(StreamSocketAdapterTest, Write) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kTestDataSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kTestDataSize)); EXPECT_CALL(*stream_, Write(buffer->data(), kTestDataSize, _, _)) .WillOnce(DoAll(SetArgumentPointee<2>(kTestDataSize), @@ -115,7 +115,7 @@ TEST_F(StreamSocketAdapterTest, Write) { // Verify that write callback is called for pending writes. TEST_F(StreamSocketAdapterTest, WritePending) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kTestDataSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kTestDataSize)); EXPECT_CALL(*stream_, Write(buffer->data(), kTestDataSize, _, _)) .Times(2) @@ -132,7 +132,7 @@ TEST_F(StreamSocketAdapterTest, WritePending) { // Verify that Write() returns error after Close(). TEST_F(StreamSocketAdapterTest, WriteClose) { - scoped_refptr<IOBuffer> buffer = new IOBuffer(kTestDataSize); + scoped_refptr<IOBuffer> buffer(new IOBuffer(kTestDataSize)); EXPECT_CALL(*stream_, Write(buffer->data(), kTestDataSize, _, _)) .WillOnce(Return(talk_base::SR_BLOCK)); diff --git a/remoting/protocol/host_message_dispatcher.cc b/remoting/protocol/host_message_dispatcher.cc index 818934f..768789e 100644 --- a/remoting/protocol/host_message_dispatcher.cc +++ b/remoting/protocol/host_message_dispatcher.cc @@ -46,8 +46,8 @@ bool HostMessageDispatcher::Initialize( void HostMessageDispatcher::OnControlMessageReceived( ClientControlMessage* message) { - scoped_refptr<RefCountedMessage<ClientControlMessage> > ref_msg = - new RefCountedMessage<ClientControlMessage>(message); + scoped_refptr<RefCountedMessage<ClientControlMessage> > ref_msg( + new RefCountedMessage<ClientControlMessage>(message)); if (message->has_suggest_screen_resolution_request()) { control_message_handler_->OnSuggestScreenResolutionRequest( message->suggest_screen_resolution_request(), diff --git a/remoting/protocol/jingle_chromotocol_connection_unittest.cc b/remoting/protocol/jingle_chromotocol_connection_unittest.cc index d8f12cd..2d0cb8e 100644 --- a/remoting/protocol/jingle_chromotocol_connection_unittest.cc +++ b/remoting/protocol/jingle_chromotocol_connection_unittest.cc @@ -118,10 +118,11 @@ class JingleChromotocolConnectionTest : public testing::Test { &MockServerCallback::OnIncomingConnection)); client_server_ = new JingleChromotocolServer(&thread_); client_server_->set_allow_local_ips(true); - client_server_->Init(SessionManagerPair::kClientJid, - session_manager_pair_->client_session_manager(), - NewCallback(&client_server_callback_, - &MockServerCallback::OnIncomingConnection)); + client_server_->Init( + SessionManagerPair::kClientJid, + session_manager_pair_->client_session_manager(), + NewCallback(&client_server_callback_, + &MockServerCallback::OnIncomingConnection)); } bool InitiateConnection() { @@ -422,7 +423,7 @@ class UDPChannelTester : public ChannelTesterBase { return; } - scoped_refptr<net::IOBuffer> packet = new net::IOBuffer(kMessageSize); + scoped_refptr<net::IOBuffer> packet(new net::IOBuffer(kMessageSize)); memset(packet->data(), 123, kMessageSize); sent_packets_[packets_sent_] = packet; // Put index of this packet in the beginning of the packet body. @@ -551,9 +552,9 @@ TEST_F(JingleChromotocolConnectionTest, Connect) { TEST_F(JingleChromotocolConnectionTest, TestControlChannel) { CreateServerPair(); ASSERT_TRUE(InitiateConnection()); - scoped_refptr<TCPChannelTester> tester = + scoped_refptr<TCPChannelTester> tester( new TCPChannelTester(thread_.message_loop(), host_connection_, - client_connection_); + client_connection_)); tester->Start(ChannelTesterBase::CONTROL); ASSERT_TRUE(tester->WaitFinished()); tester->CheckResults(); @@ -567,9 +568,9 @@ TEST_F(JingleChromotocolConnectionTest, TestControlChannel) { TEST_F(JingleChromotocolConnectionTest, TestVideoChannel) { CreateServerPair(); ASSERT_TRUE(InitiateConnection()); - scoped_refptr<TCPChannelTester> tester = + scoped_refptr<TCPChannelTester> tester( new TCPChannelTester(thread_.message_loop(), host_connection_, - client_connection_); + client_connection_)); tester->Start(ChannelTesterBase::VIDEO); ASSERT_TRUE(tester->WaitFinished()); tester->CheckResults(); @@ -582,9 +583,9 @@ TEST_F(JingleChromotocolConnectionTest, TestVideoChannel) { TEST_F(JingleChromotocolConnectionTest, TestEventChannel) { CreateServerPair(); ASSERT_TRUE(InitiateConnection()); - scoped_refptr<TCPChannelTester> tester = + scoped_refptr<TCPChannelTester> tester( new TCPChannelTester(thread_.message_loop(), host_connection_, - client_connection_); + client_connection_)); tester->Start(ChannelTesterBase::EVENT); ASSERT_TRUE(tester->WaitFinished()); tester->CheckResults(); @@ -597,9 +598,9 @@ TEST_F(JingleChromotocolConnectionTest, TestEventChannel) { TEST_F(JingleChromotocolConnectionTest, TestVideoRtpChannel) { CreateServerPair(); ASSERT_TRUE(InitiateConnection()); - scoped_refptr<UDPChannelTester> tester = + scoped_refptr<UDPChannelTester> tester( new UDPChannelTester(thread_.message_loop(), host_connection_, - client_connection_); + client_connection_)); tester->Start(ChannelTesterBase::VIDEO_RTP); ASSERT_TRUE(tester->WaitFinished()); tester->CheckResults(); diff --git a/remoting/protocol/jingle_chromotocol_server.cc b/remoting/protocol/jingle_chromotocol_server.cc index 796c63b..2300243 100644 --- a/remoting/protocol/jingle_chromotocol_server.cc +++ b/remoting/protocol/jingle_chromotocol_server.cc @@ -223,8 +223,8 @@ scoped_refptr<ChromotocolConnection> JingleChromotocolServer::Connect( CandidateChromotocolConfig* chromotocol_config, ChromotocolConnection::StateChangeCallback* state_change_callback) { // Can be called from any thread. - scoped_refptr<JingleChromotocolConnection> connection = - new JingleChromotocolConnection(this); + scoped_refptr<JingleChromotocolConnection> connection( + new JingleChromotocolConnection(this)); connection->set_candidate_config(chromotocol_config); message_loop()->PostTask( FROM_HERE, NewRunnableMethod(this, &JingleChromotocolServer::DoConnect, diff --git a/remoting/protocol/message_decoder_unittest.cc b/remoting/protocol/message_decoder_unittest.cc index c2772c8..a2d4b20 100644 --- a/remoting/protocol/message_decoder_unittest.cc +++ b/remoting/protocol/message_decoder_unittest.cc @@ -83,7 +83,7 @@ void SimulateReadSequence(const int read_sequence[], int sequence_size) { int read = std::min(size - i, read_sequence[i % sequence_size]); // And then prepare an IOBuffer for feeding it. - scoped_refptr<net::IOBuffer> buffer = new net::IOBuffer(read); + scoped_refptr<net::IOBuffer> buffer(new net::IOBuffer(read)); memcpy(buffer->data(), test_data + i, read); decoder.ParseMessages(buffer, read, &message_list); i += read; diff --git a/remoting/protocol/protocol_test_client.cc b/remoting/protocol/protocol_test_client.cc index 8113db7..d61c0b5 100644 --- a/remoting/protocol/protocol_test_client.cc +++ b/remoting/protocol/protocol_test_client.cc @@ -125,7 +125,7 @@ void ProtocolTestConnection::Write(const std::string& str) { if (str.empty()) return; - scoped_refptr<net::IOBuffer> buf = new net::IOBuffer(str.length()); + scoped_refptr<net::IOBuffer> buf(new net::IOBuffer(str.length())); memcpy(buf->data(), str.c_str(), str.length()); message_loop_->PostTask( FROM_HERE, NewRunnableMethod( @@ -362,7 +362,7 @@ int main(int argc, char** argv) { usage(argv[0]); std::string auth_token(cmd_line->GetSwitchValueASCII("auth_token")); - scoped_refptr<ProtocolTestClient> client = new ProtocolTestClient(); + scoped_refptr<ProtocolTestClient> client(new ProtocolTestClient()); client->Run(username, auth_token, host_jid); diff --git a/remoting/protocol/util.cc b/remoting/protocol/util.cc index 5a23c93..a12040b 100644 --- a/remoting/protocol/util.cc +++ b/remoting/protocol/util.cc @@ -18,7 +18,7 @@ scoped_refptr<net::IOBufferWithSize> SerializeAndFrameMessage( // int32 of the serialized message size for framing. const int kExtraBytes = sizeof(int32); int size = msg.ByteSize() + kExtraBytes; - scoped_refptr<net::IOBufferWithSize> buffer = new net::IOBufferWithSize(size); + scoped_refptr<net::IOBufferWithSize> buffer(new net::IOBufferWithSize(size)); talk_base::SetBE32(buffer->data(), msg.GetCachedSize()); msg.SerializeWithCachedSizesToArray( reinterpret_cast<uint8*>(buffer->data()) + kExtraBytes); diff --git a/webkit/appcache/appcache_group_unittest.cc b/webkit/appcache/appcache_group_unittest.cc index 128fbc7..c42722c 100644 --- a/webkit/appcache/appcache_group_unittest.cc +++ b/webkit/appcache/appcache_group_unittest.cc @@ -99,39 +99,39 @@ class AppCacheGroupTest : public testing::Test { TEST(AppCacheGroupTest, AddRemoveCache) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://foo.com"), 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, GURL("http://foo.com"), 111)); base::Time now = base::Time::Now(); - scoped_refptr<AppCache> cache1 = new AppCache(&service, 111); + scoped_refptr<AppCache> cache1(new AppCache(&service, 111)); cache1->set_complete(true); cache1->set_update_time(now); group->AddCache(cache1); EXPECT_EQ(cache1, group->newest_complete_cache()); // Adding older cache does not change newest complete cache. - scoped_refptr<AppCache> cache2 = new AppCache(&service, 222); + scoped_refptr<AppCache> cache2(new AppCache(&service, 222)); cache2->set_complete(true); cache2->set_update_time(now - base::TimeDelta::FromDays(1)); group->AddCache(cache2); EXPECT_EQ(cache1, group->newest_complete_cache()); // Adding newer cache does change newest complete cache. - scoped_refptr<AppCache> cache3 = new AppCache(&service, 333); + scoped_refptr<AppCache> cache3(new AppCache(&service, 333)); cache3->set_complete(true); cache3->set_update_time(now + base::TimeDelta::FromDays(1)); group->AddCache(cache3); EXPECT_EQ(cache3, group->newest_complete_cache()); // Adding cache with same update time uses one with larger ID. - scoped_refptr<AppCache> cache4 = new AppCache(&service, 444); + scoped_refptr<AppCache> cache4(new AppCache(&service, 444)); cache4->set_complete(true); cache4->set_update_time(now + base::TimeDelta::FromDays(1)); // same as 3 group->AddCache(cache4); EXPECT_EQ(cache4, group->newest_complete_cache()); - scoped_refptr<AppCache> cache5 = new AppCache(&service, 55); // smaller id + scoped_refptr<AppCache> cache5(new AppCache(&service, 55)); // smaller id cache5->set_complete(true); cache5->set_update_time(now + base::TimeDelta::FromDays(1)); // same as 4 group->AddCache(cache5); @@ -209,8 +209,8 @@ TEST(AppCacheGroupTest, CleanupUnusedGroup) { TEST(AppCacheGroupTest, StartUpdate) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://foo.com"), 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, GURL("http://foo.com"), 111)); // Set state to checking to prevent update job from executing fetches. group->update_status_ = AppCacheGroup::CHECKING; @@ -230,8 +230,8 @@ TEST(AppCacheGroupTest, StartUpdate) { TEST(AppCacheGroupTest, CancelUpdate) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://foo.com"), 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, GURL("http://foo.com"), 111)); // Set state to checking to prevent update job from executing fetches. group->update_status_ = AppCacheGroup::CHECKING; @@ -249,8 +249,8 @@ TEST(AppCacheGroupTest, CancelUpdate) { TEST(AppCacheGroupTest, QueueUpdate) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, GURL("http://foo.com"), 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, GURL("http://foo.com"), 111)); // Set state to checking to prevent update job from executing fetches. group->update_status_ = AppCacheGroup::CHECKING; diff --git a/webkit/appcache/appcache_host_unittest.cc b/webkit/appcache/appcache_host_unittest.cc index 4f83928..5d1f409 100644 --- a/webkit/appcache/appcache_host_unittest.cc +++ b/webkit/appcache/appcache_host_unittest.cc @@ -255,8 +255,8 @@ TEST_F(AppCacheHostTest, SetSwappableCache) { host.SetSwappableCache(NULL); EXPECT_FALSE(host.swappable_cache_.get()); - scoped_refptr<AppCacheGroup> group1 = - new AppCacheGroup(&service_, GURL(), service_.storage()->NewGroupId()); + scoped_refptr<AppCacheGroup> group1( + new AppCacheGroup(&service_, GURL(), service_.storage()->NewGroupId())); host.SetSwappableCache(group1); EXPECT_FALSE(host.swappable_cache_.get()); @@ -281,9 +281,9 @@ TEST_F(AppCacheHostTest, SetSwappableCache) { group1->AddCache(cache2); EXPECT_EQ(cache2, host.swappable_cache_.get()); // updated to newest - scoped_refptr<AppCacheGroup> group2 = + scoped_refptr<AppCacheGroup> group2( new AppCacheGroup(&service_, GURL("http://foo.com"), - service_.storage()->NewGroupId()); + service_.storage()->NewGroupId())); AppCache* cache3 = new AppCache(&service_, 333); cache3->set_complete(true); group2->AddCache(cache3); diff --git a/webkit/appcache/appcache_response_unittest.cc b/webkit/appcache/appcache_response_unittest.cc index bef5b4d0..3c5f692 100644 --- a/webkit/appcache/appcache_response_unittest.cc +++ b/webkit/appcache/appcache_response_unittest.cc @@ -172,7 +172,7 @@ class AppCacheResponseTest : public testing::Test { static const char kHttpHeaders[] = "HTTP/1.0 200 OK\0Content-Length: 5\0\0"; static const char* kHttpBody = "Hello"; - scoped_refptr<IOBuffer> body = new WrappedIOBuffer(kHttpBody); + scoped_refptr<IOBuffer> body(new WrappedIOBuffer(kHttpBody)); std::string raw_headers(kHttpHeaders, arraysize(kHttpHeaders)); WriteResponse(MakeHttpResponseInfo(raw_headers), body, strlen(kHttpBody)); } @@ -456,8 +456,8 @@ class AppCacheResponseTest : public testing::Test { } void WriteOneBlock(int block_number) { - scoped_refptr<IOBuffer> io_buffer = - new IOBuffer(kBlockSize); + scoped_refptr<IOBuffer> io_buffer( + new IOBuffer(kBlockSize)); FillData(block_number, io_buffer->data(), kBlockSize); WriteResponseBody(io_buffer, kBlockSize); } diff --git a/webkit/appcache/appcache_storage_impl.cc b/webkit/appcache/appcache_storage_impl.cc index 518f840..232dffb 100644 --- a/webkit/appcache/appcache_storage_impl.cc +++ b/webkit/appcache/appcache_storage_impl.cc @@ -875,7 +875,7 @@ void AppCacheStorageImpl::Initialize(const FilePath& cache_directory, db_file_path = cache_directory_.Append(kAppCacheDatabaseName); database_ = new AppCacheDatabase(db_file_path); - scoped_refptr<InitTask> task = new InitTask(this); + scoped_refptr<InitTask> task(new InitTask(this)); task->Schedule(); } @@ -888,13 +888,13 @@ void AppCacheStorageImpl::Disable() { working_set()->Disable(); if (disk_cache_.get()) disk_cache_->Disable(); - scoped_refptr<DisableDatabaseTask> task = new DisableDatabaseTask(this); + scoped_refptr<DisableDatabaseTask> task(new DisableDatabaseTask(this)); task->Schedule(); } void AppCacheStorageImpl::GetAllInfo(Delegate* delegate) { DCHECK(delegate); - scoped_refptr<GetAllInfoTask> task = new GetAllInfoTask(this); + scoped_refptr<GetAllInfoTask> task(new GetAllInfoTask(this)); task->AddDelegate(GetOrCreateDelegateReference(delegate)); task->Schedule(); } @@ -910,14 +910,14 @@ void AppCacheStorageImpl::LoadCache(int64 id, Delegate* delegate) { if (cache) { delegate->OnCacheLoaded(cache, id); if (cache->owning_group()) { - scoped_refptr<DatabaseTask> update_task = + scoped_refptr<DatabaseTask> update_task( new UpdateGroupLastAccessTimeTask( - this, cache->owning_group()->group_id(), base::Time::Now()); + this, cache->owning_group()->group_id(), base::Time::Now())); update_task->Schedule(); } return; } - scoped_refptr<CacheLoadTask> task = GetPendingCacheLoadTask(id); + scoped_refptr<CacheLoadTask> task(GetPendingCacheLoadTask(id)); if (task) { task->AddDelegate(GetOrCreateDelegateReference(delegate)); return; @@ -939,14 +939,14 @@ void AppCacheStorageImpl::LoadOrCreateGroup( AppCacheGroup* group = working_set_.GetGroup(manifest_url); if (group) { delegate->OnGroupLoaded(group, manifest_url); - scoped_refptr<DatabaseTask> update_task = + scoped_refptr<DatabaseTask> update_task( new UpdateGroupLastAccessTimeTask( - this, group->group_id(), base::Time::Now()); + this, group->group_id(), base::Time::Now())); update_task->Schedule(); return; } - scoped_refptr<GroupLoadTask> task = GetPendingGroupLoadTask(manifest_url); + scoped_refptr<GroupLoadTask> task(GetPendingGroupLoadTask(manifest_url)); if (task) { task->AddDelegate(GetOrCreateDelegateReference(delegate)); return; @@ -955,8 +955,8 @@ void AppCacheStorageImpl::LoadOrCreateGroup( if (origins_with_groups_.find(manifest_url.GetOrigin()) == origins_with_groups_.end()) { // No need to query the database, return a new group immediately. - scoped_refptr<AppCacheGroup> group = new AppCacheGroup( - service_, manifest_url, NewGroupId()); + scoped_refptr<AppCacheGroup> group(new AppCacheGroup( + service_, manifest_url, NewGroupId())); delegate->OnGroupLoaded(group, manifest_url); return; } @@ -975,8 +975,8 @@ void AppCacheStorageImpl::StoreGroupAndNewestCache( // the simple update case in a very heavy weight way (delete all and // the reinsert all over again). DCHECK(group && delegate && newest_cache); - scoped_refptr<StoreGroupAndCacheTask> task = - new StoreGroupAndCacheTask(this, group, newest_cache); + scoped_refptr<StoreGroupAndCacheTask> task( + new StoreGroupAndCacheTask(this, group, newest_cache)); task->AddDelegate(GetOrCreateDelegateReference(delegate)); task->Schedule(); } @@ -1034,8 +1034,8 @@ void AppCacheStorageImpl::FindResponseForMainRequest( } // We have to query the database, schedule a database task to do so. - scoped_refptr<FindMainResponseTask> task = - new FindMainResponseTask(this, *url_ptr, groups_in_use); + scoped_refptr<FindMainResponseTask> task( + new FindMainResponseTask(this, *url_ptr, groups_in_use)); task->AddDelegate(GetOrCreateDelegateReference(delegate)); task->Schedule(); } @@ -1106,8 +1106,8 @@ void AppCacheStorageImpl::MarkEntryAsForeign( if (entry) entry->add_types(AppCacheEntry::FOREIGN); } - scoped_refptr<MarkEntryAsForeignTask> task = - new MarkEntryAsForeignTask(this, entry_url, cache_id); + scoped_refptr<MarkEntryAsForeignTask> task( + new MarkEntryAsForeignTask(this, entry_url, cache_id)); task->Schedule(); pending_foreign_markings_.push_back(std::make_pair(entry_url, cache_id)); } @@ -1115,8 +1115,8 @@ void AppCacheStorageImpl::MarkEntryAsForeign( void AppCacheStorageImpl::MakeGroupObsolete( AppCacheGroup* group, Delegate* delegate) { DCHECK(group && delegate); - scoped_refptr<MakeGroupObsoleteTask> task = - new MakeGroupObsoleteTask(this, group); + scoped_refptr<MakeGroupObsoleteTask> task( + new MakeGroupObsoleteTask(this, group)); task->AddDelegate(GetOrCreateDelegateReference(delegate)); task->Schedule(); } @@ -1144,8 +1144,8 @@ void AppCacheStorageImpl::DoomResponses( // TODO(michaeln): There is a race here. If the browser crashes // prior to committing these rows to the database and prior to us // having deleted them from the disk cache, we'll never delete them. - scoped_refptr<InsertDeletableResponseIdsTask> task = - new InsertDeletableResponseIdsTask(this); + scoped_refptr<InsertDeletableResponseIdsTask> task( + new InsertDeletableResponseIdsTask(this)); task->response_ids_ = response_ids; task->Schedule(); } @@ -1158,15 +1158,15 @@ void AppCacheStorageImpl::DeleteResponses( } void AppCacheStorageImpl::PurgeMemory() { - scoped_refptr<CloseConnectionTask> task = new CloseConnectionTask(this); + scoped_refptr<CloseConnectionTask> task(new CloseConnectionTask(this)); task->Schedule(); } void AppCacheStorageImpl::DelayedStartDeletingUnusedResponses() { // Only if we haven't already begun. if (!did_start_deleting_responses_) { - scoped_refptr<GetDeletableResponseIdsTask> task = - new GetDeletableResponseIdsTask(this, last_deletable_response_rowid_); + scoped_refptr<GetDeletableResponseIdsTask> task( + new GetDeletableResponseIdsTask(this, last_deletable_response_rowid_)); task->Schedule(); } } @@ -1223,15 +1223,15 @@ void AppCacheStorageImpl::OnDeletedOneResponse(int rv) { const size_t kBatchSize = 50U; if (deleted_response_ids_.size() >= kBatchSize || deletable_response_ids_.empty()) { - scoped_refptr<DeleteDeletableResponseIdsTask> task = - new DeleteDeletableResponseIdsTask(this); + scoped_refptr<DeleteDeletableResponseIdsTask> task( + new DeleteDeletableResponseIdsTask(this)); task->response_ids_.swap(deleted_response_ids_); task->Schedule(); } if (deletable_response_ids_.empty()) { - scoped_refptr<GetDeletableResponseIdsTask> task = - new GetDeletableResponseIdsTask(this, last_deletable_response_rowid_); + scoped_refptr<GetDeletableResponseIdsTask> task( + new GetDeletableResponseIdsTask(this, last_deletable_response_rowid_)); task->Schedule(); return; } diff --git a/webkit/appcache/appcache_storage_impl_unittest.cc b/webkit/appcache/appcache_storage_impl_unittest.cc index 5fccade..6c153a5 100644 --- a/webkit/appcache/appcache_storage_impl_unittest.cc +++ b/webkit/appcache/appcache_storage_impl_unittest.cc @@ -316,7 +316,7 @@ class AppCacheStorageImplTest : public testing::Test { // Setup some preconditions. Make an 'unstored' cache for // us to load. The ctor should put it in the working set. int64 cache_id = storage()->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(service(), cache_id); + scoped_refptr<AppCache> cache(new AppCache(service(), cache_id)); // Conduct the test. storage()->LoadCache(cache_id, delegate()); diff --git a/webkit/appcache/appcache_storage_unittest.cc b/webkit/appcache/appcache_storage_unittest.cc index bdb1111..9e9e57e 100644 --- a/webkit/appcache/appcache_storage_unittest.cc +++ b/webkit/appcache/appcache_storage_unittest.cc @@ -21,7 +21,7 @@ class AppCacheStorageTest : public testing::Test { TEST_F(AppCacheStorageTest, AddRemoveCache) { MockAppCacheService service; - scoped_refptr<AppCache> cache = new AppCache(&service, 111); + scoped_refptr<AppCache> cache(new AppCache(&service, 111)); EXPECT_EQ(cache.get(), service.storage()->working_set()->GetCache(111)); @@ -37,7 +37,7 @@ TEST_F(AppCacheStorageTest, AddRemoveCache) { TEST_F(AppCacheStorageTest, AddRemoveGroup) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = new AppCacheGroup(&service, GURL(), 111); + scoped_refptr<AppCacheGroup> group(new AppCacheGroup(&service, GURL(), 111)); EXPECT_EQ(group.get(), service.storage()->working_set()->GetGroup(GURL())); @@ -52,10 +52,10 @@ TEST_F(AppCacheStorageTest, AddRemoveGroup) { TEST_F(AppCacheStorageTest, AddRemoveResponseInfo) { MockAppCacheService service; - scoped_refptr<AppCacheResponseInfo> info = + scoped_refptr<AppCacheResponseInfo> info( new AppCacheResponseInfo(&service, GURL(), 111, new net::HttpResponseInfo, - kUnkownResponseDataSize); + kUnkownResponseDataSize)); EXPECT_EQ(info.get(), service.storage()->working_set()->GetResponseInfo(111)); diff --git a/webkit/appcache/appcache_unittest.cc b/webkit/appcache/appcache_unittest.cc index 8fcde53..d0583f8 100644 --- a/webkit/appcache/appcache_unittest.cc +++ b/webkit/appcache/appcache_unittest.cc @@ -34,7 +34,7 @@ TEST(AppCacheTest, CleanupUnusedCache) { TEST(AppCacheTest, AddModifyRemoveEntry) { MockAppCacheService service; - scoped_refptr<AppCache> cache = new AppCache(&service, 111); + scoped_refptr<AppCache> cache(new AppCache(&service, 111)); EXPECT_TRUE(cache->entries().empty()); EXPECT_EQ(0L, cache->cache_size()); @@ -79,7 +79,7 @@ TEST(AppCacheTest, AddModifyRemoveEntry) { TEST(AppCacheTest, InitializeWithManifest) { MockAppCacheService service; - scoped_refptr<AppCache> cache = new AppCache(&service, 1234); + scoped_refptr<AppCache> cache(new AppCache(&service, 1234)); EXPECT_TRUE(cache->fallback_namespaces_.empty()); EXPECT_TRUE(cache->online_whitelist_namespaces_.empty()); EXPECT_FALSE(cache->online_whitelist_all_); @@ -144,7 +144,7 @@ TEST(AppCacheTest, FindResponseForRequest) { FallbackNamespace(kFallbackNamespaceUrl2, kFallbackEntryUrl2)); // Create a cache with some namespaces and entries. - scoped_refptr<AppCache> cache = new AppCache(&service, 1234); + scoped_refptr<AppCache> cache(new AppCache(&service, 1234)); cache->InitializeWithManifest(&manifest); cache->AddEntry( kFallbackEntryUrl1, diff --git a/webkit/appcache/appcache_update_job.cc b/webkit/appcache/appcache_update_job.cc index 3aeb497..94d8a05 100644 --- a/webkit/appcache/appcache_update_job.cc +++ b/webkit/appcache/appcache_update_job.cc @@ -353,9 +353,9 @@ void AppCacheUpdateJob::OnResponseStarted(URLRequest *request) { service_->storage()->CreateResponseWriter(manifest_url_), this, request); stored_response_ids_.push_back(info->response_writer_->response_id()); - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( new HttpResponseInfoIOBuffer( - new net::HttpResponseInfo(request->response_info())); + new net::HttpResponseInfo(request->response_info()))); info->response_writer_->WriteInfo(io_buffer, &info->write_callback_); } else { ReadResponseData(request); @@ -782,8 +782,8 @@ void AppCacheUpdateJob::HandleManifestRefetchCompleted(URLRequest* request) { manifest_response_writer_.reset( service_->storage()->CreateResponseWriter(manifest_url_)); stored_response_ids_.push_back(manifest_response_writer_->response_id()); - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = - new HttpResponseInfoIOBuffer(manifest_response_info_.release()); + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( + new HttpResponseInfoIOBuffer(manifest_response_info_.release())); manifest_response_writer_->WriteInfo(io_buffer, &manifest_info_write_callback_); } @@ -798,8 +798,8 @@ void AppCacheUpdateJob::HandleManifestRefetchCompleted(URLRequest* request) { void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) { if (result > 0) { - scoped_refptr<net::StringIOBuffer> io_buffer = - new net::StringIOBuffer(manifest_data_); + scoped_refptr<net::StringIOBuffer> io_buffer( + new net::StringIOBuffer(manifest_data_)); manifest_response_writer_->WriteData(io_buffer, manifest_data_.length(), &manifest_data_write_callback_); } else { diff --git a/webkit/appcache/appcache_update_job_unittest.cc b/webkit/appcache/appcache_update_job_unittest.cc index 948c8a0..eddb8e4 100644 --- a/webkit/appcache/appcache_update_job_unittest.cc +++ b/webkit/appcache/appcache_update_job_unittest.cc @@ -997,8 +997,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Seed storage with expected manifest data. const std::string seed_data(kManifest1Contents); - scoped_refptr<net::StringIOBuffer> io_buffer = - new net::StringIOBuffer(seed_data); + scoped_refptr<net::StringIOBuffer> io_buffer( + new net::StringIOBuffer(seed_data)); write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -1100,8 +1100,8 @@ class AppCacheUpdateJobTest : public testing::Test, // Seed storage with expected manifest data different from manifest1. const std::string seed_data("different"); - scoped_refptr<net::StringIOBuffer> io_buffer = - new net::StringIOBuffer(seed_data); + scoped_refptr<net::StringIOBuffer> io_buffer( + new net::StringIOBuffer(seed_data)); write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -1162,8 +1162,8 @@ class AppCacheUpdateJobTest : public testing::Test, response_info->request_time = base::Time::Now(); response_info->response_time = base::Time::Now(); response_info->headers = headers; // adds ref to headers - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = - new HttpResponseInfoIOBuffer(response_info); // adds ref to info + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( + new HttpResponseInfoIOBuffer(response_info)); // adds ref to info write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -1220,8 +1220,8 @@ class AppCacheUpdateJobTest : public testing::Test, response_info->request_time = base::Time::Now(); response_info->response_time = base::Time::Now(); response_info->headers = headers; // adds ref to headers - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = - new HttpResponseInfoIOBuffer(response_info); // adds ref to info + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( + new HttpResponseInfoIOBuffer(response_info)); // adds ref to info write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -1278,8 +1278,8 @@ class AppCacheUpdateJobTest : public testing::Test, response_info->request_time = base::Time::Now(); response_info->response_time = base::Time::Now(); response_info->headers = headers; // adds ref to headers - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = - new HttpResponseInfoIOBuffer(response_info); // adds ref to info + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( + new HttpResponseInfoIOBuffer(response_info)); // adds ref to info write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -1829,9 +1829,9 @@ class AppCacheUpdateJobTest : public testing::Test, group_ = new AppCacheGroup( service_.get(), kManifestUrl, service_->storage()->NewGroupId()); - scoped_refptr<AppCache> cache = + scoped_refptr<AppCache> cache( MakeCacheForGroup(service_->storage()->NewCacheId(), - kManifestResponseId); + kManifestResponseId)); MockFrontend* frontend = MakeMockFrontend(); AppCacheHost* host = MakeHost(1, frontend); @@ -2686,8 +2686,8 @@ class AppCacheUpdateJobTest : public testing::Test, new net::HttpResponseHeaders(std::string(data, arraysize(data))); net::HttpResponseInfo* response_info = new net::HttpResponseInfo(); response_info->headers = headers; // adds ref to headers - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = - new HttpResponseInfoIOBuffer(response_info); // adds ref to info + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( + new HttpResponseInfoIOBuffer(response_info)); // adds ref to info write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -2744,8 +2744,8 @@ class AppCacheUpdateJobTest : public testing::Test, new net::HttpResponseHeaders(std::string(data, arraysize(data))); net::HttpResponseInfo* response_info = new net::HttpResponseInfo(); response_info->headers = headers; // adds ref to headers - scoped_refptr<HttpResponseInfoIOBuffer> io_buffer = - new HttpResponseInfoIOBuffer(response_info); // adds ref to info + scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( + new HttpResponseInfoIOBuffer(response_info)); // adds ref to info write_callback_.reset( new net::CompletionCallbackImpl<AppCacheUpdateJobTest>(this, &AppCacheUpdateJobTest::StartUpdateAfterSeedingStorageData)); @@ -2895,9 +2895,9 @@ class AppCacheUpdateJobTest : public testing::Test, const std::string& raw_headers) { net::HttpResponseInfo* http_info = new net::HttpResponseInfo(); http_info->headers = new net::HttpResponseHeaders(raw_headers); - scoped_refptr<AppCacheResponseInfo> info = + scoped_refptr<AppCacheResponseInfo> info( new AppCacheResponseInfo(service_.get(), manifest_url, - response_id, http_info, 0); + response_id, http_info, 0)); response_infos_.push_back(info); return info; } @@ -3219,9 +3219,9 @@ base::WaitableEvent* AppCacheUpdateJobTest::io_thread_shutdown_event_ = NULL; TEST_F(AppCacheUpdateJobTest, AlreadyChecking) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = + scoped_refptr<AppCacheGroup> group( new AppCacheGroup(&service, GURL("http://manifesturl.com"), - service.storage()->NewGroupId()); + service.storage()->NewGroupId())); AppCacheUpdateJob update(&service, group); @@ -3247,9 +3247,9 @@ TEST_F(AppCacheUpdateJobTest, AlreadyChecking) { TEST_F(AppCacheUpdateJobTest, AlreadyDownloading) { MockAppCacheService service; - scoped_refptr<AppCacheGroup> group = + scoped_refptr<AppCacheGroup> group( new AppCacheGroup(&service, GURL("http://manifesturl.com"), - service.storage()->NewGroupId()); + service.storage()->NewGroupId())); AppCacheUpdateJob update(&service, group); diff --git a/webkit/appcache/appcache_url_request_job_unittest.cc b/webkit/appcache/appcache_url_request_job_unittest.cc index f3a3ed2..2475c79 100644 --- a/webkit/appcache/appcache_url_request_job_unittest.cc +++ b/webkit/appcache/appcache_url_request_job_unittest.cc @@ -104,8 +104,8 @@ class AppCacheURLRequestJobTest : public testing::Test { void ReadSome(URLRequest* request) { DCHECK(amount_received_ + kBlockSize <= kNumBlocks * kBlockSize); - scoped_refptr<IOBuffer> wrapped_buffer = - new net::WrappedIOBuffer(received_data_->data() + amount_received_); + scoped_refptr<IOBuffer> wrapped_buffer( + new net::WrappedIOBuffer(received_data_->data() + amount_received_)); int bytes_read = 0; EXPECT_FALSE(request->Read(wrapped_buffer, kBlockSize, &bytes_read)); EXPECT_EQ(0, bytes_read); @@ -264,7 +264,7 @@ class AppCacheURLRequestJobTest : public testing::Test { // Wrappers to call AppCacheResponseReader/Writer Read and Write methods void WriteBasicResponse() { - scoped_refptr<IOBuffer> body = new WrappedIOBuffer(kHttpBasicBody); + scoped_refptr<IOBuffer> body(new WrappedIOBuffer(kHttpBasicBody)); std::string raw_headers(kHttpBasicHeaders, arraysize(kHttpBasicHeaders)); WriteResponse(MakeHttpResponseInfo(raw_headers), body, strlen(kHttpBasicBody)); @@ -603,7 +603,7 @@ class AppCacheURLRequestJobTest : public testing::Test { // 3, 1k blocks static const char kHttpHeaders[] = "HTTP/1.0 200 OK\0Content-Length: 3072\0\0"; - scoped_refptr<IOBuffer> body = new IOBuffer(kBlockSize * 3); + scoped_refptr<IOBuffer> body(new IOBuffer(kBlockSize * 3)); char* p = body->data(); for (int i = 0; i < 3; ++i, p += kBlockSize) FillData(i + 1, p, kBlockSize); diff --git a/webkit/appcache/mock_appcache_storage.cc b/webkit/appcache/mock_appcache_storage.cc index 6bf3e8d..a50dca6 100644 --- a/webkit/appcache/mock_appcache_storage.cc +++ b/webkit/appcache/mock_appcache_storage.cc @@ -171,7 +171,7 @@ void MockAppCacheStorage::ProcessLoadCache( void MockAppCacheStorage::ProcessLoadOrCreateGroup( const GURL& manifest_url, scoped_refptr<DelegateReference> delegate_ref) { - scoped_refptr<AppCacheGroup> group = working_set_.GetGroup(manifest_url); + scoped_refptr<AppCacheGroup> group(working_set_.GetGroup(manifest_url)); // Newly created groups are not put in the stored_groups collection // until StoreGroupAndNewestCache is called. diff --git a/webkit/appcache/mock_appcache_storage_unittest.cc b/webkit/appcache/mock_appcache_storage_unittest.cc index 5be333a..3bd8ca6 100644 --- a/webkit/appcache/mock_appcache_storage_unittest.cc +++ b/webkit/appcache/mock_appcache_storage_unittest.cc @@ -92,7 +92,7 @@ TEST_F(MockAppCacheStorageTest, LoadCache_NearHit) { // Setup some preconditions. Make an 'unstored' cache for // us to load. The ctor should put it in the working set. int64 cache_id = service.storage()->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); + scoped_refptr<AppCache> cache(new AppCache(&service, cache_id)); // Conduct the test. MockStorageDelegate delegate; @@ -157,10 +157,10 @@ TEST_F(MockAppCacheStorageTest, LoadGroupAndCache_FarHit) { // Setup some preconditions. Create a group and newest cache that // appears to be "stored" and "not currently in use". GURL manifest_url("http://blah/"); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, manifest_url, 111)); int64 cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); + scoped_refptr<AppCache> cache(new AppCache(&service, cache_id)); cache->set_complete(true); group->AddCache(cache); storage->AddStoredGroup(group); @@ -208,10 +208,10 @@ TEST_F(MockAppCacheStorageTest, StoreNewGroup) { // Setup some preconditions. Create a group and newest cache that // appears to be "unstored". GURL manifest_url("http://blah/"); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, manifest_url, 111)); int64 cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); + scoped_refptr<AppCache> cache(new AppCache(&service, cache_id)); // Hold a ref to the cache simulate the UpdateJob holding that ref, // and hold a ref to the group to simulate the CacheHost holding that ref. @@ -240,16 +240,16 @@ TEST_F(MockAppCacheStorageTest, StoreExistingGroup) { // Setup some preconditions. Create a group and old complete cache // that appear to be "stored", and a newest unstored complete cache. GURL manifest_url("http://blah/"); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, manifest_url, 111)); int64 old_cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> old_cache = new AppCache(&service, old_cache_id); + scoped_refptr<AppCache> old_cache(new AppCache(&service, old_cache_id)); old_cache->set_complete(true); group->AddCache(old_cache); storage->AddStoredGroup(group); storage->AddStoredCache(old_cache); int64 new_cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> new_cache = new AppCache(&service, new_cache_id); + scoped_refptr<AppCache> new_cache(new AppCache(&service, new_cache_id)); // Hold our refs to simulate the UpdateJob holding these refs. // Conduct the test. @@ -283,10 +283,10 @@ TEST_F(MockAppCacheStorageTest, StoreExistingGroupExistingCache) { // Setup some preconditions. Create a group and a complete cache that // appear to be "stored". GURL manifest_url("http://blah"); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, manifest_url, 111)); int64 cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); + scoped_refptr<AppCache> cache(new AppCache(&service, cache_id)); cache->set_complete(true); group->AddCache(cache); storage->AddStoredGroup(group); @@ -325,10 +325,10 @@ TEST_F(MockAppCacheStorageTest, MakeGroupObsolete) { // Setup some preconditions. Create a group and newest cache that // appears to be "stored" and "currently in use". GURL manifest_url("http://blah/"); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, manifest_url, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, manifest_url, 111)); int64 cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); + scoped_refptr<AppCache> cache(new AppCache(&service, cache_id)); cache->set_complete(true); group->AddCache(cache); storage->AddStoredGroup(group); @@ -370,7 +370,7 @@ TEST_F(MockAppCacheStorageTest, MarkEntryAsForeign) { // Setup some preconditions. Create a cache with an entry. GURL entry_url("http://blah/entry"); int64 cache_id = storage->NewCacheId(); - scoped_refptr<AppCache> cache = new AppCache(&service, cache_id); + scoped_refptr<AppCache> cache(new AppCache(&service, cache_id)); cache->AddEntry(entry_url, AppCacheEntry(AppCacheEntry::EXPLICIT)); // Conduct the test. @@ -414,12 +414,12 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainResponse) { const GURL kEntryUrl("http://blah/entry"); const GURL kManifestUrl("http://blah/manifest"); const int64 kResponseId = 1; - scoped_refptr<AppCache> cache = new AppCache(&service, kCacheId); + scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId)); cache->AddEntry( kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, kResponseId)); cache->set_complete(true); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, kManifestUrl, 111)); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -461,7 +461,7 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainFallbackResponse) { manifest.fallback_namespaces.push_back( FallbackNamespace(kFallbackNamespaceUrl2, kFallbackEntryUrl2)); - scoped_refptr<AppCache> cache = new AppCache(&service, kCacheId); + scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId)); cache->InitializeWithManifest(&manifest); cache->AddEntry( kFallbackEntryUrl1, AppCacheEntry(AppCacheEntry::FALLBACK, kResponseId1)); @@ -469,8 +469,8 @@ TEST_F(MockAppCacheStorageTest, BasicFindMainFallbackResponse) { kFallbackEntryUrl2, AppCacheEntry(AppCacheEntry::FALLBACK, kResponseId2)); cache->set_complete(true); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, kManifestUrl, 111)); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -511,12 +511,12 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseWithMultipleCandidates) { const int64 kResponseId2 = 2; // The first cache. - scoped_refptr<AppCache> cache = new AppCache(&service, kCacheId1); + scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId1)); cache->AddEntry( kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT, kResponseId1)); cache->set_complete(true); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl1, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, kManifestUrl1, 111)); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); @@ -567,15 +567,15 @@ TEST_F(MockAppCacheStorageTest, FindMainResponseExclusions) { Manifest manifest; manifest.online_whitelist_namespaces.push_back(kOnlineNamespaceUrl); - scoped_refptr<AppCache> cache = new AppCache(&service, kCacheId); + scoped_refptr<AppCache> cache(new AppCache(&service, kCacheId)); cache->InitializeWithManifest(&manifest); cache->AddEntry( kEntryUrl, AppCacheEntry(AppCacheEntry::EXPLICIT | AppCacheEntry::FOREIGN, kResponseId)); cache->set_complete(true); - scoped_refptr<AppCacheGroup> group = - new AppCacheGroup(&service, kManifestUrl, 111); + scoped_refptr<AppCacheGroup> group( + new AppCacheGroup(&service, kManifestUrl, 111)); group->AddCache(cache); storage->AddStoredGroup(group); storage->AddStoredCache(cache); diff --git a/webkit/blob/blob_storage_controller.cc b/webkit/blob/blob_storage_controller.cc index e813be2..de70774 100644 --- a/webkit/blob/blob_storage_controller.cc +++ b/webkit/blob/blob_storage_controller.cc @@ -19,7 +19,7 @@ BlobStorageController::~BlobStorageController() { void BlobStorageController::RegisterBlobUrl( const GURL& url, const BlobData* blob_data) { - scoped_refptr<BlobData> target_blob_data = new BlobData(); + scoped_refptr<BlobData> target_blob_data(new BlobData()); target_blob_data->set_content_type(blob_data->content_type()); target_blob_data->set_content_disposition(blob_data->content_disposition()); diff --git a/webkit/blob/blob_storage_controller_unittest.cc b/webkit/blob/blob_storage_controller_unittest.cc index e977585..6d6f0d1 100644 --- a/webkit/blob/blob_storage_controller_unittest.cc +++ b/webkit/blob/blob_storage_controller_unittest.cc @@ -21,19 +21,19 @@ TEST(BlobStorageControllerTest, RegisterBlobUrl) { base::Time::FromString(L"Tue, 15 Nov 1994, 12:45:26 GMT", &time1); base::Time::FromString(L"Mon, 14 Nov 1994, 11:30:49 GMT", &time2); - scoped_refptr<BlobData> blob_data1 = new BlobData(); + scoped_refptr<BlobData> blob_data1(new BlobData()); blob_data1->AppendData("Data1"); blob_data1->AppendData("Data2"); blob_data1->AppendFile(FilePath(FILE_PATH_LITERAL("File1.txt")), 10, 1024, time1); - scoped_refptr<BlobData> blob_data2 = new BlobData(); + scoped_refptr<BlobData> blob_data2(new BlobData()); blob_data2->AppendData("Data3"); blob_data2->AppendBlob(GURL("blob://url_1"), 8, 100); blob_data2->AppendFile(FilePath(FILE_PATH_LITERAL("File2.txt")), 0, 20, time2); - scoped_refptr<BlobData> canonicalized_blob_data2 = new BlobData(); + scoped_refptr<BlobData> canonicalized_blob_data2(new BlobData()); canonicalized_blob_data2->AppendData("Data3"); canonicalized_blob_data2->AppendData("Data2", 3, 2); canonicalized_blob_data2->AppendFile(FilePath(FILE_PATH_LITERAL("File1.txt")), @@ -86,7 +86,7 @@ TEST(BlobStorageControllerTest, ResolveBlobReferencesInUploadData) { scoped_ptr<BlobStorageController> blob_storage_controller( new BlobStorageController()); - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); GURL blob_url0("blob://url_0"); blob_storage_controller->RegisterBlobUrl(blob_url0, blob_data); @@ -122,7 +122,7 @@ TEST(BlobStorageControllerTest, ResolveBlobReferencesInUploadData) { FilePath(FILE_PATH_LITERAL("foo1.txt")), 0, 20, time2); // Test no blob reference. - scoped_refptr<UploadData> upload_data = new UploadData(); + scoped_refptr<UploadData> upload_data(new UploadData()); upload_data->AppendBytes( &upload_element1.bytes().at(0), upload_element1.bytes().size()); diff --git a/webkit/blob/blob_url_request_job_unittest.cc b/webkit/blob/blob_url_request_job_unittest.cc index ad4ecb4..2fb2337 100644 --- a/webkit/blob/blob_url_request_job_unittest.cc +++ b/webkit/blob/blob_url_request_job_unittest.cc @@ -271,13 +271,13 @@ class BlobURLRequestJobTest : public testing::Test { // Test Cases --------------------------------------------------------------- void TestGetSimpleDataRequest() { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->AppendData(kTestData1); TestSuccessRequest(blob_data, kTestData1); } void TestGetSimpleFileRequest() { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->AppendFile(temp_file1_, 0, -1, base::Time()); TestSuccessRequest(blob_data, kTestFileData1); } @@ -285,13 +285,13 @@ class BlobURLRequestJobTest : public testing::Test { void TestGetNonExistentFileRequest() { FilePath non_existent_file = temp_file1_.InsertBeforeExtension(FILE_PATH_LITERAL("-na")); - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->AppendFile(non_existent_file, 0, -1, base::Time()); TestErrorRequest(blob_data, 404); } void TestGetChangedFileRequest() { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); base::Time old_time = temp_file_modification_time1_ - base::TimeDelta::FromSeconds(10); blob_data->AppendFile(temp_file1_, 0, 3, old_time); @@ -299,21 +299,21 @@ class BlobURLRequestJobTest : public testing::Test { } void TestGetSlicedDataRequest() { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->AppendData(kTestData2, 2, 4); std::string result(kTestData2 + 2, 4); TestSuccessRequest(blob_data, result); } void TestGetSlicedFileRequest() { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->AppendFile(temp_file1_, 2, 4, temp_file_modification_time1_); std::string result(kTestFileData1 + 2, 4); TestSuccessRequest(blob_data, result); } scoped_refptr<BlobData> BuildComplicatedData(std::string* expected_result) { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->AppendData(kTestData1, 1, 2); blob_data->AppendFile(temp_file1_, 2, 3, temp_file_modification_time1_); blob_data->AppendData(kTestData2, 3, 4); @@ -356,7 +356,7 @@ class BlobURLRequestJobTest : public testing::Test { } void TestExtraHeaders() { - scoped_refptr<BlobData> blob_data = new BlobData(); + scoped_refptr<BlobData> blob_data(new BlobData()); blob_data->set_content_type(kTestContentType); blob_data->set_content_disposition(kTestContentDisposition); blob_data->AppendData(kTestData1); diff --git a/webkit/blob/deletable_file_reference.cc b/webkit/blob/deletable_file_reference.cc index 9f49943..87ef4cc 100644 --- a/webkit/blob/deletable_file_reference.cc +++ b/webkit/blob/deletable_file_reference.cc @@ -42,8 +42,8 @@ scoped_refptr<DeletableFileReference> DeletableFileReference::GetOrCreate( return scoped_refptr<DeletableFileReference>(result.first->second); // Wasn't in the map, create a new reference and store the pointer. - scoped_refptr<DeletableFileReference> reference = - new DeletableFileReference(path, file_thread); + scoped_refptr<DeletableFileReference> reference( + new DeletableFileReference(path, file_thread)); result.first->second = reference.get(); return reference; } diff --git a/webkit/fileapi/file_system_path_manager.cc b/webkit/fileapi/file_system_path_manager.cc index a81c254..c974dba 100644 --- a/webkit/fileapi/file_system_path_manager.cc +++ b/webkit/fileapi/file_system_path_manager.cc @@ -216,9 +216,9 @@ void FileSystemPathManager::GetFileSystemRootPath( .AppendASCII(type_string); std::string name = storage_identifier + ":" + type_string; - scoped_refptr<GetFileSystemRootPathTask> task = + scoped_refptr<GetFileSystemRootPathTask> task( new GetFileSystemRootPathTask(file_message_loop_, - name, callback.release()); + name, callback.release())); task->Start(origin_url, origin_base_path, create); } diff --git a/webkit/glue/media/buffered_data_source_unittest.cc b/webkit/glue/media/buffered_data_source_unittest.cc index 929d8d9..81103b2 100644 --- a/webkit/glue/media/buffered_data_source_unittest.cc +++ b/webkit/glue/media/buffered_data_source_unittest.cc @@ -608,8 +608,8 @@ class BufferedDataSourceTest : public testing::Test { // There is no need to provide a message loop to data source. data_source_->set_host(&host_); - scoped_refptr<NiceMock<MockBufferedResourceLoader> > first_loader = - new NiceMock<MockBufferedResourceLoader>(); + scoped_refptr<NiceMock<MockBufferedResourceLoader> > first_loader( + new NiceMock<MockBufferedResourceLoader>()); // Creates the mock loader to be injected. loader_ = first_loader; diff --git a/webkit/glue/plugins/npapi_extension_thunk.cc b/webkit/glue/plugins/npapi_extension_thunk.cc index 4779535..05a9c5d 100644 --- a/webkit/glue/plugins/npapi_extension_thunk.cc +++ b/webkit/glue/plugins/npapi_extension_thunk.cc @@ -28,7 +28,7 @@ static NPAPI::PluginInstance* FindInstance(NPP id) { static NPError Device2DQueryCapability(NPP id, int32_t capability, int32_t* value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { plugin->webplugin()->delegate()->Device2DQueryCapability(capability, value); return NPERR_NO_ERROR; @@ -40,7 +40,7 @@ static NPError Device2DQueryCapability(NPP id, int32_t capability, static NPError Device2DQueryConfig(NPP id, const NPDeviceConfig* request, NPDeviceConfig* obtain) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device2DQueryConfig( static_cast<const NPDeviceContext2DConfig*>(request), @@ -52,7 +52,7 @@ static NPError Device2DQueryConfig(NPP id, static NPError Device2DInitializeContext(NPP id, const NPDeviceConfig* config, NPDeviceContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device2DInitializeContext( static_cast<const NPDeviceContext2DConfig*>(config), @@ -65,7 +65,7 @@ static NPError Device2DSetStateContext(NPP id, NPDeviceContext* context, int32_t state, intptr_t value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device2DSetStateContext( static_cast<NPDeviceContext2D*>(context), state, value); @@ -77,7 +77,7 @@ static NPError Device2DGetStateContext(NPP id, NPDeviceContext* context, int32_t state, intptr_t* value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device2DGetStateContext( static_cast<NPDeviceContext2D*>(context), state, value); @@ -89,7 +89,7 @@ static NPError Device2DFlushContext(NPP id, NPDeviceContext* context, NPDeviceFlushContextCallbackPtr callback, void* user_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { NPError err = plugin->webplugin()->delegate()->Device2DFlushContext( id, static_cast<NPDeviceContext2D*>(context), callback, user_data); @@ -109,7 +109,7 @@ static NPError Device2DFlushContext(NPP id, static NPError Device2DDestroyContext(NPP id, NPDeviceContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device2DDestroyContext( static_cast<NPDeviceContext2D*>(context)); @@ -141,7 +141,7 @@ static NPError Device2DMapBuffer(NPP id, static NPError Device3DQueryCapability(NPP id, int32_t capability, int32_t* value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { plugin->webplugin()->delegate()->Device3DQueryCapability(capability, value); return NPERR_NO_ERROR; @@ -153,7 +153,7 @@ static NPError Device3DQueryCapability(NPP id, int32_t capability, static NPError Device3DQueryConfig(NPP id, const NPDeviceConfig* request, NPDeviceConfig* obtain) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DQueryConfig( static_cast<const NPDeviceContext3DConfig*>(request), @@ -165,7 +165,7 @@ static NPError Device3DQueryConfig(NPP id, static NPError Device3DInitializeContext(NPP id, const NPDeviceConfig* config, NPDeviceContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DInitializeContext( static_cast<const NPDeviceContext3DConfig*>(config), @@ -178,7 +178,7 @@ static NPError Device3DSetStateContext(NPP id, NPDeviceContext* context, int32_t state, intptr_t value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DSetStateContext( static_cast<NPDeviceContext3D*>(context), state, value); @@ -190,7 +190,7 @@ static NPError Device3DGetStateContext(NPP id, NPDeviceContext* context, int32_t state, intptr_t* value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DGetStateContext( static_cast<NPDeviceContext3D*>(context), state, value); @@ -202,7 +202,7 @@ static NPError Device3DFlushContext(NPP id, NPDeviceContext* context, NPDeviceFlushContextCallbackPtr callback, void* user_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DFlushContext( id, static_cast<NPDeviceContext3D*>(context), callback, user_data); @@ -212,7 +212,7 @@ static NPError Device3DFlushContext(NPP id, static NPError Device3DDestroyContext(NPP id, NPDeviceContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DDestroyContext( static_cast<NPDeviceContext3D*>(context)); @@ -224,7 +224,7 @@ static NPError Device3DCreateBuffer(NPP id, NPDeviceContext* context, size_t size, int32_t* buffer_id) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DCreateBuffer( static_cast<NPDeviceContext3D*>(context), size, buffer_id); @@ -235,7 +235,7 @@ static NPError Device3DCreateBuffer(NPP id, static NPError Device3DDestroyBuffer(NPP id, NPDeviceContext* context, int32_t buffer_id) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DDestroyBuffer( static_cast<NPDeviceContext3D*>(context), buffer_id); @@ -247,7 +247,7 @@ static NPError Device3DMapBuffer(NPP id, NPDeviceContext* context, int32_t buffer_id, NPDeviceBuffer* buffer) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DMapBuffer( static_cast<NPDeviceContext3D*>(context), buffer_id, buffer); @@ -258,7 +258,7 @@ static NPError Device3DMapBuffer(NPP id, // Experimental 3D device API -------------------------------------------------- static NPError Device3DGetNumConfigs(NPP id, int32_t* num_configs) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DGetNumConfigs(num_configs); } @@ -268,7 +268,7 @@ static NPError Device3DGetNumConfigs(NPP id, int32_t* num_configs) { static NPError Device3DGetConfigAttribs(NPP id, int32_t config, int32_t* attrib_list) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DGetConfigAttribs( config, @@ -281,7 +281,7 @@ static NPError Device3DCreateContext(NPP id, int32_t config, const int32_t* attrib_list, NPDeviceContext** context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DCreateContext( config, @@ -299,7 +299,7 @@ static NPError Device3DSynchronizeContext( int32_t* output_attrib_list, NPDeviceSynchronizeContextCallbackPtr callback, void* callback_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DSynchronizeContext( id, @@ -319,7 +319,7 @@ static NPError Device3DRegisterCallback( int32_t callback_type, NPDeviceGenericCallbackPtr callback, void* callback_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->Device3DRegisterCallback( id, @@ -335,7 +335,7 @@ static NPError Device3DRegisterCallback( static NPError DeviceAudioQueryCapability(NPP id, int32_t capability, int32_t* value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { plugin->webplugin()->delegate()->DeviceAudioQueryCapability(capability, value); @@ -348,7 +348,7 @@ static NPError DeviceAudioQueryCapability(NPP id, int32_t capability, static NPError DeviceAudioQueryConfig(NPP id, const NPDeviceConfig* request, NPDeviceConfig* obtain) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->DeviceAudioQueryConfig( static_cast<const NPDeviceContextAudioConfig*>(request), @@ -360,7 +360,7 @@ static NPError DeviceAudioQueryConfig(NPP id, static NPError DeviceAudioInitializeContext(NPP id, const NPDeviceConfig* config, NPDeviceContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->DeviceAudioInitializeContext( static_cast<const NPDeviceContextAudioConfig*>(config), @@ -373,7 +373,7 @@ static NPError DeviceAudioSetStateContext(NPP id, NPDeviceContext* context, int32_t state, intptr_t value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { return plugin->webplugin()->delegate()->DeviceAudioSetStateContext( static_cast<NPDeviceContextAudio*>(context), state, value); @@ -385,7 +385,7 @@ static NPError DeviceAudioGetStateContext(NPP id, NPDeviceContext* context, int32_t state, intptr_t* value) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); return plugin->webplugin()->delegate()->DeviceAudioGetStateContext( static_cast<NPDeviceContextAudio*>(context), state, value); } @@ -394,14 +394,14 @@ static NPError DeviceAudioFlushContext(NPP id, NPDeviceContext* context, NPDeviceFlushContextCallbackPtr callback, void* user_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); return plugin->webplugin()->delegate()->DeviceAudioFlushContext( id, static_cast<NPDeviceContextAudio*>(context), callback, user_data); } static NPError DeviceAudioDestroyContext(NPP id, NPDeviceContext* context) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); return plugin->webplugin()->delegate()->DeviceAudioDestroyContext( static_cast<NPDeviceContextAudio*>(context)); } @@ -477,7 +477,7 @@ static NPError ChooseFile(NPP id, NPChooseFileMode mode, NPChooseFileCallback callback, void* user_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return NPERR_GENERIC_ERROR; @@ -490,7 +490,7 @@ static NPError ChooseFile(NPP id, } static void NumberOfFindResultsChanged(NPP id, int total, bool final_result) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) { plugin->webplugin()->delegate()->NumberOfFindResultsChanged( total, final_result); @@ -498,13 +498,13 @@ static void NumberOfFindResultsChanged(NPP id, int total, bool final_result) { } static void SelectedFindResultChanged(NPP id, int index) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) plugin->webplugin()->delegate()->SelectedFindResultChanged(index); } static NPWidgetExtensions* GetWidgetExtensions(NPP id) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return NULL; @@ -512,7 +512,7 @@ static NPWidgetExtensions* GetWidgetExtensions(NPP id) { } static NPError NPSetCursor(NPP id, NPCursorType type) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return NPERR_GENERIC_ERROR; @@ -521,7 +521,7 @@ static NPError NPSetCursor(NPP id, NPCursorType type) { } static NPFontExtensions* GetFontExtensions(NPP id) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return NULL; diff --git a/webkit/glue/plugins/plugin_host.cc b/webkit/glue/plugins/plugin_host.cc index add6c03..6345fb1 100644 --- a/webkit/glue/plugins/plugin_host.cc +++ b/webkit/glue/plugins/plugin_host.cc @@ -280,7 +280,7 @@ extern "C" { // Allocates memory from the host's memory space. void* NPN_MemAlloc(uint32_t size) { - scoped_refptr<NPAPI::PluginHost> host = NPAPI::PluginHost::Singleton(); + scoped_refptr<NPAPI::PluginHost> host(NPAPI::PluginHost::Singleton()); if (host != NULL) { // Note: We must use the same allocator/deallocator // that is used by the javascript library, as some of the @@ -293,7 +293,7 @@ void* NPN_MemAlloc(uint32_t size) { // Deallocates memory from the host's memory space void NPN_MemFree(void* ptr) { - scoped_refptr<NPAPI::PluginHost> host = NPAPI::PluginHost::Singleton(); + scoped_refptr<NPAPI::PluginHost> host(NPAPI::PluginHost::Singleton()); if (host != NULL) { if (ptr != NULL && ptr != reinterpret_cast<void*>(-1)) free(ptr); @@ -318,8 +318,8 @@ NPError NPN_RequestRead(NPStream* stream, NPByteRange* range_list) { if (!stream || !range_list) return NPERR_GENERIC_ERROR; - scoped_refptr<NPAPI::PluginInstance> plugin = - reinterpret_cast<NPAPI::PluginInstance*>(stream->ndata); + scoped_refptr<NPAPI::PluginInstance> plugin( + reinterpret_cast<NPAPI::PluginInstance*>(stream->ndata)); if (!plugin.get()) return NPERR_GENERIC_ERROR; @@ -336,7 +336,7 @@ static NPError GetURLNotify(NPP id, if (!url) return NPERR_INVALID_URL; - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin.get()) { NOTREACHED(); return NPERR_GENERIC_ERROR; @@ -401,7 +401,7 @@ static NPError PostURLNotify(NPP id, if (!url) return NPERR_INVALID_URL; - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin.get()) { NOTREACHED(); return NPERR_GENERIC_ERROR; @@ -548,7 +548,7 @@ NPError NPN_DestroyStream(NPP id, NPStream* stream, NPReason reason) { // // - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin.get() == NULL) { NOTREACHED(); return NPERR_GENERIC_ERROR; @@ -610,7 +610,7 @@ void NPN_InvalidateRect(NPP id, NPRect *invalidRect) { // plug-ins at regularly timed intervals. To force a paint message, the // plug-in can call NPN_ForceRedraw after calling this method. - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); DCHECK(plugin.get() != NULL); if (plugin.get() && plugin->webplugin()) { if (invalidRect) { @@ -644,7 +644,7 @@ void NPN_InvalidateRegion(NPP id, NPRegion invalidRegion) { // TODO: this is overkill--add platform-specific region handling (at the // very least, fetch the region's bounding box and pass it to InvalidateRect). - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); DCHECK(plugin.get() != NULL); if (plugin.get() && plugin->webplugin()) plugin->webplugin()->Invalidate(); @@ -673,7 +673,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { switch (static_cast<int>(variable)) { case NPNVWindowNPObject: { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); NPObject *np_object = plugin->webplugin()->GetWindowScriptNPObject(); // Return value is expected to be retained, as // described here: @@ -689,7 +689,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { break; } case NPNVPluginElementNPObject: { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); NPObject *np_object = plugin->webplugin()->GetPluginElement(); // Return value is expected to be retained, as // described here: @@ -743,7 +743,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { } case NPNVprivateModeBool: { NPBool* private_mode = reinterpret_cast<NPBool*>(value); - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); *private_mode = plugin->webplugin()->IsOffTheRecord(); rv = NPERR_NO_ERROR; break; @@ -758,7 +758,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { // we still need to worry about future standard change that may conflict // with the variable definition, in order to avoid duplicate case clauses // in this big switch statement. - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin->plugin_lib()->plugin_info().path.value() == kDefaultPluginLibraryName) { plugin->webplugin()->OnMissingPluginStatus( @@ -769,7 +769,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { #if defined(OS_MACOSX) case NPNVpluginDrawingModel: { // return the drawing model that was negotiated when we initialized. - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); *reinterpret_cast<int*>(value) = plugin->drawing_model(); rv = NPERR_NO_ERROR; break; @@ -838,7 +838,7 @@ NPError NPN_GetValue(NPP id, NPNVariable variable, void* value) { NPError NPN_SetValue(NPP id, NPPVariable variable, void* value) { // Allows the plugin to set various modes - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); switch(variable) { case NPPVpluginWindowBool: { // Sets windowless mode for display of the plugin @@ -923,13 +923,13 @@ void* NPN_GetJavaPeer(NPP) { } void NPN_PushPopupsEnabledState(NPP id, NPBool enabled) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) plugin->PushPopupsEnabledState(enabled ? true : false); } void NPN_PopPopupsEnabledState(NPP id) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) plugin->PopPopupsEnabledState(); } @@ -937,7 +937,7 @@ void NPN_PopPopupsEnabledState(NPP id) { void NPN_PluginThreadAsyncCall(NPP id, void (*func)(void*), void* user_data) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) plugin->PluginThreadAsyncCall(func, user_data); } @@ -965,7 +965,7 @@ NPError NPN_GetValueForURL(NPP id, break; } case NPNURLVCookie: { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return NPERR_GENERIC_ERROR; @@ -1005,7 +1005,7 @@ NPError NPN_SetValueForURL(NPP id, switch (variable) { case NPNURLVCookie: { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return NPERR_GENERIC_ERROR; @@ -1051,7 +1051,7 @@ uint32_t NPN_ScheduleTimer(NPP id, uint32_t interval, NPBool repeat, void (*func)(NPP id, uint32_t timer_id)) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (!plugin) return 0; @@ -1059,7 +1059,7 @@ uint32_t NPN_ScheduleTimer(NPP id, } void NPN_UnscheduleTimer(NPP id, uint32_t timer_id) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin) plugin->UnscheduleTimer(timer_id); } @@ -1068,7 +1068,7 @@ NPError NPN_PopUpContextMenu(NPP id, NPMenu* menu) { if (!menu) return NPERR_INVALID_PARAM; - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin.get()) { return plugin->PopUpContextMenu(menu); } @@ -1080,7 +1080,7 @@ NPBool NPN_ConvertPoint(NPP id, double sourceX, double sourceY, NPCoordinateSpace sourceSpace, double *destX, double *destY, NPCoordinateSpace destSpace) { - scoped_refptr<NPAPI::PluginInstance> plugin = FindInstance(id); + scoped_refptr<NPAPI::PluginInstance> plugin(FindInstance(id)); if (plugin.get()) { return plugin->ConvertPoint(sourceX, sourceY, sourceSpace, destX, destY, destSpace); diff --git a/webkit/glue/plugins/plugin_lib_unittest.cc b/webkit/glue/plugins/plugin_lib_unittest.cc index 5ac6bdc..45c4bb6 100644 --- a/webkit/glue/plugins/plugin_lib_unittest.cc +++ b/webkit/glue/plugins/plugin_lib_unittest.cc @@ -25,7 +25,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) { PluginLibTest::CreatePluginLib(FilePath())); // Try with a single plugin lib. - scoped_refptr<PluginLibTest> plugin_lib1 = new PluginLibTest(); + scoped_refptr<PluginLibTest> plugin_lib1(new PluginLibTest()); NPAPI::PluginLib::UnloadAllPlugins(); // Need to create it again, it should have been destroyed above. @@ -34,7 +34,7 @@ TEST(PluginLibLoading, UnloadAllPlugins) { // Try with two plugin libs. plugin_lib1 = new PluginLibTest(); - scoped_refptr<PluginLibTest> plugin_lib2 = new PluginLibTest(); + scoped_refptr<PluginLibTest> plugin_lib2(new PluginLibTest()); NPAPI::PluginLib::UnloadAllPlugins(); // Need to create it again, it should have been destroyed above. diff --git a/webkit/glue/plugins/webplugin_delegate_impl.cc b/webkit/glue/plugins/webplugin_delegate_impl.cc index c54bbc8..6907c6f 100644 --- a/webkit/glue/plugins/webplugin_delegate_impl.cc +++ b/webkit/glue/plugins/webplugin_delegate_impl.cc @@ -32,8 +32,8 @@ WebPluginDelegateImpl* WebPluginDelegateImpl::Create( const FilePath& filename, const std::string& mime_type, gfx::PluginWindowHandle containing_view) { - scoped_refptr<NPAPI::PluginLib> plugin_lib = - NPAPI::PluginLib::CreatePluginLib(filename); + scoped_refptr<NPAPI::PluginLib> plugin_lib( + NPAPI::PluginLib::CreatePluginLib(filename)); if (plugin_lib.get() == NULL) return NULL; @@ -41,8 +41,8 @@ WebPluginDelegateImpl* WebPluginDelegateImpl::Create( if (err != NPERR_NO_ERROR) return NULL; - scoped_refptr<NPAPI::PluginInstance> instance = - plugin_lib->CreateInstance(mime_type); + scoped_refptr<NPAPI::PluginInstance> instance( + plugin_lib->CreateInstance(mime_type)); return new WebPluginDelegateImpl(containing_view, instance.get()); } diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index d49e732..019a664 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -267,12 +267,12 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( &WebMediaPlayerImpl::Proxy::NetworkEventCallback)); // A simple data source that keeps all data in memory. - scoped_refptr<SimpleDataSource> simple_data_source = - new SimpleDataSource(MessageLoop::current(), bridge_factory_simple); + scoped_refptr<SimpleDataSource> simple_data_source( + new SimpleDataSource(MessageLoop::current(), bridge_factory_simple)); // A sophisticated data source that does memory caching. - scoped_refptr<BufferedDataSource> buffered_data_source = - new BufferedDataSource(MessageLoop::current(), bridge_factory_buffered); + scoped_refptr<BufferedDataSource> buffered_data_source( + new BufferedDataSource(MessageLoop::current(), bridge_factory_buffered)); proxy_->SetDataSource(buffered_data_source); if (use_simple_data_source) { @@ -633,8 +633,8 @@ WebKit::WebVideoFrame* WebMediaPlayerImpl::getCurrentFrame() { void WebMediaPlayerImpl::putCurrentFrame( WebKit::WebVideoFrame* web_video_frame) { if (web_video_frame) { - scoped_refptr<media::VideoFrame> video_frame = - WebVideoFrameImpl::toVideoFrame(web_video_frame); + scoped_refptr<media::VideoFrame> video_frame( + WebVideoFrameImpl::toVideoFrame(web_video_frame)); proxy_->PutCurrentFrame(video_frame); delete web_video_frame; } diff --git a/webkit/support/webkit_support.cc b/webkit/support/webkit_support.cc index f1aae3d..e2dbf4c 100644 --- a/webkit/support/webkit_support.cc +++ b/webkit/support/webkit_support.cc @@ -289,8 +289,8 @@ WebKit::WebMediaPlayer* CreateMediaPlayer(WebFrame* frame, appcache_host ? appcache_host->host_id() : appcache::kNoHostId, 0); - scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer = - new webkit_glue::VideoRendererImpl(false); + scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer( + new webkit_glue::VideoRendererImpl(false)); collection.push_back(video_renderer); return new webkit_glue::WebMediaPlayerImpl( diff --git a/webkit/tools/test_shell/simple_resource_loader_bridge.cc b/webkit/tools/test_shell/simple_resource_loader_bridge.cc index 954b258..623683b 100644 --- a/webkit/tools/test_shell/simple_resource_loader_bridge.cc +++ b/webkit/tools/test_shell/simple_resource_loader_bridge.cc @@ -855,7 +855,7 @@ void SimpleResourceLoaderBridge::SetCookie(const GURL& url, return; } - scoped_refptr<CookieSetter> cookie_setter = new CookieSetter(); + scoped_refptr<CookieSetter> cookie_setter(new CookieSetter()); g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( cookie_setter.get(), &CookieSetter::Set, url, cookie)); } @@ -870,7 +870,7 @@ std::string SimpleResourceLoaderBridge::GetCookies( return std::string(); } - scoped_refptr<CookieGetter> getter = new CookieGetter(); + scoped_refptr<CookieGetter> getter(new CookieGetter()); g_io_thread->message_loop()->PostTask(FROM_HERE, NewRunnableMethod( getter.get(), &CookieGetter::Get, url)); diff --git a/webkit/tools/test_shell/test_webview_delegate.cc b/webkit/tools/test_shell/test_webview_delegate.cc index e6d43f1..a5a76ed 100644 --- a/webkit/tools/test_shell/test_webview_delegate.cc +++ b/webkit/tools/test_shell/test_webview_delegate.cc @@ -740,8 +740,8 @@ WebMediaPlayer* TestWebViewDelegate::createMediaPlayer( appcache_host ? appcache_host->host_id() : appcache::kNoHostId, 0); - scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer = - new webkit_glue::VideoRendererImpl(false); + scoped_refptr<webkit_glue::VideoRendererImpl> video_renderer( + new webkit_glue::VideoRendererImpl(false)); collection.push_back(video_renderer); return new webkit_glue::WebMediaPlayerImpl( |