From 54c3719d6bd03e7f2a644b8ce611e68a67bc341f Mon Sep 17 00:00:00 2001 From: dcheng Date: Tue, 26 Aug 2014 14:52:56 -0700 Subject: [PATCH] Remove implicit conversions from scoped_refptr to T* in content/ This patch was generated by running the rewrite_scoped_refptr clang tool on a Linux build. BUG=110610 Review URL: https://codereview.chromium.org/504273002 Cr-Commit-Position: refs/heads/master@{#291986} --- .../browser/battery_status/battery_status_manager_linux.cc | 8 ++++---- content/browser/net/sqlite_persistent_cookie_store.cc | 10 +++++----- content/browser/plugin_service_impl.cc | 2 +- content/browser/quota/quota_reservation_manager_unittest.cc | 4 ++-- content/browser/security_exploit_browsertest.cc | 6 ++++-- content/browser/speech/speech_recognition_browsertest.cc | 2 +- content/browser/startup_task_runner.cc | 2 +- content/browser/storage_partition_impl.cc | 12 +++++++++--- content/browser/storage_partition_impl_map.cc | 2 +- content/browser/storage_partition_impl_unittest.cc | 10 +++++----- content/browser/time_zone_monitor_linux.cc | 2 +- content/browser/tracing/tracing_controller_impl.cc | 2 +- content/browser/transition_request_manager.cc | 2 +- content/browser/utility_process_host_impl.cc | 6 +++--- content/browser/web_contents/web_contents_impl_unittest.cc | 8 ++++---- .../web_contents/web_contents_view_aura_browsertest.cc | 2 +- content/child/child_message_filter.cc | 2 +- content/child/npapi/plugin_url_fetcher.cc | 2 +- content/child/threaded_data_provider.cc | 4 ++-- content/public/browser/browser_message_filter.cc | 2 +- content/public/renderer/video_encode_accelerator.cc | 2 +- content/public/test/browser_test_utils.cc | 2 +- content/public/test/mock_blob_url_request_context.cc | 2 +- content/test/test_web_contents.cc | 3 ++- 24 files changed, 54 insertions(+), 45 deletions(-) diff --git a/content/browser/battery_status/battery_status_manager_linux.cc b/content/browser/battery_status/battery_status_manager_linux.cc index e6abf88ed4eb..6539f0571418 100644 --- a/content/browser/battery_status/battery_status_manager_linux.cc +++ b/content/browser/battery_status/battery_status_manager_linux.cc @@ -123,7 +123,7 @@ class BatteryStatusNotificationThread : public base::Thread { void StartListening() { DCHECK(OnWatcherThread()); - if (system_bus_) + if (system_bus_.get()) return; InitDBus(); @@ -201,7 +201,7 @@ class BatteryStatusNotificationThread : public base::Thread { void ShutdownDBusConnection() { DCHECK(OnWatcherThread()); - if (!system_bus_) + if (!system_bus_.get()) return; // Shutdown DBus connection later because there may be pending tasks on @@ -223,7 +223,7 @@ class BatteryStatusNotificationThread : public base::Thread { return; } - if (!system_bus_) + if (!system_bus_.get()) return; if (success) { @@ -238,7 +238,7 @@ class BatteryStatusNotificationThread : public base::Thread { void BatteryChanged(dbus::Signal* signal /* unsused */) { DCHECK(OnWatcherThread()); - if (!system_bus_) + if (!system_bus_.get()) return; scoped_ptr dictionary = diff --git a/content/browser/net/sqlite_persistent_cookie_store.cc b/content/browser/net/sqlite_persistent_cookie_store.cc index 3e8e6e5fb853..923ad72f3279 100644 --- a/content/browser/net/sqlite_persistent_cookie_store.cc +++ b/content/browser/net/sqlite_persistent_cookie_store.cc @@ -1279,19 +1279,19 @@ net::CookieStore* CreateCookieStore(const CookieStoreConfig& config) { if (config.path.empty()) { // Empty path means in-memory store. - cookie_monster = new net::CookieMonster(NULL, config.cookie_delegate); + cookie_monster = new net::CookieMonster(NULL, config.cookie_delegate.get()); } else { scoped_refptr client_task_runner = config.client_task_runner; scoped_refptr background_task_runner = config.background_task_runner; - if (!client_task_runner) { + if (!client_task_runner.get()) { client_task_runner = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO); } - if (!background_task_runner) { + if (!background_task_runner.get()) { background_task_runner = BrowserThread::GetBlockingPool()->GetSequencedTaskRunner( BrowserThread::GetBlockingPool()->GetSequenceToken()); @@ -1304,11 +1304,11 @@ net::CookieStore* CreateCookieStore(const CookieStoreConfig& config) { background_task_runner, (config.session_cookie_mode == CookieStoreConfig::RESTORED_SESSION_COOKIES), - config.storage_policy, + config.storage_policy.get(), config.crypto_delegate); cookie_monster = - new net::CookieMonster(persistent_store, config.cookie_delegate); + new net::CookieMonster(persistent_store, config.cookie_delegate.get()); if ((config.session_cookie_mode == CookieStoreConfig::PERSISTANT_SESSION_COOKIES) || (config.session_cookie_mode == diff --git a/content/browser/plugin_service_impl.cc b/content/browser/plugin_service_impl.cc index 00326e39fe4f..e4be1a024b32 100644 --- a/content/browser/plugin_service_impl.cc +++ b/content/browser/plugin_service_impl.cc @@ -634,7 +634,7 @@ void PluginServiceImpl::GetPluginsOnIOThread( // If we switch back to loading plugins in process, then we need to make // sure g_thread_init() gets called since plugins may call glib at load. - if (!plugin_loader_) + if (!plugin_loader_.get()) plugin_loader_ = new PluginLoaderPosix; plugin_loader_->GetPlugins( diff --git a/content/browser/quota/quota_reservation_manager_unittest.cc b/content/browser/quota/quota_reservation_manager_unittest.cc index fa5dd1a25e59..db46a738eeb4 100644 --- a/content/browser/quota/quota_reservation_manager_unittest.cc +++ b/content/browser/quota/quota_reservation_manager_unittest.cc @@ -294,12 +294,12 @@ TEST_F(QuotaReservationManagerTest, MultipleWriter) { TEST_F(QuotaReservationManagerTest, MultipleClient) { scoped_refptr reservation1 = reservation_manager()->CreateReservation(GURL(kOrigin), kType); - RefreshReservation(reservation1, 10); + RefreshReservation(reservation1.get(), 10); int64 cached_reserved_quota1 = reservation1->remaining_quota(); scoped_refptr reservation2 = reservation_manager()->CreateReservation(GURL(kOrigin), kType); - RefreshReservation(reservation2, 20); + RefreshReservation(reservation2.get(), 20); int64 cached_reserved_quota2 = reservation2->remaining_quota(); scoped_ptr writer1( diff --git a/content/browser/security_exploit_browsertest.cc b/content/browser/security_exploit_browsertest.cc index 9fadec049a78..3971285583aa 100644 --- a/content/browser/security_exploit_browsertest.cc +++ b/content/browser/security_exploit_browsertest.cc @@ -139,8 +139,10 @@ IN_PROC_BROWSER_TEST_F(SecurityExploitBrowserTest, new SessionStorageNamespaceImpl(dom_storage_context)); // Cause a deliberate collision in routing ids. int main_frame_routing_id = duplicate_routing_id + 1; - pending_rvh->CreateNewWindow( - duplicate_routing_id, main_frame_routing_id, params, session_storage); + pending_rvh->CreateNewWindow(duplicate_routing_id, + main_frame_routing_id, + params, + session_storage.get()); // If the above operation doesn't cause a crash, the test has succeeded! } diff --git a/content/browser/speech/speech_recognition_browsertest.cc b/content/browser/speech/speech_recognition_browsertest.cc index 481b2a01dce2..c34a3e4abfee 100644 --- a/content/browser/speech/speech_recognition_browsertest.cc +++ b/content/browser/speech/speech_recognition_browsertest.cc @@ -148,7 +148,7 @@ class SpeechRecognitionBrowserTest : audio_bus->FromInterleaved(&audio_buffer.get()[0], audio_bus->frames(), audio_params.bits_per_sample() / 8); - controller->event_handler()->OnData(controller, audio_bus.get()); + controller->event_handler()->OnData(controller.get(), audio_bus.get()); } void FeedAudioController(int duration_ms, bool feed_with_noise) { diff --git a/content/browser/startup_task_runner.cc b/content/browser/startup_task_runner.cc index 4746afea6b09..8e680bd6d086 100644 --- a/content/browser/startup_task_runner.cc +++ b/content/browser/startup_task_runner.cc @@ -22,7 +22,7 @@ void StartupTaskRunner::AddTask(StartupTask& callback) { } void StartupTaskRunner::StartRunningTasksAsync() { - DCHECK(proxy_); + DCHECK(proxy_.get()); int result = 0; if (task_list_.empty()) { if (!startup_complete_callback_.is_null()) { diff --git a/content/browser/storage_partition_impl.cc b/content/browser/storage_partition_impl.cc index 36af20223f30..d078a745101d 100644 --- a/content/browser/storage_partition_impl.cc +++ b/content/browser/storage_partition_impl.cc @@ -531,10 +531,16 @@ void StoragePartitionImpl::ClearDataImpl( callback); // |helper| deletes itself when done in // DataDeletionHelper::DecrementTaskCountOnUI(). - helper->ClearDataOnUIThread(storage_origin, origin_matcher, GetPath(), - rq_context, dom_storage_context_, quota_manager_, + helper->ClearDataOnUIThread(storage_origin, + origin_matcher, + GetPath(), + rq_context, + dom_storage_context_.get(), + quota_manager_.get(), special_storage_policy_.get(), - webrtc_identity_store_, begin, end); + webrtc_identity_store_.get(), + begin, + end); } void StoragePartitionImpl:: diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index c43ba09c81b4..12f2059ac242 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -74,7 +74,7 @@ class BlobProtocolHandler : public net::URLRequestJobFactory::ProtocolHandler { // on the IO thread. blob_protocol_handler_.reset(new storage::BlobProtocolHandler( blob_storage_context_->context(), - file_system_context_, + file_system_context_.get(), BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE) .get())); } diff --git a/content/browser/storage_partition_impl_unittest.cc b/content/browser/storage_partition_impl_unittest.cc index 7d209bbd5b7e..46f42c5c5cf4 100644 --- a/content/browser/storage_partition_impl_unittest.cc +++ b/content/browser/storage_partition_impl_unittest.cc @@ -672,7 +672,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedUnprotectedOrigins) { BrowserContext::GetDefaultStoragePartition(browser_context())); partition->OverrideQuotaManagerForTesting( GetMockManager()); - partition->OverrideSpecialStoragePolicyForTesting(mock_policy); + partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::RunLoop run_loop; base::MessageLoop::current()->PostTask( @@ -708,7 +708,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedProtectedSpecificOrigin) { BrowserContext::GetDefaultStoragePartition(browser_context())); partition->OverrideQuotaManagerForTesting( GetMockManager()); - partition->OverrideSpecialStoragePolicyForTesting(mock_policy); + partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); // Try to remove kOrigin1. Expect failure. base::RunLoop run_loop; @@ -747,7 +747,7 @@ TEST_F(StoragePartitionImplTest, RemoveQuotaManagedProtectedOrigins) { BrowserContext::GetDefaultStoragePartition(browser_context())); partition->OverrideQuotaManagerForTesting( GetMockManager()); - partition->OverrideSpecialStoragePolicyForTesting(mock_policy); + partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::MessageLoop::current()->PostTask( FROM_HERE, base::Bind(&ClearQuotaDataWithOriginMatcher, @@ -848,7 +848,7 @@ TEST_F(StoragePartitionImplTest, RemoveUnprotectedLocalStorageForever) { StoragePartitionImpl* partition = static_cast( BrowserContext::GetDefaultStoragePartition(browser_context())); - partition->OverrideSpecialStoragePolicyForTesting(mock_policy); + partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::RunLoop run_loop; base::MessageLoop::current()->PostTask( @@ -880,7 +880,7 @@ TEST_F(StoragePartitionImplTest, RemoveProtectedLocalStorageForever) { StoragePartitionImpl* partition = static_cast( BrowserContext::GetDefaultStoragePartition(browser_context())); - partition->OverrideSpecialStoragePolicyForTesting(mock_policy); + partition->OverrideSpecialStoragePolicyForTesting(mock_policy.get()); base::RunLoop run_loop; base::MessageLoop::current()->PostTask( diff --git a/content/browser/time_zone_monitor_linux.cc b/content/browser/time_zone_monitor_linux.cc index f8cae0e24302..e917bbc96542 100644 --- a/content/browser/time_zone_monitor_linux.cc +++ b/content/browser/time_zone_monitor_linux.cc @@ -151,7 +151,7 @@ TimeZoneMonitorLinux::TimeZoneMonitorLinux() } TimeZoneMonitorLinux::~TimeZoneMonitorLinux() { - if (impl_) { + if (impl_.get()) { impl_->StopWatching(); } } diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc index 5fe4d2f0fd7f..ca480c70638c 100644 --- a/content/browser/tracing/tracing_controller_impl.cc +++ b/content/browser/tracing/tracing_controller_impl.cc @@ -133,7 +133,7 @@ void TracingControllerImpl::ResultFile::CloseTask( size_t written = fwrite(trailevents, strlen(trailevents), 1, file_); DCHECK(written == 1); - if (system_trace_) { + if (system_trace_.get()) { #if defined(OS_WIN) // The Windows kernel events are kept into a JSon format stored as string // and must not be escaped. diff --git a/content/browser/transition_request_manager.cc b/content/browser/transition_request_manager.cc index ae9a9f3fbd27..680c2d4c4eb6 100644 --- a/content/browser/transition_request_manager.cc +++ b/content/browser/transition_request_manager.cc @@ -85,7 +85,7 @@ void TransitionRequestManager::ParseTransitionStylesheetsFromHeaders( const scoped_refptr& headers, std::vector& entering_stylesheets, const GURL& resolve_address) { - if (headers == NULL) + if (headers.get() == NULL) return; std::string transition_stylesheet; diff --git a/content/browser/utility_process_host_impl.cc b/content/browser/utility_process_host_impl.cc index 16a42d6a30dd..2c86e917814a 100644 --- a/content/browser/utility_process_host_impl.cc +++ b/content/browser/utility_process_host_impl.cc @@ -268,7 +268,7 @@ bool UtilityProcessHostImpl::StartProcess() { } bool UtilityProcessHostImpl::OnMessageReceived(const IPC::Message& message) { - if (!client_) + if (!client_.get()) return true; client_task_runner_->PostTask( @@ -282,7 +282,7 @@ bool UtilityProcessHostImpl::OnMessageReceived(const IPC::Message& message) { } void UtilityProcessHostImpl::OnProcessLaunchFailed() { - if (!client_) + if (!client_.get()) return; client_task_runner_->PostTask( @@ -292,7 +292,7 @@ void UtilityProcessHostImpl::OnProcessLaunchFailed() { } void UtilityProcessHostImpl::OnProcessCrashed(int exit_code) { - if (!client_) + if (!client_.get()) return; client_task_runner_->PostTask( diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index 3d37ab9b7762..e2ef0e578ae3 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -2591,12 +2591,12 @@ TEST_F(WebContentsImplTest, ActiveContentsCountBasic) { EXPECT_EQ(0u, instance2->GetRelatedActiveContentsCount()); scoped_ptr contents1( - TestWebContents::Create(browser_context(), instance1)); + TestWebContents::Create(browser_context(), instance1.get())); EXPECT_EQ(1u, instance1->GetRelatedActiveContentsCount()); EXPECT_EQ(1u, instance2->GetRelatedActiveContentsCount()); scoped_ptr contents2( - TestWebContents::Create(browser_context(), instance1)); + TestWebContents::Create(browser_context(), instance1.get())); EXPECT_EQ(2u, instance1->GetRelatedActiveContentsCount()); EXPECT_EQ(2u, instance2->GetRelatedActiveContentsCount()); @@ -2618,7 +2618,7 @@ TEST_F(WebContentsImplTest, ActiveContentsCountNavigate) { EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); scoped_ptr contents( - TestWebContents::Create(browser_context(), instance)); + TestWebContents::Create(browser_context(), instance.get())); EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); // Navigate to a URL. @@ -2656,7 +2656,7 @@ TEST_F(WebContentsImplTest, ActiveContentsCountChangeBrowsingInstance) { EXPECT_EQ(0u, instance->GetRelatedActiveContentsCount()); scoped_ptr contents( - TestWebContents::Create(browser_context(), instance)); + TestWebContents::Create(browser_context(), instance.get())); EXPECT_EQ(1u, instance->GetRelatedActiveContentsCount()); // Navigate to a URL. diff --git a/content/browser/web_contents/web_contents_view_aura_browsertest.cc b/content/browser/web_contents/web_contents_view_aura_browsertest.cc index 1e1411e62f87..52fe362157e4 100644 --- a/content/browser/web_contents/web_contents_view_aura_browsertest.cc +++ b/content/browser/web_contents/web_contents_view_aura_browsertest.cc @@ -380,7 +380,7 @@ class WebContentsViewAuraTest : public ContentBrowserTest { void AddInputEventMessageFilter() { filter_ = new InputEventMessageFilterWaitsForAcks(); - GetRenderWidgetHost()->GetProcess()->AddFilter(filter_); + GetRenderWidgetHost()->GetProcess()->AddFilter(filter_.get()); } private: diff --git a/content/child/child_message_filter.cc b/content/child/child_message_filter.cc index 5d2f2e462973..b7bdf0529dfe 100644 --- a/content/child/child_message_filter.cc +++ b/content/child/child_message_filter.cc @@ -21,7 +21,7 @@ class ChildMessageFilter::Internal : public IPC::MessageFilter { virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE { scoped_refptr runner = filter_->OverrideTaskRunnerForMessage(msg); - if (runner && !runner->RunsTasksOnCurrentThread()) { + if (runner.get() && !runner->RunsTasksOnCurrentThread()) { if (!runner->PostTask( FROM_HERE, base::Bind( diff --git a/content/child/npapi/plugin_url_fetcher.cc b/content/child/npapi/plugin_url_fetcher.cc index d339033a37ce..0cabff9798a2 100644 --- a/content/child/npapi/plugin_url_fetcher.cc +++ b/content/child/npapi/plugin_url_fetcher.cc @@ -284,7 +284,7 @@ void PluginURLFetcher::OnReceivedResponse(const ResourceResponseInfo& info) { base::Time temp; uint32 last_modified = 0; std::string headers; - if (info.headers) { // NULL for data: urls. + if (info.headers.get()) { // NULL for data: urls. if (info.headers->GetLastModifiedValue(&temp)) last_modified = static_cast(temp.ToDoubleT()); diff --git a/content/child/threaded_data_provider.cc b/content/child/threaded_data_provider.cc index 118b60cdfa2a..22238498f1b1 100644 --- a/content/child/threaded_data_provider.cc +++ b/content/child/threaded_data_provider.cc @@ -148,13 +148,13 @@ ThreadedDataProvider::ThreadedDataProvider( main_thread_weak_factory_.GetWeakPtr(), request_id); - ChildThread::current()->channel()->AddFilter(filter_); + ChildThread::current()->channel()->AddFilter(filter_.get()); } ThreadedDataProvider::~ThreadedDataProvider() { DCHECK(ChildThread::current()); - ChildThread::current()->channel()->RemoveFilter(filter_); + ChildThread::current()->channel()->RemoveFilter(filter_.get()); delete threaded_data_receiver_; } diff --git a/content/public/browser/browser_message_filter.cc b/content/public/browser/browser_message_filter.cc index 6b3432204b99..595570d046c5 100644 --- a/content/public/browser/browser_message_filter.cc +++ b/content/public/browser/browser_message_filter.cc @@ -67,7 +67,7 @@ class BrowserMessageFilter::Internal : public IPC::MessageFilter { } if (thread == BrowserThread::UI && - !BrowserMessageFilter::CheckCanDispatchOnUI(message, filter_)) { + !BrowserMessageFilter::CheckCanDispatchOnUI(message, filter_.get())) { return true; } diff --git a/content/public/renderer/video_encode_accelerator.cc b/content/public/renderer/video_encode_accelerator.cc index f256f48b5228..f1859c3cc59b 100644 --- a/content/public/renderer/video_encode_accelerator.cc +++ b/content/public/renderer/video_encode_accelerator.cc @@ -25,7 +25,7 @@ void CreateVideoEncodeAccelerator( scoped_refptr encode_task_runner = gpu_factories->GetTaskRunner(); base::PostTaskAndReplyWithResult( - encode_task_runner, + encode_task_runner.get(), FROM_HERE, base::Bind( &media::GpuVideoAcceleratorFactories::CreateVideoEncodeAccelerator, diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index d28b8aae2952..bbcaf57b67d2 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc @@ -718,7 +718,7 @@ void DOMMessageQueue::Observe(int type, const NotificationDetails& details) { Details dom_op_details(details); message_queue_.push(dom_op_details->json); - if (message_loop_runner_) + if (message_loop_runner_.get()) message_loop_runner_->Quit(); } diff --git a/content/public/test/mock_blob_url_request_context.cc b/content/public/test/mock_blob_url_request_context.cc index 8c51b49160d8..57a432f724fb 100644 --- a/content/public/test/mock_blob_url_request_context.cc +++ b/content/public/test/mock_blob_url_request_context.cc @@ -38,7 +38,7 @@ ScopedTextBlob::ScopedTextBlob( scoped_refptr blob_data(new storage::BlobData(blob_id_)); if (!data.empty()) blob_data->AppendData(data); - handle_ = context_->AddFinishedBlob(blob_data); + handle_ = context_->AddFinishedBlob(blob_data.get()); } ScopedTextBlob::~ScopedTextBlob() { diff --git a/content/test/test_web_contents.cc b/content/test/test_web_contents.cc index 9824a0c49a38..a8ffafb73324 100644 --- a/content/test/test_web_contents.cc +++ b/content/test/test_web_contents.cc @@ -205,7 +205,8 @@ void TestWebContents::SetHistoryLengthAndPrune( int32 min_page_id) { EXPECT_TRUE(expect_set_history_length_and_prune_); expect_set_history_length_and_prune_ = false; - EXPECT_EQ(expect_set_history_length_and_prune_site_instance_, site_instance); + EXPECT_EQ(expect_set_history_length_and_prune_site_instance_.get(), + site_instance); EXPECT_EQ(expect_set_history_length_and_prune_history_length_, history_length); EXPECT_EQ(expect_set_history_length_and_prune_min_page_id_, min_page_id); -- 2.11.4.GIT