diff options
262 files changed, 1564 insertions, 1356 deletions
diff --git a/content/browser/accessibility/accessibility_tree_formatter.cc b/content/browser/accessibility/accessibility_tree_formatter.cc index 6e20e8a..70a00f4 100644 --- a/content/browser/accessibility/accessibility_tree_formatter.cc +++ b/content/browser/accessibility/accessibility_tree_formatter.cc @@ -40,7 +40,7 @@ AccessibilityTreeFormatter::BuildAccessibilityTree( CHECK(root); scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue); RecursiveBuildAccessibilityTree(*root, dict.get()); - return dict.Pass(); + return dict; } void AccessibilityTreeFormatter::FormatAccessibilityTree( diff --git a/content/browser/appcache/appcache_disk_cache.cc b/content/browser/appcache/appcache_disk_cache.cc index f7cbc58..49030f0 100644 --- a/content/browser/appcache/appcache_disk_cache.cc +++ b/content/browser/appcache/appcache_disk_cache.cc @@ -5,6 +5,7 @@ #include "content/browser/appcache/appcache_disk_cache.h" #include <limits> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -369,7 +370,7 @@ int AppCacheDiskCache::Init( void AppCacheDiskCache::OnCreateBackendComplete(int rv) { if (rv == net::OK) { - disk_cache_ = create_backend_callback_->backend_ptr_.Pass(); + disk_cache_ = std::move(create_backend_callback_->backend_ptr_); } create_backend_callback_ = NULL; diff --git a/content/browser/appcache/appcache_request_handler.cc b/content/browser/appcache/appcache_request_handler.cc index a2d7c48..c022237 100644 --- a/content/browser/appcache/appcache_request_handler.cc +++ b/content/browser/appcache/appcache_request_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/appcache/appcache_request_handler.h" +#include <utility> + #include "base/bind.h" #include "content/browser/appcache/appcache.h" #include "content/browser/appcache/appcache_backend_impl.h" @@ -197,7 +199,8 @@ void AppCacheRequestHandler::CompleteCrossSiteTransfer( return; DCHECK_EQ(host_, host_for_cross_site_transfer_.get()); AppCacheBackendImpl* backend = host_->service()->GetBackend(new_process_id); - backend->TransferHostIn(new_host_id, host_for_cross_site_transfer_.Pass()); + backend->TransferHostIn(new_host_id, + std::move(host_for_cross_site_transfer_)); } void AppCacheRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( diff --git a/content/browser/appcache/appcache_request_handler_unittest.cc b/content/browser/appcache/appcache_request_handler_unittest.cc index 4a677f2..46ce987 100644 --- a/content/browser/appcache/appcache_request_handler_unittest.cc +++ b/content/browser/appcache/appcache_request_handler_unittest.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "content/browser/appcache/appcache_request_handler.h" +#include <stdint.h> #include <stack> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -20,7 +22,6 @@ #include "base/threading/thread.h" #include "content/browser/appcache/appcache.h" #include "content/browser/appcache/appcache_backend_impl.h" -#include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/appcache/appcache_url_request_job.h" #include "content/browser/appcache/mock_appcache_policy.h" #include "content/browser/appcache/mock_appcache_service.h" @@ -119,7 +120,7 @@ class AppCacheRequestHandlerTest : public testing::Test { ~MockURLRequestJobFactory() override { DCHECK(!job_); } - void SetJob(scoped_ptr<net::URLRequestJob> job) { job_ = job.Pass(); } + void SetJob(scoped_ptr<net::URLRequestJob> job) { job_ = std::move(job); } net::URLRequestJob* MaybeCreateJobWithProtocolHandler( const std::string& scheme, @@ -816,7 +817,7 @@ class AppCacheRequestHandlerTest : public testing::Test { base::WeakPtr<AppCacheURLRequestJob> weak_job = job_->GetWeakPtr(); - job_factory_->SetJob(job_.Pass()); + job_factory_->SetJob(std::move(job_)); request_->Start(); ASSERT_TRUE(weak_job); EXPECT_TRUE(weak_job->has_been_started()); diff --git a/content/browser/appcache/appcache_service_impl.cc b/content/browser/appcache/appcache_service_impl.cc index fd8c686..2fc5d94 100644 --- a/content/browser/appcache/appcache_service_impl.cc +++ b/content/browser/appcache/appcache_service_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/appcache/appcache_service_impl.h" #include <functional> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -389,7 +390,7 @@ void AppCacheServiceImpl::CheckResponseHelper::OnReadDataComplete(int result) { AppCacheStorageReference::AppCacheStorageReference( scoped_ptr<AppCacheStorage> storage) - : storage_(storage.Pass()) {} + : storage_(std::move(storage)) {} AppCacheStorageReference::~AppCacheStorageReference() {} // AppCacheServiceImpl ------- @@ -469,8 +470,8 @@ void AppCacheServiceImpl::Reinitialize() { // Inform observers of about this and give them a chance to // defer deletion of the old storage object. - scoped_refptr<AppCacheStorageReference> - old_storage_ref(new AppCacheStorageReference(storage_.Pass())); + scoped_refptr<AppCacheStorageReference> old_storage_ref( + new AppCacheStorageReference(std::move(storage_))); FOR_EACH_OBSERVER(Observer, observers_, OnServiceReinitialized(old_storage_ref.get())); diff --git a/content/browser/appcache/appcache_storage_impl_unittest.cc b/content/browser/appcache/appcache_storage_impl_unittest.cc index 1a80274..9e4c2c4 100644 --- a/content/browser/appcache/appcache_storage_impl_unittest.cc +++ b/content/browser/appcache/appcache_storage_impl_unittest.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "content/browser/appcache/appcache_storage_impl.h" +#include <stdint.h> #include <stack> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -27,7 +29,6 @@ #include "content/browser/appcache/appcache_interceptor.h" #include "content/browser/appcache/appcache_request_handler.h" #include "content/browser/appcache/appcache_service_impl.h" -#include "content/browser/appcache/appcache_storage_impl.h" #include "net/base/net_errors.h" #include "net/base/request_priority.h" #include "net/http/http_response_headers.h" @@ -132,9 +133,8 @@ class MockHttpServerJobFactory : public net::URLRequestJobFactory::ProtocolHandler { public: MockHttpServerJobFactory( - scoped_ptr<net::URLRequestInterceptor> appcache_start_interceptor) - : appcache_start_interceptor_(appcache_start_interceptor.Pass()) { - } + scoped_ptr<net::URLRequestInterceptor> appcache_start_interceptor) + : appcache_start_interceptor_(std::move(appcache_start_interceptor)) {} net::URLRequestJob* MaybeCreateJob( net::URLRequest* request, @@ -168,7 +168,7 @@ class IOThread : public base::Thread { factory->SetProtocolHandler( "http", make_scoped_ptr(new MockHttpServerJobFactory( make_scoped_ptr(new AppCacheInterceptor())))); - job_factory_ = factory.Pass(); + job_factory_ = std::move(factory); request_context_.reset(new net::TestURLRequestContext()); request_context_->set_job_factory(job_factory_.get()); } diff --git a/content/browser/appcache/appcache_update_job_unittest.cc b/content/browser/appcache/appcache_update_job_unittest.cc index 39c2290..9820bc2 100644 --- a/content/browser/appcache/appcache_update_job_unittest.cc +++ b/content/browser/appcache/appcache_update_job_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/appcache/appcache_update_job.h" + #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -17,7 +20,6 @@ #include "content/browser/appcache/appcache_group.h" #include "content/browser/appcache/appcache_host.h" #include "content/browser/appcache/appcache_response.h" -#include "content/browser/appcache/appcache_update_job.h" #include "content/browser/appcache/mock_appcache_service.h" #include "net/base/net_errors.h" #include "net/http/http_response_headers.h" @@ -582,7 +584,7 @@ class IOThread : public base::Thread { make_scoped_ptr(new MockHttpServerJobFactory)); factory->SetProtocolHandler("https", make_scoped_ptr(new MockHttpServerJobFactory)); - job_factory_ = factory.Pass(); + job_factory_ = std::move(factory); request_context_.reset(new net::TestURLRequestContext()); request_context_->set_job_factory(job_factory_.get()); } diff --git a/content/browser/background_sync/background_sync_context_impl.cc b/content/browser/background_sync/background_sync_context_impl.cc index 4e55d83..009e886 100644 --- a/content/browser/background_sync/background_sync_context_impl.cc +++ b/content/browser/background_sync/background_sync_context_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/background_sync/background_sync_context_impl.h" +#include <utility> + #include "base/bind.h" #include "base/stl_util.h" #include "content/browser/background_sync/background_sync_manager.h" @@ -78,7 +80,7 @@ void BackgroundSyncContextImpl::CreateServiceOnIOThread( mojo::InterfaceRequest<BackgroundSyncService> request) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(background_sync_manager_); - services_.insert(new BackgroundSyncServiceImpl(this, request.Pass())); + services_.insert(new BackgroundSyncServiceImpl(this, std::move(request))); } void BackgroundSyncContextImpl::ShutdownOnIO() { diff --git a/content/browser/background_sync/background_sync_manager.cc b/content/browser/background_sync/background_sync_manager.cc index d5e86a5..327802d 100644 --- a/content/browser/background_sync/background_sync_manager.cc +++ b/content/browser/background_sync/background_sync_manager.cc @@ -4,6 +4,8 @@ #include "content/browser/background_sync/background_sync_manager.h" +#include <utility> + #include "base/barrier_closure.h" #include "base/bind.h" #include "base/location.h" @@ -56,9 +58,8 @@ void PostErrorResponse( const BackgroundSyncManager::StatusAndRegistrationCallback& callback) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, - base::Bind( - callback, status, - base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>().Pass()))); + base::Bind(callback, status, + base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>()))); } // Returns nullptr if the controller cannot be accessed for any reason. @@ -114,11 +115,11 @@ scoped_ptr<BackgroundSyncParameters> GetControllerParameters( if (!background_sync_controller) { // Return default ParameterOverrides which don't disable and don't override. - return parameters.Pass(); + return parameters; } background_sync_controller->GetParameterOverrides(parameters.get()); - return parameters.Pass(); + return parameters; } } // namespace @@ -227,8 +228,7 @@ void BackgroundSyncManager::GetRegistrations( callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, base::Passed( scoped_ptr<ScopedVector<BackgroundSyncRegistrationHandle>>( - new ScopedVector<BackgroundSyncRegistrationHandle>()) - .Pass()))); + new ScopedVector<BackgroundSyncRegistrationHandle>())))); return; } @@ -326,7 +326,7 @@ void BackgroundSyncManager::InitImpl(const base::Closure& callback) { BrowserThread::PostTaskAndReplyWithResult( BrowserThread::UI, FROM_HERE, base::Bind(&GetControllerParameters, service_worker_context_, - base::Passed(parameters_copy.Pass())), + base::Passed(std::move(parameters_copy))), base::Bind(&BackgroundSyncManager::InitDidGetControllerParameters, weak_ptr_factory_.GetWeakPtr(), callback)); } @@ -336,7 +336,7 @@ void BackgroundSyncManager::InitDidGetControllerParameters( scoped_ptr<BackgroundSyncParameters> updated_parameters) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - parameters_ = updated_parameters.Pass(); + parameters_ = std::move(updated_parameters); if (parameters_->disable) { disabled_ = true; base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, @@ -516,8 +516,7 @@ void BackgroundSyncManager::RegisterImpl( FROM_HERE, base::Bind( callback, BACKGROUND_SYNC_STATUS_OK, - base::Passed( - CreateRegistrationHandle(existing_registration_ref).Pass()))); + base::Passed(CreateRegistrationHandle(existing_registration_ref)))); return; } else { existing_registration_ref->value()->SetUnregisteredState(); @@ -697,7 +696,7 @@ void BackgroundSyncManager::RegisterDidStore( BACKGROUND_SYNC_STATUS_STORAGE_ERROR); DisableAndClearManager(base::Bind( callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, - base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>().Pass()))); + base::Passed(scoped_ptr<BackgroundSyncRegistrationHandle>()))); return; } @@ -714,8 +713,7 @@ void BackgroundSyncManager::RegisterDidStore( FROM_HERE, base::Bind( callback, BACKGROUND_SYNC_STATUS_OK, - base::Passed( - CreateRegistrationHandle(new_registration_ref.get()).Pass()))); + base::Passed(CreateRegistrationHandle(new_registration_ref.get())))); } void BackgroundSyncManager::RemoveActiveRegistration( @@ -941,7 +939,7 @@ void BackgroundSyncManager::NotifyWhenFinished( op_scheduler_.ScheduleOperation( base::Bind(&BackgroundSyncManager::NotifyWhenFinishedImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(registration_handle.Pass()), callback)); + base::Passed(std::move(registration_handle)), callback)); } void BackgroundSyncManager::NotifyWhenFinishedImpl( @@ -1000,7 +998,7 @@ void BackgroundSyncManager::GetRegistrationImpl( base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, - base::Passed(CreateRegistrationHandle(registration).Pass()))); + base::Passed(CreateRegistrationHandle(registration)))); } void BackgroundSyncManager::GetRegistrationsImpl( @@ -1015,7 +1013,7 @@ void BackgroundSyncManager::GetRegistrationsImpl( if (disabled_) { base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_STORAGE_ERROR, - base::Passed(out_registrations.Pass()))); + base::Passed(std::move(out_registrations)))); return; } @@ -1035,7 +1033,7 @@ void BackgroundSyncManager::GetRegistrationsImpl( base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(callback, BACKGROUND_SYNC_STATUS_OK, - base::Passed(out_registrations.Pass()))); + base::Passed(std::move(out_registrations)))); } bool BackgroundSyncManager::AreOptionConditionsMet( @@ -1237,10 +1235,11 @@ void BackgroundSyncManager::FireReadyEventsDidFindRegistration( FireOneShotSync( handle_id, service_worker_registration->active_version(), last_chance, - base::Bind( - &BackgroundSyncManager::EventComplete, weak_ptr_factory_.GetWeakPtr(), - service_worker_registration, service_worker_registration->id(), - base::Passed(registration_handle.Pass()), event_completed_callback)); + base::Bind(&BackgroundSyncManager::EventComplete, + weak_ptr_factory_.GetWeakPtr(), service_worker_registration, + service_worker_registration->id(), + base::Passed(std::move(registration_handle)), + event_completed_callback)); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(event_fired_callback)); @@ -1269,8 +1268,8 @@ void BackgroundSyncManager::EventComplete( // be allowed to complete (for NotifyWhenFinished). op_scheduler_.ScheduleOperation(base::Bind( &BackgroundSyncManager::EventCompleteImpl, weak_ptr_factory_.GetWeakPtr(), - service_worker_id, base::Passed(registration_handle.Pass()), status_code, - MakeClosureCompletion(callback))); + service_worker_id, base::Passed(std::move(registration_handle)), + status_code, MakeClosureCompletion(callback))); } void BackgroundSyncManager::EventCompleteImpl( @@ -1442,7 +1441,7 @@ void BackgroundSyncManager::CompleteStatusAndRegistrationCallback( scoped_ptr<BackgroundSyncRegistrationHandle> registration_handle) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - callback.Run(status, registration_handle.Pass()); + callback.Run(status, std::move(registration_handle)); op_scheduler_.CompleteOperationAndRunNext(); } @@ -1453,7 +1452,7 @@ void BackgroundSyncManager::CompleteStatusAndRegistrationsCallback( registration_handles) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - callback.Run(status, registration_handles.Pass()); + callback.Run(status, std::move(registration_handles)); op_scheduler_.CompleteOperationAndRunNext(); } diff --git a/content/browser/background_sync/background_sync_manager.h b/content/browser/background_sync/background_sync_manager.h index 7b12f6c..5a88d1e 100644 --- a/content/browser/background_sync/background_sync_manager.h +++ b/content/browser/background_sync/background_sync_manager.h @@ -111,7 +111,7 @@ class CONTENT_EXPORT BackgroundSyncManager void set_clock(scoped_ptr<base::Clock> clock) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - clock_ = clock.Pass(); + clock_ = std::move(clock); } void set_max_sync_attempts(int max_attempts) { DCHECK_CURRENTLY_ON(BrowserThread::IO); diff --git a/content/browser/background_sync/background_sync_manager_unittest.cc b/content/browser/background_sync/background_sync_manager_unittest.cc index 1bd17d6..de8b956 100644 --- a/content/browser/background_sync/background_sync_manager_unittest.cc +++ b/content/browser/background_sync/background_sync_manager_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/background_sync/background_sync_manager.h" #include <stdint.h> +#include <utility> #include "base/files/scoped_temp_dir.h" #include "base/location.h" @@ -340,7 +341,7 @@ class BackgroundSyncManagerTest : public testing::Test { new TestBackgroundSyncController()); test_controller_ = background_sync_controller.get(); helper_->browser_context()->SetBackgroundSyncController( - background_sync_controller.Pass()); + std::move(background_sync_controller)); SetMaxSyncAttemptsAndRestartManager(1); @@ -408,7 +409,7 @@ class BackgroundSyncManagerTest : public testing::Test { scoped_ptr<BackgroundSyncRegistrationHandle> registration_handle) { *was_called = true; callback_status_ = status; - callback_registration_handle_ = registration_handle.Pass(); + callback_registration_handle_ = std::move(registration_handle); } void StatusAndRegistrationsCallback( @@ -418,7 +419,7 @@ class BackgroundSyncManagerTest : public testing::Test { registration_handles) { *was_called = true; callback_status_ = status; - callback_registration_handles_ = registration_handles.Pass(); + callback_registration_handles_ = std::move(registration_handles); } void StatusCallback(bool* was_called, BackgroundSyncStatus status) { @@ -721,7 +722,7 @@ TEST_F(BackgroundSyncManagerTest, RegisterWithoutActiveSWRegistration) { TEST_F(BackgroundSyncManagerTest, RegisterOverwrites) { EXPECT_TRUE(Register(sync_options_1_)); scoped_ptr<BackgroundSyncRegistrationHandle> first_registration_handle = - callback_registration_handle_.Pass(); + std::move(callback_registration_handle_); sync_options_1_.min_period = 100; EXPECT_TRUE(Register(sync_options_1_)); @@ -895,7 +896,7 @@ TEST_F(BackgroundSyncManagerTest, RegisterMaxTagLength) { TEST_F(BackgroundSyncManagerTest, RegistrationIncreasesId) { EXPECT_TRUE(Register(sync_options_1_)); scoped_ptr<BackgroundSyncRegistrationHandle> registered_handle = - callback_registration_handle_.Pass(); + std::move(callback_registration_handle_); BackgroundSyncRegistration::RegistrationId cur_id = registered_handle->handle_id(); @@ -1397,7 +1398,7 @@ TEST_F(BackgroundSyncManagerTest, OverwritePendingRegistration) { EXPECT_EQ(POWER_STATE_AVOID_DRAINING, callback_registration_handle_->options()->power_state); scoped_ptr<BackgroundSyncRegistrationHandle> original_handle = - callback_registration_handle_.Pass(); + std::move(callback_registration_handle_); // Overwrite the pending registration. sync_options_1_.power_state = POWER_STATE_AUTO; @@ -1419,7 +1420,7 @@ TEST_F(BackgroundSyncManagerTest, OverwriteFiringRegistrationWhichSucceeds) { sync_options_1_.power_state = POWER_STATE_AVOID_DRAINING; RegisterAndVerifySyncEventDelayed(sync_options_1_); scoped_ptr<BackgroundSyncRegistrationHandle> original_handle = - callback_registration_handle_.Pass(); + std::move(callback_registration_handle_); // The next registration won't block. InitSyncEventTest(); @@ -1443,7 +1444,7 @@ TEST_F(BackgroundSyncManagerTest, OverwriteFiringRegistrationWhichFails) { sync_options_1_.power_state = POWER_STATE_AVOID_DRAINING; RegisterAndVerifySyncEventDelayed(sync_options_1_); scoped_ptr<BackgroundSyncRegistrationHandle> original_handle = - callback_registration_handle_.Pass(); + std::move(callback_registration_handle_); // The next registration won't block. InitSyncEventTest(); diff --git a/content/browser/background_sync/background_sync_service_impl.cc b/content/browser/background_sync/background_sync_service_impl.cc index f90433d..ffab6ab 100644 --- a/content/browser/background_sync/background_sync_service_impl.cc +++ b/content/browser/background_sync/background_sync_service_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/background_sync/background_sync_service_impl.h" +#include <utility> + #include "background_sync_registration_handle.h" #include "base/memory/weak_ptr.h" #include "base/stl_util.h" @@ -41,7 +43,7 @@ SyncRegistrationPtr ToMojoRegistration( static_cast<content::BackgroundSyncPowerState>(in.options()->power_state); out->network_state = static_cast<content::BackgroundSyncNetworkState>( in.options()->network_state); - return out.Pass(); + return out; } } // namespace @@ -97,7 +99,7 @@ BackgroundSyncServiceImpl::BackgroundSyncServiceImpl( BackgroundSyncContextImpl* background_sync_context, mojo::InterfaceRequest<BackgroundSyncService> request) : background_sync_context_(background_sync_context), - binding_(this, request.Pass()), + binding_(this, std::move(request)), weak_ptr_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::IO); DCHECK(background_sync_context); @@ -212,7 +214,7 @@ void BackgroundSyncServiceImpl::DuplicateRegistrationHandle( active_handles_.AddWithID(registration_handle.release(), handle_ptr->handle_id()); SyncRegistrationPtr mojoResult = ToMojoRegistration(*handle_ptr); - callback.Run(BACKGROUND_SYNC_ERROR_NONE, mojoResult.Pass()); + callback.Run(BACKGROUND_SYNC_ERROR_NONE, std::move(mojoResult)); } void BackgroundSyncServiceImpl::ReleaseRegistration( @@ -260,7 +262,7 @@ void BackgroundSyncServiceImpl::OnRegisterResult( active_handles_.AddWithID(result.release(), result_ptr->handle_id()); SyncRegistrationPtr mojoResult = ToMojoRegistration(*result_ptr); callback.Run(static_cast<content::BackgroundSyncError>(status), - mojoResult.Pass()); + std::move(mojoResult)); } void BackgroundSyncServiceImpl::OnUnregisterResult( @@ -287,7 +289,7 @@ void BackgroundSyncServiceImpl::OnGetRegistrationsResult( result_registrations->weak_clear(); callback.Run(static_cast<content::BackgroundSyncError>(status), - mojo_registrations.Pass()); + std::move(mojo_registrations)); } void BackgroundSyncServiceImpl::OnNotifyWhenFinishedResult( diff --git a/content/browser/background_sync/background_sync_service_impl_unittest.cc b/content/browser/background_sync/background_sync_service_impl_unittest.cc index 306bbe5..7d7b3ed 100644 --- a/content/browser/background_sync/background_sync_service_impl_unittest.cc +++ b/content/browser/background_sync/background_sync_service_impl_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/background_sync/background_sync_service_impl.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -179,7 +180,7 @@ class BackgroundSyncServiceImplTest : public testing::Test { mojo::InterfaceRequest<BackgroundSyncService> service_request = mojo::GetProxy(&service_ptr_); // Create a new BackgroundSyncServiceImpl bound to the dummy channel - background_sync_context_->CreateService(service_request.Pass()); + background_sync_context_->CreateService(std::move(service_request)); base::RunLoop().RunUntilIdle(); service_impl_ = *background_sync_context_->services_.begin(); @@ -190,7 +191,7 @@ class BackgroundSyncServiceImplTest : public testing::Test { void RegisterOneShot( SyncRegistrationPtr sync, const BackgroundSyncService::RegisterCallback& callback) { - service_impl_->Register(sync.Pass(), sw_registration_id_, + service_impl_->Register(std::move(sync), sw_registration_id_, false /* requested_from_service_worker */, callback); base::RunLoop().RunUntilIdle(); diff --git a/content/browser/battery_status/battery_monitor_impl_browsertest.cc b/content/browser/battery_status/battery_monitor_impl_browsertest.cc index 4c6a7e5..8e4b6bc 100644 --- a/content/browser/battery_status/battery_monitor_impl_browsertest.cc +++ b/content/browser/battery_status/battery_monitor_impl_browsertest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/macros.h" #include "base/thread_task_runner_handle.h" #include "content/public/browser/web_contents.h" @@ -77,7 +79,7 @@ class BatteryMonitorImplTest : public ContentBrowserTest { battery_service_->GetUpdateCallbackForTesting())); battery_manager_ = battery_manager.get(); - battery_service_->SetBatteryManagerForTesting(battery_manager.Pass()); + battery_service_->SetBatteryManagerForTesting(std::move(battery_manager)); } void TearDown() override { diff --git a/content/browser/battery_status/battery_monitor_integration_browsertest.cc b/content/browser/battery_status/battery_monitor_integration_browsertest.cc index 835e5f1..468126f 100644 --- a/content/browser/battery_status/battery_monitor_integration_browsertest.cc +++ b/content/browser/battery_status/battery_monitor_integration_browsertest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/callback_list.h" #include "base/lazy_instance.h" #include "base/macros.h" @@ -48,15 +50,14 @@ void UpdateBattery(const device::BatteryStatus& battery_status) { class FakeBatteryMonitor : public device::BatteryMonitor { public: static void Create(mojo::InterfaceRequest<BatteryMonitor> request) { - new FakeBatteryMonitor(request.Pass()); + new FakeBatteryMonitor(std::move(request)); } private: typedef mojo::Callback<void(device::BatteryStatusPtr)> BatteryStatusCallback; FakeBatteryMonitor(mojo::InterfaceRequest<BatteryMonitor> request) - : binding_(this, request.Pass()) { - } + : binding_(this, std::move(request)) {} ~FakeBatteryMonitor() override {} void QueryNextStatus(const BatteryStatusCallback& callback) override { diff --git a/content/browser/bluetooth/bluetooth_dispatcher_host.cc b/content/browser/bluetooth/bluetooth_dispatcher_host.cc index 3f93b2b..56a1d4f 100644 --- a/content/browser/bluetooth/bluetooth_dispatcher_host.cc +++ b/content/browser/bluetooth/bluetooth_dispatcher_host.cc @@ -340,7 +340,7 @@ struct BluetoothDispatcherHost::RequestDeviceSession { for (const BluetoothUUID& service : services) { discovery_filter->AddUUID(service); } - return discovery_filter.Pass(); + return discovery_filter; } const int thread_id; @@ -442,7 +442,7 @@ void BluetoothDispatcherHost::StopDeviceDiscovery() { !iter.IsAtEnd(); iter.Advance()) { RequestDeviceSession* session = iter.GetCurrentValue(); if (session->discovery_session) { - StopDiscoverySession(session->discovery_session.Pass()); + StopDiscoverySession(std::move(session->discovery_session)); } if (session->chooser) { session->chooser->ShowDiscoveryState( @@ -991,14 +991,14 @@ void BluetoothDispatcherHost::OnDiscoverySessionStarted( VLOG(1) << "Started discovery session for " << chooser_id; if (RequestDeviceSession* session = request_device_sessions_.Lookup(chooser_id)) { - session->discovery_session = discovery_session.Pass(); + session->discovery_session = std::move(discovery_session); // Arrange to stop discovery later. discovery_session_timer_.Reset(); } else { VLOG(1) << "Chooser " << chooser_id << " was closed before the session finished starting. Stopping."; - StopDiscoverySession(discovery_session.Pass()); + StopDiscoverySession(std::move(discovery_session)); } } @@ -1139,7 +1139,7 @@ void BluetoothDispatcherHost::OnGATTConnectionCreated( base::TimeTicks start_time, scoped_ptr<device::BluetoothGattConnection> connection) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - connections_.push_back(connection.Pass()); + connections_.push_back(std::move(connection)); RecordConnectGATTTimeSuccess(base::TimeTicks::Now() - start_time); RecordConnectGATTOutcome(UMAConnectGATTOutcome::SUCCESS); Send(new BluetoothMsg_ConnectGATTSuccess(thread_id, request_id, device_id)); @@ -1229,7 +1229,7 @@ void BluetoothDispatcherHost::OnStartNotifySessionSuccess( const std::string characteristic_instance_id = notify_session->GetCharacteristicIdentifier(); characteristic_id_to_notify_session_.insert( - std::make_pair(characteristic_instance_id, notify_session.Pass())); + std::make_pair(characteristic_instance_id, std::move(notify_session))); Send(new BluetoothMsg_StartNotificationsSuccess(thread_id, request_id)); } diff --git a/content/browser/browser_context.cc b/content/browser/browser_context.cc index 566cdb5..fc3f644 100644 --- a/content/browser/browser_context.cc +++ b/content/browser/browser_context.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "build/build_config.h" @@ -119,8 +120,8 @@ void BrowserContext::GarbageCollectStoragePartitions( BrowserContext* browser_context, scoped_ptr<base::hash_set<base::FilePath> > active_paths, const base::Closure& done) { - GetStoragePartitionMap(browser_context)->GarbageCollect( - active_paths.Pass(), done); + GetStoragePartitionMap(browser_context) + ->GarbageCollect(std::move(active_paths), done); } DownloadManager* BrowserContext::GetDownloadManager( diff --git a/content/browser/browser_main_loop.cc b/content/browser/browser_main_loop.cc index 81f56ea..f733d3a 100644 --- a/content/browser/browser_main_loop.cc +++ b/content/browser/browser_main_loop.cc @@ -5,6 +5,7 @@ #include "content/browser/browser_main_loop.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -555,7 +556,8 @@ void BrowserMainLoop::PostMainMessageLoopStart() { TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:PowerMonitor"); scoped_ptr<base::PowerMonitorSource> power_monitor_source( new base::PowerMonitorDeviceSource()); - power_monitor_.reset(new base::PowerMonitor(power_monitor_source.Pass())); + power_monitor_.reset( + new base::PowerMonitor(std::move(power_monitor_source))); } { TRACE_EVENT0("startup", "BrowserMainLoop::Subsystem:HighResTimerManager"); @@ -1078,7 +1080,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { switch (thread_id) { case BrowserThread::DB: { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:DBThread"); - ResetThread_DB(db_thread_.Pass()); + ResetThread_DB(std::move(db_thread_)); break; } case BrowserThread::FILE: { @@ -1089,28 +1091,28 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { if (resource_dispatcher_host_) resource_dispatcher_host_.get()->save_file_manager()->Shutdown(); #endif // !defined(OS_IOS) - ResetThread_FILE(file_thread_.Pass()); + ResetThread_FILE(std::move(file_thread_)); break; } case BrowserThread::FILE_USER_BLOCKING: { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:FileUserBlockingThread"); - ResetThread_FILE_USER_BLOCKING(file_user_blocking_thread_.Pass()); + ResetThread_FILE_USER_BLOCKING(std::move(file_user_blocking_thread_)); break; } case BrowserThread::PROCESS_LAUNCHER: { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:LauncherThread"); - ResetThread_PROCESS_LAUNCHER(process_launcher_thread_.Pass()); + ResetThread_PROCESS_LAUNCHER(std::move(process_launcher_thread_)); break; } case BrowserThread::CACHE: { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:CacheThread"); - ResetThread_CACHE(cache_thread_.Pass()); + ResetThread_CACHE(std::move(cache_thread_)); break; } case BrowserThread::IO: { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IOThread"); - ResetThread_IO(io_thread_.Pass()); + ResetThread_IO(std::move(io_thread_)); break; } case BrowserThread::UI: @@ -1124,7 +1126,7 @@ void BrowserMainLoop::ShutdownThreadsAndCleanUp() { #if !defined(OS_IOS) { TRACE_EVENT0("shutdown", "BrowserMainLoop::Subsystem:IndexedDBThread"); - ResetThread_IndexedDb(indexed_db_thread_.Pass()); + ResetThread_IndexedDb(std::move(indexed_db_thread_)); } #endif diff --git a/content/browser/byte_stream.cc b/content/browser/byte_stream.cc index b51cded..0a8939e 100644 --- a/content/browser/byte_stream.cc +++ b/content/browser/byte_stream.cc @@ -384,8 +384,8 @@ void ByteStreamReaderImpl::TransferData( // If our target is no longer alive, do nothing. if (!object_lifetime_flag->is_alive) return; - target->TransferDataInternal( - transfer_buffer.Pass(), buffer_size, source_complete, status); + target->TransferDataInternal(std::move(transfer_buffer), buffer_size, + source_complete, status); } void ByteStreamReaderImpl::TransferDataInternal( diff --git a/content/browser/cache_storage/cache_storage.cc b/content/browser/cache_storage/cache_storage.cc index 6697f91..362af37 100644 --- a/content/browser/cache_storage/cache_storage.cc +++ b/content/browser/cache_storage/cache_storage.cc @@ -5,9 +5,9 @@ #include "content/browser/cache_storage/cache_storage.h" #include <stddef.h> - #include <set> #include <string> +#include <utility> #include "base/barrier_closure.h" #include "base/files/file_util.h" @@ -156,7 +156,7 @@ class CacheStorage::MemoryLoader : public CacheStorage::CacheLoader { void LoadIndex(scoped_ptr<std::vector<std::string>> cache_names, const StringVectorCallback& callback) override { - callback.Run(cache_names.Pass()); + callback.Run(std::move(cache_names)); } private: @@ -346,7 +346,7 @@ class CacheStorage::SimpleCacheLoader : public CacheStorage::CacheLoader { cache_task_runner_->PostTask( FROM_HERE, base::Bind(&DeleteUnreferencedCachesInPool, origin_path_, base::Passed(&cache_dirs))); - callback.Run(names.Pass()); + callback.Run(std::move(names)); } private: @@ -537,9 +537,9 @@ void CacheStorage::MatchCache( CacheStorageCache::ResponseCallback pending_callback = base::Bind(&CacheStorage::PendingResponseCallback, weak_factory_.GetWeakPtr(), callback); - scheduler_->ScheduleOperation( - base::Bind(&CacheStorage::MatchCacheImpl, weak_factory_.GetWeakPtr(), - cache_name, base::Passed(request.Pass()), pending_callback)); + scheduler_->ScheduleOperation(base::Bind( + &CacheStorage::MatchCacheImpl, weak_factory_.GetWeakPtr(), cache_name, + base::Passed(std::move(request)), pending_callback)); } void CacheStorage::MatchAllCaches( @@ -555,7 +555,7 @@ void CacheStorage::MatchAllCaches( weak_factory_.GetWeakPtr(), callback); scheduler_->ScheduleOperation( base::Bind(&CacheStorage::MatchAllCachesImpl, weak_factory_.GetWeakPtr(), - base::Passed(request.Pass()), pending_callback)); + base::Passed(std::move(request)), pending_callback)); } void CacheStorage::CloseAllCaches(const base::Closure& callback) { @@ -623,7 +623,7 @@ void CacheStorage::LazyInitImpl() { scoped_ptr<std::vector<std::string>> indexed_cache_names( new std::vector<std::string>()); - cache_loader_->LoadIndex(indexed_cache_names.Pass(), + cache_loader_->LoadIndex(std::move(indexed_cache_names), base::Bind(&CacheStorage::LazyInitDidLoadIndex, weak_factory_.GetWeakPtr())); } @@ -780,7 +780,7 @@ void CacheStorage::MatchCacheImpl( // Pass the cache along to the callback to keep the cache open until match is // done. - cache->Match(request.Pass(), + cache->Match(std::move(request), base::Bind(&CacheStorage::MatchCacheDidMatch, weak_factory_.GetWeakPtr(), cache, callback)); } @@ -791,7 +791,7 @@ void CacheStorage::MatchCacheDidMatch( CacheStorageError error, scoped_ptr<ServiceWorkerResponse> response, scoped_ptr<storage::BlobDataHandle> handle) { - callback.Run(error, response.Pass(), handle.Pass()); + callback.Run(error, std::move(response), std::move(handle)); } void CacheStorage::MatchAllCachesImpl( @@ -805,7 +805,7 @@ void CacheStorage::MatchAllCachesImpl( base::BarrierClosure(ordered_cache_names_.size(), base::Bind(&CacheStorage::MatchAllCachesDidMatchAll, weak_factory_.GetWeakPtr(), - base::Passed(callback_copy.Pass()))); + base::Passed(std::move(callback_copy)))); for (const std::string& cache_name : ordered_cache_names_) { scoped_refptr<CacheStorageCache> cache = GetLoadedCache(cache_name); @@ -829,7 +829,7 @@ void CacheStorage::MatchAllCachesDidMatch( barrier_closure.Run(); return; } - callback->Run(error, response.Pass(), handle.Pass()); + callback->Run(error, std::move(response), std::move(handle)); callback->Reset(); // Only call the callback once. barrier_closure.Run(); @@ -970,7 +970,7 @@ void CacheStorage::PendingResponseCallback( scoped_ptr<storage::BlobDataHandle> blob_data_handle) { base::WeakPtr<CacheStorage> cache_storage = weak_factory_.GetWeakPtr(); - callback.Run(error, response.Pass(), blob_data_handle.Pass()); + callback.Run(error, std::move(response), std::move(blob_data_handle)); if (cache_storage) scheduler_->CompleteOperationAndRunNext(); } diff --git a/content/browser/cache_storage/cache_storage_blob_to_disk_cache.cc b/content/browser/cache_storage/cache_storage_blob_to_disk_cache.cc index 80a666c..08dffc3 100644 --- a/content/browser/cache_storage/cache_storage_blob_to_disk_cache.cc +++ b/content/browser/cache_storage/cache_storage_blob_to_disk_cache.cc @@ -4,6 +4,8 @@ #include "content/browser/cache_storage/cache_storage_blob_to_disk_cache.h" +#include <utility> + #include "base/logging.h" #include "net/base/io_buffer.h" #include "net/url_request/url_request_context.h" @@ -39,19 +41,19 @@ void CacheStorageBlobToDiskCache::StreamBlobToCache( DCHECK(!blob_request_); if (!request_context_getter->GetURLRequestContext()) { - callback.Run(entry.Pass(), false /* success */); + callback.Run(std::move(entry), false /* success */); return; } disk_cache_body_index_ = disk_cache_body_index; - entry_ = entry.Pass(); + entry_ = std::move(entry); callback_ = callback; request_context_getter_ = request_context_getter; blob_request_ = storage::BlobProtocolHandler::CreateBlobRequest( - blob_data_handle.Pass(), request_context_getter->GetURLRequestContext(), - this); + std::move(blob_data_handle), + request_context_getter->GetURLRequestContext(), this); request_context_getter_->AddObserver(this); blob_request_->Start(); } @@ -144,7 +146,7 @@ void CacheStorageBlobToDiskCache::RunCallbackAndRemoveObserver(bool success) { request_context_getter_->RemoveObserver(this); blob_request_.reset(); - callback_.Run(entry_.Pass(), success); + callback_.Run(std::move(entry_), success); } } // namespace content diff --git a/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc b/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc index b4e88a8..28e6c0c 100644 --- a/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc +++ b/content/browser/cache_storage/cache_storage_blob_to_disk_cache_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/cache_storage/cache_storage_blob_to_disk_cache.h" #include <string> +#include <utility> #include "base/files/file_path.h" #include "base/macros.h" @@ -170,8 +171,8 @@ class CacheStorageBlobToDiskCacheTest : public testing::Test { blob_storage_context_->GetBlobDataFromUUID(blob_handle_->uuid())); cache_storage_blob_to_disk_cache_->StreamBlobToCache( - disk_cache_entry_.Pass(), kCacheEntryIndex, url_request_context_getter_, - new_data_handle.Pass(), + std::move(disk_cache_entry_), kCacheEntryIndex, + url_request_context_getter_, std::move(new_data_handle), base::Bind(&CacheStorageBlobToDiskCacheTest::StreamCallback, base::Unretained(this))); @@ -181,7 +182,7 @@ class CacheStorageBlobToDiskCacheTest : public testing::Test { } void StreamCallback(disk_cache::ScopedEntryPtr entry_ptr, bool success) { - disk_cache_entry_ = entry_ptr.Pass(); + disk_cache_entry_ = std::move(entry_ptr); callback_success_ = success; callback_called_ = true; } diff --git a/content/browser/cache_storage/cache_storage_cache.cc b/content/browser/cache_storage/cache_storage_cache.cc index 6233737..a99154f 100644 --- a/content/browser/cache_storage/cache_storage_cache.cc +++ b/content/browser/cache_storage/cache_storage_cache.cc @@ -5,8 +5,8 @@ #include "content/browser/cache_storage/cache_storage_cache.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/barrier_closure.h" #include "base/files/file_path.h" @@ -43,7 +43,7 @@ class CacheStorageCacheDataHandle public: CacheStorageCacheDataHandle(const scoped_refptr<CacheStorageCache>& cache, disk_cache::ScopedEntryPtr entry) - : cache_(cache), entry_(entry.Pass()) {} + : cache_(cache), entry_(std::move(entry)) {} private: ~CacheStorageCacheDataHandle() override {} @@ -180,7 +180,7 @@ void ReadMetadataDidReadMetadata( return; } - callback.Run(metadata.Pass()); + callback.Run(std::move(metadata)); } } // namespace @@ -260,9 +260,9 @@ struct CacheStorageCache::PutContext { const scoped_refptr<net::URLRequestContextGetter>& request_context_getter, const scoped_refptr<storage::QuotaManagerProxy>& quota_manager_proxy) : origin(origin), - request(request.Pass()), - response(response.Pass()), - blob_data_handle(blob_data_handle.Pass()), + request(std::move(request)), + response(std::move(response)), + blob_data_handle(std::move(blob_data_handle)), callback(callback), request_context_getter(request_context_getter), quota_manager_proxy(quota_manager_proxy) {} @@ -324,7 +324,7 @@ void CacheStorageCache::Match(scoped_ptr<ServiceWorkerFetchRequest> request, weak_ptr_factory_.GetWeakPtr(), callback); scheduler_->ScheduleOperation( base::Bind(&CacheStorageCache::MatchImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(request.Pass()), pending_callback)); + base::Passed(std::move(request)), pending_callback)); } void CacheStorageCache::MatchAll(const ResponsesCallback& callback) { @@ -353,8 +353,9 @@ void CacheStorageCache::BatchOperation( scoped_ptr<ErrorCallback> callback_copy(new ErrorCallback(callback)); ErrorCallback* callback_ptr = callback_copy.get(); base::Closure barrier_closure = base::BarrierClosure( - operations.size(), base::Bind(&CacheStorageCache::BatchDidAllOperations, - this, base::Passed(callback_copy.Pass()))); + operations.size(), + base::Bind(&CacheStorageCache::BatchDidAllOperations, this, + base::Passed(std::move(callback_copy)))); ErrorCallback completion_callback = base::Bind(&CacheStorageCache::BatchDidOneOperation, this, barrier_closure, callback_ptr); @@ -495,7 +496,7 @@ void CacheStorageCache::OpenAllEntries(const OpenAllEntriesCallback& callback) { net::CompletionCallback open_entry_callback = base::Bind( &CacheStorageCache::DidOpenNextEntry, weak_ptr_factory_.GetWeakPtr(), - base::Passed(entries_context.Pass()), callback); + base::Passed(std::move(entries_context)), callback); int rv = iterator.OpenNextEntry(enumerated_entry, open_entry_callback); @@ -510,17 +511,17 @@ void CacheStorageCache::DidOpenNextEntry( if (rv == net::ERR_FAILED) { DCHECK(!entries_context->enumerated_entry); // Enumeration is complete, extract the requests from the entries. - callback.Run(entries_context.Pass(), CACHE_STORAGE_OK); + callback.Run(std::move(entries_context), CACHE_STORAGE_OK); return; } if (rv < 0) { - callback.Run(entries_context.Pass(), CACHE_STORAGE_ERROR_STORAGE); + callback.Run(std::move(entries_context), CACHE_STORAGE_ERROR_STORAGE); return; } if (backend_state_ != BACKEND_OPEN) { - callback.Run(entries_context.Pass(), CACHE_STORAGE_ERROR_NOT_FOUND); + callback.Run(std::move(entries_context), CACHE_STORAGE_ERROR_NOT_FOUND); return; } @@ -533,7 +534,7 @@ void CacheStorageCache::DidOpenNextEntry( disk_cache::Entry** enumerated_entry = &entries_context->enumerated_entry; net::CompletionCallback open_entry_callback = base::Bind( &CacheStorageCache::DidOpenNextEntry, weak_ptr_factory_.GetWeakPtr(), - base::Passed(entries_context.Pass()), callback); + base::Passed(std::move(entries_context)), callback); rv = iterator.OpenNextEntry(enumerated_entry, open_entry_callback); @@ -555,10 +556,10 @@ void CacheStorageCache::MatchImpl(scoped_ptr<ServiceWorkerFetchRequest> request, disk_cache::Entry** entry_ptr = scoped_entry_ptr.get(); ServiceWorkerFetchRequest* request_ptr = request.get(); - net::CompletionCallback open_entry_callback = - base::Bind(&CacheStorageCache::MatchDidOpenEntry, - weak_ptr_factory_.GetWeakPtr(), base::Passed(request.Pass()), - callback, base::Passed(scoped_entry_ptr.Pass())); + net::CompletionCallback open_entry_callback = base::Bind( + &CacheStorageCache::MatchDidOpenEntry, weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(request)), callback, + base::Passed(std::move(scoped_entry_ptr))); int rv = backend_->OpenEntry(request_ptr->url.spec(), entry_ptr, open_entry_callback); @@ -581,7 +582,8 @@ void CacheStorageCache::MatchDidOpenEntry( MetadataCallback headers_callback = base::Bind( &CacheStorageCache::MatchDidReadMetadata, weak_ptr_factory_.GetWeakPtr(), - base::Passed(request.Pass()), callback, base::Passed(entry.Pass())); + base::Passed(std::move(request)), callback, + base::Passed(std::move(entry))); ReadMetadata(*entry_ptr, headers_callback); } @@ -618,7 +620,7 @@ void CacheStorageCache::MatchDidReadMetadata( } if (entry->GetDataSize(INDEX_RESPONSE_BODY) == 0) { - callback.Run(CACHE_STORAGE_OK, response.Pass(), + callback.Run(CACHE_STORAGE_OK, std::move(response), scoped_ptr<storage::BlobDataHandle>()); return; } @@ -631,8 +633,9 @@ void CacheStorageCache::MatchDidReadMetadata( } scoped_ptr<storage::BlobDataHandle> blob_data_handle = - PopulateResponseBody(entry.Pass(), response.get()); - callback.Run(CACHE_STORAGE_OK, response.Pass(), blob_data_handle.Pass()); + PopulateResponseBody(std::move(entry), response.get()); + callback.Run(CACHE_STORAGE_OK, std::move(response), + std::move(blob_data_handle)); } void CacheStorageCache::MatchAllImpl(const ResponsesCallback& callback) { @@ -659,7 +662,7 @@ void CacheStorageCache::MatchAllDidOpenAllEntries( scoped_ptr<MatchAllContext> context(new MatchAllContext(callback)); context->entries_context.swap(entries_context); Entries::iterator iter = context->entries_context->entries.begin(); - MatchAllProcessNextEntry(context.Pass(), iter); + MatchAllProcessNextEntry(std::move(context), iter); } void CacheStorageCache::MatchAllProcessNextEntry( @@ -668,14 +671,14 @@ void CacheStorageCache::MatchAllProcessNextEntry( if (iter == context->entries_context->entries.end()) { // All done. Return all of the responses. context->original_callback.Run(CACHE_STORAGE_OK, - context->out_responses.Pass(), - context->out_blob_data_handles.Pass()); + std::move(context->out_responses), + std::move(context->out_blob_data_handles)); return; } ReadMetadata(*iter, base::Bind(&CacheStorageCache::MatchAllDidReadMetadata, weak_ptr_factory_.GetWeakPtr(), - base::Passed(context.Pass()), iter)); + base::Passed(std::move(context)), iter)); } void CacheStorageCache::MatchAllDidReadMetadata( @@ -688,7 +691,7 @@ void CacheStorageCache::MatchAllDidReadMetadata( if (!metadata) { entry->Doom(); - MatchAllProcessNextEntry(context.Pass(), iter + 1); + MatchAllProcessNextEntry(std::move(context), iter + 1); return; } @@ -697,7 +700,7 @@ void CacheStorageCache::MatchAllDidReadMetadata( if (entry->GetDataSize(INDEX_RESPONSE_BODY) == 0) { context->out_responses->push_back(response); - MatchAllProcessNextEntry(context.Pass(), iter + 1); + MatchAllProcessNextEntry(std::move(context), iter + 1); return; } @@ -709,11 +712,11 @@ void CacheStorageCache::MatchAllDidReadMetadata( } scoped_ptr<storage::BlobDataHandle> blob_data_handle = - PopulateResponseBody(entry.Pass(), &response); + PopulateResponseBody(std::move(entry), &response); context->out_responses->push_back(response); context->out_blob_data_handles->push_back(*blob_data_handle); - MatchAllProcessNextEntry(context.Pass(), iter + 1); + MatchAllProcessNextEntry(std::move(context), iter + 1); } void CacheStorageCache::Put(const CacheStorageBatchOperation& operation, @@ -758,13 +761,14 @@ void CacheStorageCache::Put(const CacheStorageBatchOperation& operation, base::Bind(&CacheStorageCache::PendingErrorCallback, weak_ptr_factory_.GetWeakPtr(), callback); - scoped_ptr<PutContext> put_context(new PutContext( - origin_, request.Pass(), response.Pass(), blob_data_handle.Pass(), - pending_callback, request_context_getter_, quota_manager_proxy_)); + scoped_ptr<PutContext> put_context( + new PutContext(origin_, std::move(request), std::move(response), + std::move(blob_data_handle), pending_callback, + request_context_getter_, quota_manager_proxy_)); - scheduler_->ScheduleOperation(base::Bind(&CacheStorageCache::PutImpl, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(put_context.Pass()))); + scheduler_->ScheduleOperation( + base::Bind(&CacheStorageCache::PutImpl, weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(put_context)))); } void CacheStorageCache::PutImpl(scoped_ptr<PutContext> put_context) { @@ -777,9 +781,10 @@ void CacheStorageCache::PutImpl(scoped_ptr<PutContext> put_context) { scoped_ptr<ServiceWorkerFetchRequest> request_copy( new ServiceWorkerFetchRequest(*put_context->request)); - DeleteImpl(request_copy.Pass(), base::Bind(&CacheStorageCache::PutDidDelete, - weak_ptr_factory_.GetWeakPtr(), - base::Passed(put_context.Pass()))); + DeleteImpl(std::move(request_copy), + base::Bind(&CacheStorageCache::PutDidDelete, + weak_ptr_factory_.GetWeakPtr(), + base::Passed(std::move(put_context)))); } void CacheStorageCache::PutDidDelete(scoped_ptr<PutContext> put_context, @@ -796,7 +801,8 @@ void CacheStorageCache::PutDidDelete(scoped_ptr<PutContext> put_context, net::CompletionCallback create_entry_callback = base::Bind( &CacheStorageCache::PutDidCreateEntry, weak_ptr_factory_.GetWeakPtr(), - base::Passed(scoped_entry_ptr.Pass()), base::Passed(put_context.Pass())); + base::Passed(std::move(scoped_entry_ptr)), + base::Passed(std::move(put_context))); int create_rv = backend_ptr->CreateEntry(request_ptr->url.spec(), entry_ptr, create_entry_callback); @@ -851,14 +857,14 @@ void CacheStorageCache::PutDidCreateEntry( } scoped_refptr<net::StringIOBuffer> buffer( - new net::StringIOBuffer(serialized.Pass())); + new net::StringIOBuffer(std::move(serialized))); // Get a temporary copy of the entry pointer before passing it in base::Bind. disk_cache::Entry* temp_entry_ptr = put_context->cache_entry.get(); net::CompletionCallback write_headers_callback = base::Bind( &CacheStorageCache::PutDidWriteHeaders, weak_ptr_factory_.GetWeakPtr(), - base::Passed(put_context.Pass()), buffer->size()); + base::Passed(std::move(put_context)), buffer->size()); rv = temp_entry_ptr->WriteData(INDEX_HEADERS, 0 /* offset */, buffer.get(), buffer->size(), write_headers_callback, @@ -894,7 +900,7 @@ void CacheStorageCache::PutDidWriteHeaders(scoped_ptr<PutContext> put_context, DCHECK(put_context->blob_data_handle); - disk_cache::ScopedEntryPtr entry(put_context->cache_entry.Pass()); + disk_cache::ScopedEntryPtr entry(std::move(put_context->cache_entry)); put_context->cache_entry = NULL; CacheStorageBlobToDiskCache* blob_to_cache = @@ -906,14 +912,14 @@ void CacheStorageCache::PutDidWriteHeaders(scoped_ptr<PutContext> put_context, scoped_refptr<net::URLRequestContextGetter> request_context_getter = put_context->request_context_getter; scoped_ptr<storage::BlobDataHandle> blob_data_handle = - put_context->blob_data_handle.Pass(); + std::move(put_context->blob_data_handle); blob_to_cache->StreamBlobToCache( - entry.Pass(), INDEX_RESPONSE_BODY, request_context_getter, - blob_data_handle.Pass(), + std::move(entry), INDEX_RESPONSE_BODY, request_context_getter, + std::move(blob_data_handle), base::Bind(&CacheStorageCache::PutDidWriteBlobToCache, weak_ptr_factory_.GetWeakPtr(), - base::Passed(put_context.Pass()), blob_to_cache_key)); + base::Passed(std::move(put_context)), blob_to_cache_key)); } void CacheStorageCache::PutDidWriteBlobToCache( @@ -922,7 +928,7 @@ void CacheStorageCache::PutDidWriteBlobToCache( disk_cache::ScopedEntryPtr entry, bool success) { DCHECK(entry); - put_context->cache_entry = entry.Pass(); + put_context->cache_entry = std::move(entry); active_blob_to_disk_cache_writers_.Remove(blob_to_cache_key); @@ -959,7 +965,7 @@ void CacheStorageCache::Delete(const CacheStorageBatchOperation& operation, weak_ptr_factory_.GetWeakPtr(), callback); scheduler_->ScheduleOperation( base::Bind(&CacheStorageCache::DeleteImpl, weak_ptr_factory_.GetWeakPtr(), - base::Passed(request.Pass()), pending_callback)); + base::Passed(std::move(request)), pending_callback)); } void CacheStorageCache::DeleteImpl( @@ -978,8 +984,8 @@ void CacheStorageCache::DeleteImpl( net::CompletionCallback open_entry_callback = base::Bind( &CacheStorageCache::DeleteDidOpenEntry, weak_ptr_factory_.GetWeakPtr(), - origin_, base::Passed(request.Pass()), callback, - base::Passed(entry.Pass()), quota_manager_proxy_); + origin_, base::Passed(std::move(request)), callback, + base::Passed(std::move(entry)), quota_manager_proxy_); int rv = backend_->OpenEntry(request_ptr->url.spec(), entry_ptr, open_entry_callback); @@ -1047,7 +1053,7 @@ void CacheStorageCache::KeysDidOpenAllEntries( scoped_ptr<KeysContext> keys_context(new KeysContext(callback)); keys_context->entries_context.swap(entries_context); Entries::iterator iter = keys_context->entries_context->entries.begin(); - KeysProcessNextEntry(keys_context.Pass(), iter); + KeysProcessNextEntry(std::move(keys_context), iter); } void CacheStorageCache::KeysProcessNextEntry( @@ -1056,13 +1062,13 @@ void CacheStorageCache::KeysProcessNextEntry( if (iter == keys_context->entries_context->entries.end()) { // All done. Return all of the keys. keys_context->original_callback.Run(CACHE_STORAGE_OK, - keys_context->out_keys.Pass()); + std::move(keys_context->out_keys)); return; } ReadMetadata(*iter, base::Bind(&CacheStorageCache::KeysDidReadMetadata, weak_ptr_factory_.GetWeakPtr(), - base::Passed(keys_context.Pass()), iter)); + base::Passed(std::move(keys_context)), iter)); } void CacheStorageCache::KeysDidReadMetadata( @@ -1089,7 +1095,7 @@ void CacheStorageCache::KeysDidReadMetadata( entry->Doom(); } - KeysProcessNextEntry(keys_context.Pass(), iter + 1); + KeysProcessNextEntry(std::move(keys_context), iter + 1); } void CacheStorageCache::CloseImpl(const base::Closure& callback) { @@ -1114,7 +1120,7 @@ void CacheStorageCache::CreateBackend(const ErrorCallback& callback) { net::CompletionCallback create_cache_callback = base::Bind(&CacheStorageCache::CreateBackendDidCreate, weak_ptr_factory_.GetWeakPtr(), callback, - base::Passed(backend_ptr.Pass())); + base::Passed(std::move(backend_ptr))); // TODO(jkarlin): Use the cache task runner that ServiceWorkerCacheCore // has for disk caches. @@ -1136,7 +1142,7 @@ void CacheStorageCache::CreateBackendDidCreate( return; } - backend_ = backend_ptr->Pass(); + backend_ = std::move(*backend_ptr); callback.Run(CACHE_STORAGE_OK); } @@ -1192,7 +1198,7 @@ void CacheStorageCache::PendingResponseCallback( scoped_ptr<storage::BlobDataHandle> blob_data_handle) { base::WeakPtr<CacheStorageCache> cache = weak_ptr_factory_.GetWeakPtr(); - callback.Run(error, response.Pass(), blob_data_handle.Pass()); + callback.Run(error, std::move(response), std::move(blob_data_handle)); if (cache) scheduler_->CompleteOperationAndRunNext(); } @@ -1204,7 +1210,7 @@ void CacheStorageCache::PendingResponsesCallback( scoped_ptr<BlobDataHandles> blob_data_handles) { base::WeakPtr<CacheStorageCache> cache = weak_ptr_factory_.GetWeakPtr(); - callback.Run(error, responses.Pass(), blob_data_handles.Pass()); + callback.Run(error, std::move(responses), std::move(blob_data_handles)); if (cache) scheduler_->CompleteOperationAndRunNext(); } @@ -1215,7 +1221,7 @@ void CacheStorageCache::PendingRequestsCallback( scoped_ptr<Requests> requests) { base::WeakPtr<CacheStorageCache> cache = weak_ptr_factory_.GetWeakPtr(); - callback.Run(error, requests.Pass()); + callback.Run(error, std::move(requests)); if (cache) scheduler_->CompleteOperationAndRunNext(); } @@ -1250,7 +1256,7 @@ scoped_ptr<storage::BlobDataHandle> CacheStorageCache::PopulateResponseBody( disk_cache::Entry* temp_entry = entry.get(); blob_data.AppendDiskCacheEntry( - new CacheStorageCacheDataHandle(this, entry.Pass()), temp_entry, + new CacheStorageCacheDataHandle(this, std::move(entry)), temp_entry, INDEX_RESPONSE_BODY); return blob_storage_context_->AddFinishedBlob(&blob_data); } diff --git a/content/browser/cache_storage/cache_storage_cache_unittest.cc b/content/browser/cache_storage/cache_storage_cache_unittest.cc index d87baa7..b440758 100644 --- a/content/browser/cache_storage/cache_storage_cache_unittest.cc +++ b/content/browser/cache_storage/cache_storage_cache_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" @@ -55,7 +56,7 @@ scoped_ptr<storage::BlobProtocolHandler> CreateMockBlobProtocolHandler( class DelayableBackend : public disk_cache::Backend { public: DelayableBackend(scoped_ptr<disk_cache::Backend> backend) - : backend_(backend.Pass()), delay_open_(false) {} + : backend_(std::move(backend)), delay_open_(false) {} // disk_cache::Backend overrides net::CacheType GetCacheType() const override { @@ -234,7 +235,8 @@ class TestCacheStorageCache : public CacheStorageCache { // created before calling this. DelayableBackend* UseDelayableBackend() { EXPECT_TRUE(backend_); - DelayableBackend* delayable_backend = new DelayableBackend(backend_.Pass()); + DelayableBackend* delayable_backend = + new DelayableBackend(std::move(backend_)); backend_.reset(delayable_backend); return delayable_backend; } @@ -446,10 +448,10 @@ class CacheStorageCacheTest : public testing::Test { scoped_ptr<ServiceWorkerResponse> response, scoped_ptr<storage::BlobDataHandle> body_handle) { callback_error_ = error; - callback_response_ = response.Pass(); + callback_response_ = std::move(response); callback_response_data_.reset(); if (error == CACHE_STORAGE_OK && !callback_response_->blob_uuid.empty()) - callback_response_data_ = body_handle.Pass(); + callback_response_data_ = std::move(body_handle); if (run_loop) run_loop->Quit(); diff --git a/content/browser/cache_storage/cache_storage_dispatcher_host.cc b/content/browser/cache_storage/cache_storage_dispatcher_host.cc index c912c15..073f57d 100644 --- a/content/browser/cache_storage/cache_storage_dispatcher_host.cc +++ b/content/browser/cache_storage/cache_storage_dispatcher_host.cc @@ -5,6 +5,7 @@ #include "content/browser/cache_storage/cache_storage_dispatcher_host.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -190,13 +191,14 @@ void CacheStorageDispatcherHost::OnCacheStorageMatch( if (match_params.cache_name.empty()) { context_->cache_manager()->MatchAllCaches( - origin, scoped_request.Pass(), + origin, std::move(scoped_request), base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, this, thread_id, request_id)); return; } context_->cache_manager()->MatchCache( - origin, base::UTF16ToUTF8(match_params.cache_name), scoped_request.Pass(), + origin, base::UTF16ToUTF8(match_params.cache_name), + std::move(scoped_request), base::Bind(&CacheStorageDispatcherHost::OnCacheStorageMatchCallback, this, thread_id, request_id)); } @@ -219,7 +221,7 @@ void CacheStorageDispatcherHost::OnCacheMatch( new ServiceWorkerFetchRequest(request.url, request.method, request.headers, request.referrer, request.is_reload)); - cache->Match(scoped_request.Pass(), + cache->Match(std::move(scoped_request), base::Bind(&CacheStorageDispatcherHost::OnCacheMatchCallback, this, thread_id, request_id, cache)); } @@ -250,7 +252,7 @@ void CacheStorageDispatcherHost::OnCacheMatchAll( request.headers, request.referrer, request.is_reload)); cache->Match( - scoped_request.Pass(), + std::move(scoped_request), base::Bind(&CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter, this, thread_id, request_id, cache)); } @@ -419,8 +421,8 @@ void CacheStorageDispatcherHost::OnCacheMatchAllCallbackAdapter( if (blob_data_handle) blob_data_handles->push_back(*blob_data_handle); } - OnCacheMatchAllCallback(thread_id, request_id, cache, error, responses.Pass(), - blob_data_handles.Pass()); + OnCacheMatchAllCallback(thread_id, request_id, cache, error, + std::move(responses), std::move(blob_data_handles)); } void CacheStorageDispatcherHost::OnCacheMatchAllCallback( diff --git a/content/browser/cache_storage/cache_storage_manager.cc b/content/browser/cache_storage/cache_storage_manager.cc index 4b55bd4..cd02deb 100644 --- a/content/browser/cache_storage/cache_storage_manager.cc +++ b/content/browser/cache_storage/cache_storage_manager.cc @@ -5,9 +5,9 @@ #include "content/browser/cache_storage/cache_storage_manager.h" #include <stdint.h> - #include <map> #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file_enumerator.h" @@ -125,7 +125,7 @@ scoped_ptr<CacheStorageManager> CacheStorageManager::Create( // the dispatcher host per usual. manager->SetBlobParametersForCache(old_manager->url_request_context_getter(), old_manager->blob_storage_context()); - return manager.Pass(); + return manager; } CacheStorageManager::~CacheStorageManager() = default; @@ -178,7 +178,7 @@ void CacheStorageManager::MatchCache( const CacheStorageCache::ResponseCallback& callback) { CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); - cache_storage->MatchCache(cache_name, request.Pass(), callback); + cache_storage->MatchCache(cache_name, std::move(request), callback); } void CacheStorageManager::MatchAllCaches( @@ -187,7 +187,7 @@ void CacheStorageManager::MatchAllCaches( const CacheStorageCache::ResponseCallback& callback) { CacheStorage* cache_storage = FindOrCreateCacheStorage(origin); - cache_storage->MatchAllCaches(request.Pass(), callback); + cache_storage->MatchAllCaches(std::move(request), callback); } void CacheStorageManager::SetBlobParametersForCache( diff --git a/content/browser/cache_storage/cache_storage_manager_unittest.cc b/content/browser/cache_storage/cache_storage_manager_unittest.cc index 89b9db4..f8d94976 100644 --- a/content/browser/cache_storage/cache_storage_manager_unittest.cc +++ b/content/browser/cache_storage/cache_storage_manager_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -135,8 +136,8 @@ class CacheStorageManagerTest : public testing::Test { scoped_ptr<ServiceWorkerResponse> response, scoped_ptr<storage::BlobDataHandle> blob_data_handle) { callback_error_ = error; - callback_cache_response_ = response.Pass(); - callback_data_handle_ = blob_data_handle.Pass(); + callback_cache_response_ = std::move(response); + callback_data_handle_ = std::move(blob_data_handle); run_loop->Quit(); } @@ -196,7 +197,7 @@ class CacheStorageManagerTest : public testing::Test { request->url = url; base::RunLoop loop; cache_manager_->MatchCache( - origin, cache_name, request.Pass(), + origin, cache_name, std::move(request), base::Bind(&CacheStorageManagerTest::CacheMatchCallback, base::Unretained(this), base::Unretained(&loop))); loop.Run(); @@ -210,7 +211,7 @@ class CacheStorageManagerTest : public testing::Test { request->url = url; base::RunLoop loop; cache_manager_->MatchAllCaches( - origin, request.Pass(), + origin, std::move(request), base::Bind(&CacheStorageManagerTest::CacheMatchCallback, base::Unretained(this), base::Unretained(&loop))); loop.Run(); @@ -255,7 +256,7 @@ class CacheStorageManagerTest : public testing::Test { new ServiceWorkerFetchRequest()); request->url = url; base::RunLoop loop; - cache->Match(request.Pass(), + cache->Match(std::move(request), base::Bind(&CacheStorageManagerTest::CacheMatchCallback, base::Unretained(this), base::Unretained(&loop))); loop.Run(); @@ -470,7 +471,7 @@ TEST_F(CacheStorageManagerTest, StorageReuseCacheName) { EXPECT_TRUE(CachePut(callback_cache_, kTestURL)); EXPECT_TRUE(CacheMatch(callback_cache_, kTestURL)); scoped_ptr<storage::BlobDataHandle> data_handle = - callback_data_handle_.Pass(); + std::move(callback_data_handle_); EXPECT_TRUE(Delete(origin1_, "foo")); // The cache is deleted but the handle to one of its entries is still diff --git a/content/browser/compositor/browser_compositor_output_surface.cc b/content/browser/compositor/browser_compositor_output_surface.cc index 38c8c26..f865702 100644 --- a/content/browser/compositor/browser_compositor_output_surface.cc +++ b/content/browser/compositor/browser_compositor_output_surface.cc @@ -4,6 +4,8 @@ #include "content/browser/compositor/browser_compositor_output_surface.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/location.h" @@ -27,18 +29,19 @@ BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( use_begin_frame_scheduling_( base::CommandLine::ForCurrentProcess() ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { - overlay_candidate_validator_ = overlay_candidate_validator.Pass(); + overlay_candidate_validator_ = std::move(overlay_candidate_validator); Initialize(); } BrowserCompositorOutputSurface::BrowserCompositorOutputSurface( scoped_ptr<cc::SoftwareOutputDevice> software_device, const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) - : OutputSurface(software_device.Pass()), + : OutputSurface(std::move(software_device)), vsync_manager_(vsync_manager), reflector_(nullptr), - use_begin_frame_scheduling_(base::CommandLine::ForCurrentProcess()-> - HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { + use_begin_frame_scheduling_( + base::CommandLine::ForCurrentProcess() + ->HasSwitch(cc::switches::kEnableBeginFrameScheduling)) { Initialize(); } diff --git a/content/browser/compositor/buffer_queue_unittest.cc b/content/browser/compositor/buffer_queue_unittest.cc index 0ec1796..323d7ae 100644 --- a/content/browser/compositor/buffer_queue_unittest.cc +++ b/content/browser/compositor/buffer_queue_unittest.cc @@ -2,14 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/compositor/buffer_queue.h" + #include <stddef.h> #include <stdint.h> - #include <set> +#include <utility> #include "cc/test/test_context_provider.h" #include "cc/test/test_web_graphics_context_3d.h" -#include "content/browser/compositor/buffer_queue.h" #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h" #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" #include "content/common/gpu/client/gl_helper.h" @@ -95,7 +96,7 @@ class BufferQueueTest : public ::testing::Test { void InitWithContext(scoped_ptr<cc::TestWebGraphicsContext3D> context) { scoped_refptr<cc::TestContextProvider> context_provider = - cc::TestContextProvider::Create(context.Pass()); + cc::TestContextProvider::Create(std::move(context)); context_provider->BindToCurrentThread(); gpu_memory_buffer_manager_.reset(new StubBrowserGpuMemoryBufferManager); mock_output_surface_ = @@ -236,7 +237,7 @@ scoped_ptr<BufferQueue> CreateOutputSurfaceWithMock( new BufferQueue(context_provider, target, GL_RGBA, nullptr, gpu_memory_buffer_manager, 1)); buffer_queue->Initialize(); - return buffer_queue.Pass(); + return buffer_queue; } TEST(BufferQueueStandaloneTest, FboInitialization) { diff --git a/content/browser/compositor/delegated_frame_host.cc b/content/browser/compositor/delegated_frame_host.cc index c780212..f381da0 100644 --- a/content/browser/compositor/delegated_frame_host.cc +++ b/content/browser/compositor/delegated_frame_host.cc @@ -155,7 +155,7 @@ void DelegatedFrameHost::CopyFromCompositingSurface( output_size, preferred_color_type, callback)); if (!src_subrect.IsEmpty()) request->set_area(src_subrect); - RequestCopyOfOutput(request.Pass()); + RequestCopyOfOutput(std::move(request)); } void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame( @@ -176,7 +176,7 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceToVideoFrame( target, callback)); request->set_area(src_subrect); - RequestCopyOfOutput(request.Pass()); + RequestCopyOfOutput(std::move(request)); } bool DelegatedFrameHost::CanCopyToBitmap() const { @@ -191,7 +191,7 @@ bool DelegatedFrameHost::CanCopyToVideoFrame() const { void DelegatedFrameHost::BeginFrameSubscription( scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { - frame_subscriber_ = subscriber.Pass(); + frame_subscriber_ = std::move(subscriber); } void DelegatedFrameHost::EndFrameSubscription() { @@ -331,12 +331,12 @@ void DelegatedFrameHost::AttemptFrameSubscriberCapture( // through RequestCopyOfOutput (which goes through the browser // compositor). if (!request_copy_of_output_callback_for_testing_.is_null()) - request_copy_of_output_callback_for_testing_.Run(request.Pass()); + request_copy_of_output_callback_for_testing_.Run(std::move(request)); else - surface_factory_->RequestCopyOfSurface(surface_id_, request.Pass()); + surface_factory_->RequestCopyOfSurface(surface_id_, std::move(request)); } else { request->set_area(gfx::Rect(current_frame_size_in_dip_)); - RequestCopyOfOutput(request.Pass()); + RequestCopyOfOutput(std::move(request)); } } @@ -611,16 +611,15 @@ void DelegatedFrameHost::CopyFromCompositingSurfaceHasResult( if (result->HasTexture()) { // GPU-accelerated path - PrepareTextureCopyOutputResult(output_size_in_pixel, color_type, - callback, - result.Pass()); + PrepareTextureCopyOutputResult(output_size_in_pixel, color_type, callback, + std::move(result)); return; } DCHECK(result->HasBitmap()); // Software path PrepareBitmapCopyOutputResult(output_size_in_pixel, color_type, callback, - result.Pass()); + std::move(result)); } static void CopyFromCompositingSurfaceFinished( @@ -1049,9 +1048,10 @@ void DelegatedFrameHost::LockResources() { void DelegatedFrameHost::RequestCopyOfOutput( scoped_ptr<cc::CopyOutputRequest> request) { if (!request_copy_of_output_callback_for_testing_.is_null()) - request_copy_of_output_callback_for_testing_.Run(request.Pass()); + request_copy_of_output_callback_for_testing_.Run(std::move(request)); else - client_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput(request.Pass()); + client_->DelegatedFrameHostGetLayer()->RequestCopyOfOutput( + std::move(request)); } void DelegatedFrameHost::UnlockResources() { diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc index 2cc9306..3dde15a 100644 --- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc +++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc @@ -4,6 +4,8 @@ #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" +#include <utility> + #include "build/build_config.h" #include "cc/output/compositor_frame.h" #include "cc/output/output_surface_client.h" @@ -25,7 +27,7 @@ GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface( : BrowserCompositorOutputSurface(context, worker_context, vsync_manager, - overlay_candidate_validator.Pass()), + std::move(overlay_candidate_validator)), #if defined(OS_MACOSX) should_show_frames_state_(SHOULD_SHOW_FRAMES), #endif diff --git a/content/browser/compositor/gpu_process_transport_factory.cc b/content/browser/compositor/gpu_process_transport_factory.cc index aa13944..983be0c 100644 --- a/content/browser/compositor/gpu_process_transport_factory.cc +++ b/content/browser/compositor/gpu_process_transport_factory.cc @@ -5,6 +5,7 @@ #include "content/browser/compositor/gpu_process_transport_factory.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -186,7 +187,7 @@ CreateOverlayCandidateValidator(gfx::AcceleratedWidget widget) { validator.reset(new BrowserCompositorOverlayCandidateValidatorAndroid()); #endif - return validator.Pass(); + return validator; } static bool ShouldCreateGpuOutputSurface(ui::Compositor* compositor) { @@ -351,7 +352,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( #endif surface = make_scoped_ptr(new GpuBrowserCompositorOutputSurface( context_provider, shared_worker_context_provider_, - compositor->vsync_manager(), validator.Pass())); + compositor->vsync_manager(), std::move(validator))); } } @@ -363,7 +364,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( data->reflector->OnSourceSurfaceReady(data->surface); if (!UseSurfacesEnabled()) { - compositor->SetOutputSurface(surface.Pass()); + compositor->SetOutputSurface(std::move(surface)); return; } @@ -374,7 +375,7 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( cc::SurfaceManager* manager = surface_manager_.get(); scoped_ptr<cc::OnscreenDisplayClient> display_client( new cc::OnscreenDisplayClient( - surface.Pass(), manager, HostSharedBitmapManager::current(), + std::move(surface), manager, HostSharedBitmapManager::current(), BrowserGpuMemoryBufferManager::current(), compositor->GetRendererSettings(), compositor->task_runner())); @@ -385,8 +386,8 @@ void GpuProcessTransportFactory::EstablishedGpuChannel( display_client->set_surface_output_surface(output_surface.get()); output_surface->set_display_client(display_client.get()); display_client->display()->Resize(compositor->size()); - data->display_client = display_client.Pass(); - compositor->SetOutputSurface(output_surface.Pass()); + data->display_client = std::move(display_client); + compositor->SetOutputSurface(std::move(output_surface)); } scoped_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( @@ -400,7 +401,7 @@ scoped_ptr<ui::Reflector> GpuProcessTransportFactory::CreateReflector( source_data->reflector = reflector.get(); if (BrowserCompositorOutputSurface* source_surface = source_data->surface) reflector->OnSourceSurfaceReady(source_surface); - return reflector.Pass(); + return std::move(reflector); } void GpuProcessTransportFactory::RemoveReflector(ui::Reflector* reflector) { @@ -432,7 +433,7 @@ void GpuProcessTransportFactory::RemoveCompositor(ui::Compositor* compositor) { // GLHelper created in this case would be lost/leaked if we just reset() // on the |gl_helper_| variable directly. So instead we call reset() on a // local scoped_ptr. - scoped_ptr<GLHelper> helper = gl_helper_.Pass(); + scoped_ptr<GLHelper> helper = std::move(gl_helper_); // If there are any observer left at this point, make sure they clean up // before we destroy the GLHelper. @@ -632,7 +633,7 @@ GpuProcessTransportFactory::CreateContextCommon( lose_context_when_out_of_memory, WebGraphicsContext3DCommandBufferImpl::SharedMemoryLimits(), NULL)); - return context.Pass(); + return context; } void GpuProcessTransportFactory::OnLostMainThreadSharedContextInsideCallback() { @@ -653,7 +654,7 @@ void GpuProcessTransportFactory::OnLostMainThreadSharedContext() { shared_main_thread_contexts_; shared_main_thread_contexts_ = NULL; - scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass(); + scoped_ptr<GLHelper> lost_gl_helper = std::move(gl_helper_); FOR_EACH_OBSERVER(ImageTransportFactoryObserver, observer_list_, diff --git a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc index 4edea3c..0913548 100644 --- a/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc +++ b/content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.cc @@ -4,6 +4,8 @@ #include "content/browser/compositor/gpu_surfaceless_browser_compositor_output_surface.h" +#include <utility> + #include "cc/output/compositor_frame.h" #include "cc/output/output_surface_client.h" #include "content/browser/compositor/browser_compositor_overlay_candidate_validator.h" @@ -31,7 +33,7 @@ GpuSurfacelessBrowserCompositorOutputSurface:: : GpuBrowserCompositorOutputSurface(context, worker_context, vsync_manager, - overlay_candidate_validator.Pass()), + std::move(overlay_candidate_validator)), internalformat_(internalformat), gpu_memory_buffer_manager_(gpu_memory_buffer_manager) { capabilities_.uses_default_gl_framebuffer = false; diff --git a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc index e2d6662..eaadce5 100644 --- a/content/browser/compositor/offscreen_browser_compositor_output_surface.cc +++ b/content/browser/compositor/offscreen_browser_compositor_output_surface.cc @@ -4,6 +4,8 @@ #include "content/browser/compositor/offscreen_browser_compositor_output_surface.h" +#include <utility> + #include "base/logging.h" #include "build/build_config.h" #include "cc/output/compositor_frame.h" @@ -38,7 +40,7 @@ OffscreenBrowserCompositorOutputSurface:: : BrowserCompositorOutputSurface(context, worker_context, vsync_manager, - overlay_candidate_validator.Pass()), + std::move(overlay_candidate_validator)), fbo_(0), is_backbuffer_discarded_(false), weak_ptr_factory_(this) { diff --git a/content/browser/compositor/reflector_impl_unittest.cc b/content/browser/compositor/reflector_impl_unittest.cc index 13103b4..cebaf51 100644 --- a/content/browser/compositor/reflector_impl_unittest.cc +++ b/content/browser/compositor/reflector_impl_unittest.cc @@ -77,7 +77,7 @@ class TestOutputSurface : public BrowserCompositorOutputSurface { : BrowserCompositorOutputSurface(context_provider, nullptr, vsync_manager, - CreateTestValidatorOzone().Pass()) { + CreateTestValidatorOzone()) { surface_size_ = gfx::Size(256, 256); device_scale_factor_ = 1.f; } @@ -131,12 +131,10 @@ class ReflectorImplTest : public testing::Test { compositor_.reset( new ui::Compositor(context_factory, compositor_task_runner_.get())); compositor_->SetAcceleratedWidget(gfx::kNullAcceleratedWidget); - context_provider_ = cc::TestContextProvider::Create( - cc::TestWebGraphicsContext3D::Create().Pass()); - output_surface_ = - scoped_ptr<TestOutputSurface>( - new TestOutputSurface(context_provider_, - compositor_->vsync_manager())).Pass(); + context_provider_ = + cc::TestContextProvider::Create(cc::TestWebGraphicsContext3D::Create()); + output_surface_ = scoped_ptr<TestOutputSurface>( + new TestOutputSurface(context_provider_, compositor_->vsync_manager())); CHECK(output_surface_->BindToClient(&output_surface_client_)); root_layer_.reset(new ui::Layer(ui::LAYER_SOLID_COLOR)); diff --git a/content/browser/compositor/software_browser_compositor_output_surface.cc b/content/browser/compositor/software_browser_compositor_output_surface.cc index 11dee4b..151ed5f 100644 --- a/content/browser/compositor/software_browser_compositor_output_surface.cc +++ b/content/browser/compositor/software_browser_compositor_output_surface.cc @@ -4,6 +4,8 @@ #include "content/browser/compositor/software_browser_compositor_output_surface.h" +#include <utility> + #include "base/location.h" #include "base/memory/ref_counted.h" #include "base/single_thread_task_runner.h" @@ -22,10 +24,8 @@ namespace content { SoftwareBrowserCompositorOutputSurface::SoftwareBrowserCompositorOutputSurface( scoped_ptr<cc::SoftwareOutputDevice> software_device, const scoped_refptr<ui::CompositorVSyncManager>& vsync_manager) - : BrowserCompositorOutputSurface(software_device.Pass(), - vsync_manager), - weak_factory_(this) { -} + : BrowserCompositorOutputSurface(std::move(software_device), vsync_manager), + weak_factory_(this) {} SoftwareBrowserCompositorOutputSurface:: ~SoftwareBrowserCompositorOutputSurface() { diff --git a/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc b/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc index d8422db..51a2c77 100644 --- a/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc +++ b/content/browser/compositor/software_browser_compositor_output_surface_unittest.cc @@ -2,11 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/compositor/software_browser_compositor_output_surface.h" + +#include <utility> + #include "base/macros.h" #include "base/thread_task_runner_handle.h" #include "cc/output/compositor_frame.h" #include "cc/test/fake_output_surface_client.h" -#include "content/browser/compositor/software_browser_compositor_output_surface.h" #include "testing/gtest/include/gtest/gtest.h" #include "ui/compositor/compositor.h" #include "ui/compositor/test/context_factories_for_test.h" @@ -106,15 +109,14 @@ SoftwareBrowserCompositorOutputSurfaceTest::CreateSurface( scoped_ptr<cc::SoftwareOutputDevice> device) { return scoped_ptr<content::BrowserCompositorOutputSurface>( new content::SoftwareBrowserCompositorOutputSurface( - device.Pass(), - compositor_->vsync_manager())); + std::move(device), compositor_->vsync_manager())); } TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, NoVSyncProvider) { cc::FakeOutputSurfaceClient output_surface_client; scoped_ptr<cc::SoftwareOutputDevice> software_device( new cc::SoftwareOutputDevice()); - output_surface_ = CreateSurface(software_device.Pass()); + output_surface_ = CreateSurface(std::move(software_device)); CHECK(output_surface_->BindToClient(&output_surface_client)); cc::CompositorFrame frame; @@ -128,7 +130,7 @@ TEST_F(SoftwareBrowserCompositorOutputSurfaceTest, VSyncProviderUpdates) { cc::FakeOutputSurfaceClient output_surface_client; scoped_ptr<cc::SoftwareOutputDevice> software_device( new FakeSoftwareOutputDevice()); - output_surface_ = CreateSurface(software_device.Pass()); + output_surface_ = CreateSurface(std::move(software_device)); CHECK(output_surface_->BindToClient(&output_surface_client)); FakeVSyncProvider* vsync_provider = static_cast<FakeVSyncProvider*>( diff --git a/content/browser/compositor/software_output_device_mus.cc b/content/browser/compositor/software_output_device_mus.cc index 080be43..ca5fb95 100644 --- a/content/browser/compositor/software_output_device_mus.cc +++ b/content/browser/compositor/software_output_device_mus.cc @@ -5,6 +5,7 @@ #include "content/browser/compositor/software_output_device_mus.h" #include <stddef.h> +#include <utility> #include "components/bitmap_uploader/bitmap_uploader.h" #include "third_party/skia/include/core/SkImageInfo.h" @@ -58,7 +59,7 @@ void SoftwareOutputDeviceMus::EndPaint() { scoped_ptr<std::vector<unsigned char>> data(new std::vector<unsigned char>( pixels, pixels + rowBytes * viewport_pixel_size_.height())); uploader->SetBitmap(viewport_pixel_size_.width(), - viewport_pixel_size_.height(), data.Pass(), + viewport_pixel_size_.height(), std::move(data), bitmap_uploader::BitmapUploader::BGRA); } diff --git a/content/browser/compositor/test/no_transport_image_transport_factory.cc b/content/browser/compositor/test/no_transport_image_transport_factory.cc index e9fb0ff..a3db861 100644 --- a/content/browser/compositor/test/no_transport_image_transport_factory.cc +++ b/content/browser/compositor/test/no_transport_image_transport_factory.cc @@ -4,6 +4,8 @@ #include "content/browser/compositor/test/no_transport_image_transport_factory.h" +#include <utility> + #include "build/build_config.h" #include "cc/output/context_provider.h" #include "cc/surfaces/surface_manager.h" @@ -24,7 +26,7 @@ NoTransportImageTransportFactory::NoTransportImageTransportFactory() } NoTransportImageTransportFactory::~NoTransportImageTransportFactory() { - scoped_ptr<GLHelper> lost_gl_helper = gl_helper_.Pass(); + scoped_ptr<GLHelper> lost_gl_helper = std::move(gl_helper_); FOR_EACH_OBSERVER( ImageTransportFactoryObserver, observer_list_, OnLostResources()); } diff --git a/content/browser/devtools/devtools_protocol_handler.cc b/content/browser/devtools/devtools_protocol_handler.cc index 9f69cfb..e92ef84 100644 --- a/content/browser/devtools/devtools_protocol_handler.cc +++ b/content/browser/devtools/devtools_protocol_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/devtools/devtools_protocol_handler.h" +#include <utility> + #include "base/bind.h" #include "base/json/json_reader.h" #include "base/json/json_writer.h" @@ -50,7 +52,7 @@ void DevToolsProtocolHandler::HandleMessage(int session_id, return; if (PassCommandToDelegate(session_id, command.get())) return; - HandleCommand(session_id, command.Pass()); + HandleCommand(session_id, std::move(command)); } bool DevToolsProtocolHandler::HandleOptionalMessage(int session_id, @@ -61,7 +63,7 @@ bool DevToolsProtocolHandler::HandleOptionalMessage(int session_id, return true; if (PassCommandToDelegate(session_id, command.get())) return true; - return HandleOptionalCommand(session_id, command.Pass(), call_id); + return HandleOptionalCommand(session_id, std::move(command), call_id); } bool DevToolsProtocolHandler::PassCommandToDelegate( diff --git a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc index 218579c..bc95070 100644 --- a/content/browser/devtools/protocol/devtools_protocol_browsertest.cc +++ b/content/browser/devtools/protocol/devtools_protocol_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stddef.h> +#include <utility> #include "base/base64.h" #include "base/command_line.h" @@ -47,7 +48,7 @@ class DevToolsProtocolTest : public ContentBrowserTest, protected: void SendCommand(const std::string& method, scoped_ptr<base::DictionaryValue> params) { - SendCommand(method, params.Pass(), true); + SendCommand(method, std::move(params), true); } void SendCommand(const std::string& method, @@ -167,7 +168,7 @@ class SyntheticKeyEventTest : public DevToolsProtocolTest { params->SetInteger("modifiers", modifier); params->SetInteger("windowsVirtualKeyCode", windowsKeyCode); params->SetInteger("nativeVirtualKeyCode", nativeKeyCode); - SendCommand("Input.dispatchKeyEvent", params.Pass()); + SendCommand("Input.dispatchKeyEvent", std::move(params)); } }; @@ -343,7 +344,7 @@ IN_PROC_BROWSER_TEST_F(DevToolsProtocolTest, NavigationPreservesMessages) { scoped_ptr<base::DictionaryValue> params(new base::DictionaryValue()); test_url = GetTestUrl("devtools", "navigation.html"); params->SetString("url", test_url.spec()); - SendCommand("Page.navigate", params.Pass(), true); + SendCommand("Page.navigate", std::move(params), true); bool enough_results = result_ids_.size() >= 2u; EXPECT_TRUE(enough_results); diff --git a/content/browser/devtools/protocol/emulation_handler.cc b/content/browser/devtools/protocol/emulation_handler.cc index 915c3ae..f5945d7 100644 --- a/content/browser/devtools/protocol/emulation_handler.cc +++ b/content/browser/devtools/protocol/emulation_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/devtools/protocol/emulation_handler.h" +#include <utility> + #include "base/strings/string_number_conversions.h" #include "build/build_config.h" #include "content/browser/frame_host/render_frame_host_impl.h" @@ -82,7 +84,7 @@ Response EmulationHandler::SetGeolocationOverride( } else { geoposition->error_code = Geoposition::ERROR_CODE_POSITION_UNAVAILABLE; } - geolocation_context->SetOverride(geoposition.Pass()); + geolocation_context->SetOverride(std::move(geoposition)); return Response::OK(); } diff --git a/content/browser/devtools/protocol/system_info_handler.cc b/content/browser/devtools/protocol/system_info_handler.cc index 7e070f0..27877b0 100644 --- a/content/browser/devtools/protocol/system_info_handler.cc +++ b/content/browser/devtools/protocol/system_info_handler.cc @@ -5,6 +5,7 @@ #include "content/browser/devtools/protocol/system_info_handler.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "content/browser/gpu/compositor_util.h" @@ -195,11 +196,12 @@ void SystemInfoHandler::SendGetInfoResponse(DevToolsCommandId command_id) { AuxGPUInfoEnumerator enumerator(aux_attributes.get()); gpu_info.EnumerateFields(&enumerator); - scoped_refptr<GPUInfo> gpu = GPUInfo::Create() - ->set_devices(devices) - ->set_aux_attributes(aux_attributes.Pass()) - ->set_feature_status(make_scoped_ptr(GetFeatureStatus())) - ->set_driver_bug_workarounds(GetDriverBugWorkarounds()); + scoped_refptr<GPUInfo> gpu = + GPUInfo::Create() + ->set_devices(devices) + ->set_aux_attributes(std::move(aux_attributes)) + ->set_feature_status(make_scoped_ptr(GetFeatureStatus())) + ->set_driver_bug_workarounds(GetDriverBugWorkarounds()); client_->SendGetInfoResponse( command_id, diff --git a/content/browser/devtools/render_frame_devtools_agent_host.cc b/content/browser/devtools/render_frame_devtools_agent_host.cc index eb27196..b30463c 100644 --- a/content/browser/devtools/render_frame_devtools_agent_host.cc +++ b/content/browser/devtools/render_frame_devtools_agent_host.cc @@ -4,6 +4,8 @@ #include "content/browser/devtools/render_frame_devtools_agent_host.h" +#include <utility> + #include "base/lazy_instance.h" #include "base/strings/utf_string_conversions.h" #include "build/build_config.h" @@ -403,7 +405,7 @@ void RenderFrameDevToolsAgentHost::CommitPending() { return; } - current_ = pending_.Pass(); + current_ = std::move(pending_); UpdateProtocolHandlers(current_->host()); current_->Resume(); } @@ -758,7 +760,7 @@ void RenderFrameDevToolsAgentHost::DisconnectWebContents() { if (pending_) DiscardPending(); UpdateProtocolHandlers(nullptr); - disconnected_ = current_.Pass(); + disconnected_ = std::move(current_); disconnected_->Detach(); frame_tree_node_ = nullptr; in_navigation_protocol_message_buffer_.clear(); @@ -774,7 +776,7 @@ void RenderFrameDevToolsAgentHost::ConnectWebContents(WebContents* wc) { static_cast<RenderFrameHostImpl*>(wc->GetMainFrame()); DCHECK(host); frame_tree_node_ = host->frame_tree_node(); - current_ = disconnected_.Pass(); + current_ = std::move(disconnected_); SetPending(host); CommitPending(); WebContentsObserver::Observe(WebContents::FromRenderFrameHost(host)); diff --git a/content/browser/download/base_file.cc b/content/browser/download/base_file.cc index b90ba74..7bd2b0b 100644 --- a/content/browser/download/base_file.cc +++ b/content/browser/download/base_file.cc @@ -4,6 +4,8 @@ #include "content/browser/download/base_file.h" +#include <utility> + #include "base/bind.h" #include "base/files/file.h" #include "base/files/file_util.h" @@ -37,7 +39,7 @@ BaseFile::BaseFile(const base::FilePath& full_path, : full_path_(full_path), source_url_(source_url), referrer_url_(referrer_url), - file_(file.Pass()), + file_(std::move(file)), bytes_so_far_(received_bytes), start_tick_(base::TimeTicks::Now()), calculate_hash_(calculate_hash), diff --git a/content/browser/download/base_file_unittest.cc b/content/browser/download/base_file_unittest.cc index 84f0d9e..a6ce347 100644 --- a/content/browser/download/base_file_unittest.cc +++ b/content/browser/download/base_file_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file.h" #include "base/files/file_util.h" @@ -543,14 +544,8 @@ TEST_F(BaseFileTest, WriteWithError) { // Pass a file handle which was opened without the WRITE flag. // This should result in an error when writing. base::File file(path, base::File::FLAG_OPEN_ALWAYS | base::File::FLAG_READ); - base_file_.reset(new BaseFile(path, - GURL(), - GURL(), - 0, - false, - std::string(), - file.Pass(), - net::BoundNetLog())); + base_file_.reset(new BaseFile(path, GURL(), GURL(), 0, false, std::string(), + std::move(file), net::BoundNetLog())); ASSERT_TRUE(InitializeFile()); #if defined(OS_WIN) set_expected_error(DOWNLOAD_INTERRUPT_REASON_FILE_ACCESS_DENIED); diff --git a/content/browser/download/download_browsertest.cc b/content/browser/download/download_browsertest.cc index 1a22451..794e832 100644 --- a/content/browser/download/download_browsertest.cc +++ b/content/browser/download/download_browsertest.cc @@ -7,7 +7,7 @@ #include <stddef.h> #include <stdint.h> - +#include <utility> #include <vector> #include "base/callback_helpers.h" @@ -199,9 +199,14 @@ DownloadFileWithDelay::DownloadFileWithDelay( scoped_ptr<PowerSaveBlocker> power_save_blocker, base::WeakPtr<DownloadDestinationObserver> observer, base::WeakPtr<DownloadFileWithDelayFactory> owner) - : DownloadFileImpl( - save_info.Pass(), default_download_directory, url, referrer_url, - calculate_hash, stream.Pass(), bound_net_log, observer), + : DownloadFileImpl(std::move(save_info), + default_download_directory, + url, + referrer_url, + calculate_hash, + std::move(stream), + bound_net_log, + observer), owner_(owner) {} DownloadFileWithDelay::~DownloadFileWithDelay() {} @@ -254,9 +259,9 @@ DownloadFile* DownloadFileWithDelayFactory::CreateFile( PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, PowerSaveBlocker::kReasonOther, "Download in progress")); return new DownloadFileWithDelay( - save_info.Pass(), default_download_directory, url, referrer_url, - calculate_hash, stream.Pass(), bound_net_log, - psb.Pass(), observer, weak_ptr_factory_.GetWeakPtr()); + std::move(save_info), default_download_directory, url, referrer_url, + calculate_hash, std::move(stream), bound_net_log, std::move(psb), + observer, weak_ptr_factory_.GetWeakPtr()); } void DownloadFileWithDelayFactory::AddRenameCallback(base::Closure callback) { @@ -284,19 +289,23 @@ void DownloadFileWithDelayFactory::WaitForSomeCallback() { class CountingDownloadFile : public DownloadFileImpl { public: - CountingDownloadFile( - scoped_ptr<DownloadSaveInfo> save_info, - const base::FilePath& default_downloads_directory, - const GURL& url, - const GURL& referrer_url, - bool calculate_hash, - scoped_ptr<ByteStreamReader> stream, - const net::BoundNetLog& bound_net_log, - scoped_ptr<PowerSaveBlocker> power_save_blocker, - base::WeakPtr<DownloadDestinationObserver> observer) - : DownloadFileImpl(save_info.Pass(), default_downloads_directory, - url, referrer_url, calculate_hash, - stream.Pass(), bound_net_log, observer) {} + CountingDownloadFile(scoped_ptr<DownloadSaveInfo> save_info, + const base::FilePath& default_downloads_directory, + const GURL& url, + const GURL& referrer_url, + bool calculate_hash, + scoped_ptr<ByteStreamReader> stream, + const net::BoundNetLog& bound_net_log, + scoped_ptr<PowerSaveBlocker> power_save_blocker, + base::WeakPtr<DownloadDestinationObserver> observer) + : DownloadFileImpl(std::move(save_info), + default_downloads_directory, + url, + referrer_url, + calculate_hash, + std::move(stream), + bound_net_log, + observer) {} ~CountingDownloadFile() override { DCHECK_CURRENTLY_ON(BrowserThread::FILE); @@ -352,9 +361,9 @@ class CountingDownloadFileFactory : public DownloadFileFactory { PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, PowerSaveBlocker::kReasonOther, "Download in progress")); return new CountingDownloadFile( - save_info.Pass(), default_downloads_directory, url, referrer_url, - calculate_hash, stream.Pass(), bound_net_log, - psb.Pass(), observer); + std::move(save_info), default_downloads_directory, url, referrer_url, + calculate_hash, std::move(stream), bound_net_log, std::move(psb), + observer); } }; @@ -447,7 +456,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendRedirectResponse( response->set_code(net::HTTP_FOUND); response->AddCustomHeader("Location", target_url.spec()); } - return response.Pass(); + return std::move(response); } // Creates a request handler for EmbeddedTestServer that responds with a HTTP @@ -474,7 +483,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRequestAndSendBasicResponse( response->set_content_type(content_type); response->set_content(body); } - return response.Pass(); + return std::move(response); } // Creates a request handler for an EmbeddedTestServer that response with an @@ -594,8 +603,7 @@ class DownloadContentTest : public ContentBrowserTest { // Note: Cannot be used with other alternative DownloadFileFactorys void SetupEnsureNoPendingDownloads() { DownloadManagerForShell(shell())->SetDownloadFileFactoryForTesting( - scoped_ptr<DownloadFileFactory>( - new CountingDownloadFileFactory()).Pass()); + scoped_ptr<DownloadFileFactory>(new CountingDownloadFileFactory())); } bool EnsureNoPendingDownloads() { @@ -855,7 +863,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtFinalRename) { new DownloadFileWithDelayFactory(); DownloadManagerImpl* download_manager(DownloadManagerForShell(shell())); download_manager->SetDownloadFileFactoryForTesting( - scoped_ptr<DownloadFileFactory>(file_factory).Pass()); + scoped_ptr<DownloadFileFactory>(file_factory)); // Create a download NavigateToURL(shell(), @@ -904,7 +912,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CancelAtRelease) { DownloadFileWithDelayFactory* file_factory = new DownloadFileWithDelayFactory(); download_manager->SetDownloadFileFactoryForTesting( - scoped_ptr<DownloadFileFactory>(file_factory).Pass()); + scoped_ptr<DownloadFileFactory>(file_factory)); // Create a download NavigateToURL(shell(), @@ -1015,7 +1023,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, ShutdownAtRelease) { DownloadFileWithDelayFactory* file_factory = new DownloadFileWithDelayFactory(); download_manager->SetDownloadFileFactoryForTesting( - scoped_ptr<DownloadFileFactory>(file_factory).Pass()); + scoped_ptr<DownloadFileFactory>(file_factory)); // Create a download NavigateToURL(shell(), @@ -1662,7 +1670,7 @@ IN_PROC_BROWSER_TEST_F(DownloadContentTest, CookiePolicy) { DownloadUrlParameters::FromWebContents(shell()->web_contents(), origin_two.GetURL("/bar"))); scoped_ptr<DownloadTestObserver> observer(CreateWaiter(shell(), 1)); - DownloadManagerForShell(shell())->DownloadUrl(download_parameters.Pass()); + DownloadManagerForShell(shell())->DownloadUrl(std::move(download_parameters)); observer->WaitForFinished(); // Get the important info from other threads and check it. diff --git a/content/browser/download/download_create_info.cc b/content/browser/download/download_create_info.cc index f263d75..c09d713 100644 --- a/content/browser/download/download_create_info.cc +++ b/content/browser/download/download_create_info.cc @@ -5,6 +5,7 @@ #include "content/browser/download/download_create_info.h" #include <string> +#include <utility> #include "base/format_macros.h" #include "base/strings/stringprintf.h" @@ -20,7 +21,7 @@ DownloadCreateInfo::DownloadCreateInfo(const base::Time& start_time, download_id(DownloadItem::kInvalidId), has_user_gesture(false), transition_type(ui::PAGE_TRANSITION_LINK), - save_info(save_info.Pass()), + save_info(std::move(save_info)), request_bound_net_log(bound_net_log) {} DownloadCreateInfo::DownloadCreateInfo() diff --git a/content/browser/download/download_file_factory.cc b/content/browser/download/download_file_factory.cc index 817bee1..bae88be 100644 --- a/content/browser/download/download_file_factory.cc +++ b/content/browser/download/download_file_factory.cc @@ -4,6 +4,8 @@ #include "content/browser/download/download_file_factory.h" +#include <utility> + #include "content/browser/download/download_file_impl.h" namespace content { @@ -19,9 +21,9 @@ DownloadFile* DownloadFileFactory::CreateFile( scoped_ptr<ByteStreamReader> stream, const net::BoundNetLog& bound_net_log, base::WeakPtr<DownloadDestinationObserver> observer) { - return new DownloadFileImpl( - save_info.Pass(), default_downloads_directory, url, referrer_url, - calculate_hash, stream.Pass(), bound_net_log, observer); + return new DownloadFileImpl(std::move(save_info), default_downloads_directory, + url, referrer_url, calculate_hash, + std::move(stream), bound_net_log, observer); } } // namespace content diff --git a/content/browser/download/download_file_impl.cc b/content/browser/download/download_file_impl.cc index bf60a9d..0a1f398 100644 --- a/content/browser/download/download_file_impl.cc +++ b/content/browser/download/download_file_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/download/download_file_impl.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -48,15 +49,14 @@ DownloadFileImpl::DownloadFileImpl( save_info->offset, calculate_hash, save_info->hash_state, - save_info->file.Pass(), + std::move(save_info->file), bound_net_log), default_download_directory_(default_download_directory), - stream_reader_(stream.Pass()), + stream_reader_(std::move(stream)), bytes_seen_(0), bound_net_log_(bound_net_log), observer_(observer), - weak_factory_(this) { -} + weak_factory_(this) {} DownloadFileImpl::~DownloadFileImpl() { DCHECK_CURRENTLY_ON(BrowserThread::FILE); diff --git a/content/browser/download/download_file_unittest.cc b/content/browser/download/download_file_unittest.cc index 9bf2dd2..9630a49 100644 --- a/content/browser/download/download_file_unittest.cc +++ b/content/browser/download/download_file_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file.h" #include "base/files/file_util.h" @@ -82,12 +83,12 @@ class TestDownloadFileImpl : public DownloadFileImpl { scoped_ptr<ByteStreamReader> stream, const net::BoundNetLog& bound_net_log, base::WeakPtr<DownloadDestinationObserver> observer) - : DownloadFileImpl(save_info.Pass(), + : DownloadFileImpl(std::move(save_info), default_downloads_directory, url, referrer_url, calculate_hash, - stream.Pass(), + std::move(stream), bound_net_log, observer) {} @@ -176,16 +177,14 @@ class DownloadFileTest : public testing::Test { scoped_ptr<DownloadSaveInfo> save_info(new DownloadSaveInfo()); scoped_ptr<TestDownloadFileImpl> download_file_impl( - new TestDownloadFileImpl(save_info.Pass(), - base::FilePath(), - GURL(), // Source - GURL(), // Referrer - calculate_hash, - scoped_ptr<ByteStreamReader>(input_stream_), - net::BoundNetLog(), - observer_factory_.GetWeakPtr())); + new TestDownloadFileImpl( + std::move(save_info), base::FilePath(), + GURL(), // Source + GURL(), // Referrer + calculate_hash, scoped_ptr<ByteStreamReader>(input_stream_), + net::BoundNetLog(), observer_factory_.GetWeakPtr())); download_file_impl->SetClientGuid("12345678-ABCD-1234-DCBA-123456789ABC"); - download_file_ = download_file_impl.Pass(); + download_file_ = std::move(download_file_impl); EXPECT_CALL(*input_stream_, Read(_, _)) .WillOnce(Return(ByteStreamReader::STREAM_EMPTY)) diff --git a/content/browser/download/download_item_impl.cc b/content/browser/download/download_item_impl.cc index 26803f7..cef5773 100644 --- a/content/browser/download/download_item_impl.cc +++ b/content/browser/download/download_item_impl.cc @@ -23,6 +23,7 @@ #include "content/browser/download/download_item_impl.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -231,7 +232,7 @@ DownloadItemImpl::DownloadItemImpl( scoped_ptr<DownloadRequestHandleInterface> request_handle, const net::BoundNetLog& bound_net_log) : is_save_package_download_(true), - request_handle_(request_handle.Pass()), + request_handle_(std::move(request_handle)), download_id_(download_id), current_path_(path), target_path_(path), @@ -1116,8 +1117,8 @@ void DownloadItemImpl::Start( DCHECK(file.get()); DCHECK(req_handle.get()); - download_file_ = file.Pass(); - request_handle_ = req_handle.Pass(); + download_file_ = std::move(file); + request_handle_ = std::move(req_handle); if (GetState() == CANCELLED) { // The download was in the process of resuming when it was cancelled. Don't @@ -1703,7 +1704,7 @@ void DownloadItemImpl::ResumeInterruptedDownload() { base::Bind(&DownloadItemImpl::OnResumeRequestStarted, weak_ptr_factory_.GetWeakPtr())); - delegate_->ResumeInterruptedDownload(download_params.Pass(), GetId()); + delegate_->ResumeInterruptedDownload(std::move(download_params), GetId()); // Just in case we were interrupted while paused. is_paused_ = false; diff --git a/content/browser/download/download_item_impl_unittest.cc b/content/browser/download/download_item_impl_unittest.cc index 742024c..0afad1b 100644 --- a/content/browser/download/download_item_impl_unittest.cc +++ b/content/browser/download/download_item_impl_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/download/download_item_impl.h" + #include <stdint.h> +#include <utility> #include "base/callback.h" #include "base/feature_list.h" @@ -12,7 +15,6 @@ #include "content/browser/byte_stream.h" #include "content/browser/download/download_create_info.h" #include "content/browser/download/download_file_factory.h" -#include "content/browser/download/download_item_impl.h" #include "content/browser/download/download_item_impl_delegate.h" #include "content/browser/download/download_request_handle.h" #include "content/browser/download/mock_download_file.h" @@ -218,7 +220,7 @@ class DownloadItemTest : public testing::Test { info->url_chain.push_back(GURL()); info->etag = "SomethingToSatisfyResumption"; - return CreateDownloadItemWithCreateInfo(info.Pass()); + return CreateDownloadItemWithCreateInfo(std::move(info)); } DownloadItemImpl* CreateDownloadItemWithCreateInfo( @@ -247,7 +249,7 @@ class DownloadItemTest : public testing::Test { scoped_ptr<DownloadRequestHandleInterface> request_handle( new NiceMock<MockRequestHandle>); - item->Start(download_file.Pass(), request_handle.Pass()); + item->Start(std::move(download_file), std::move(request_handle)); loop_.RunUntilIdle(); // So that we don't have a function writing to a stack variable @@ -517,7 +519,7 @@ TEST_F(DownloadItemTest, LimitRestartsAfterInterrupted) { // Copied key parts of DoIntermediateRename & AddDownloadFileToDownloadItem // to allow for holding onto the request handle. - item->Start(download_file.Pass(), request_handle.Pass()); + item->Start(std::move(download_file), std::move(request_handle)); RunAllPendingInMessageLoops(); if (i == 0) { // Target determination is only done the first time through. @@ -554,7 +556,8 @@ TEST_F(DownloadItemTest, ResumeUsingFinalURL) { create_info->url_chain.push_back(GURL("http://example.com/b")); create_info->url_chain.push_back(GURL("http://example.com/c")); - DownloadItemImpl* item = CreateDownloadItemWithCreateInfo(create_info.Pass()); + DownloadItemImpl* item = + CreateDownloadItemWithCreateInfo(std::move(create_info)); TestDownloadItemObserver observer(item); MockDownloadFile* download_file = DoIntermediateRename(item, DOWNLOAD_DANGER_TYPE_NOT_DANGEROUS); @@ -672,7 +675,7 @@ TEST_F(DownloadItemTest, NotificationAfterTogglePause) { EXPECT_CALL(*mock_download_file, Initialize(_)); EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(_, _)); - item->Start(download_file.Pass(), request_handle.Pass()); + item->Start(std::move(download_file), std::move(request_handle)); item->Pause(); ASSERT_TRUE(observer.CheckAndResetDownloadUpdated()); @@ -719,7 +722,7 @@ TEST_F(DownloadItemTest, Start) { scoped_ptr<DownloadRequestHandleInterface> request_handle( new NiceMock<MockRequestHandle>); EXPECT_CALL(*mock_delegate(), DetermineDownloadTarget(item, _)); - item->Start(download_file.Pass(), request_handle.Pass()); + item->Start(std::move(download_file), std::move(request_handle)); RunAllPendingInMessageLoops(); CleanupItem(item, mock_download_file, DownloadItem::IN_PROGRESS); diff --git a/content/browser/download/download_manager_impl.cc b/content/browser/download/download_manager_impl.cc index 9099a3f..fed1fca 100644 --- a/content/browser/download/download_manager_impl.cc +++ b/content/browser/download/download_manager_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/download/download_manager_impl.h" #include <iterator> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -66,7 +67,7 @@ scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> BeginDownload( scoped_ptr<net::UploadElementReader> reader( net::UploadOwnedBytesElementReader::CreateWithString(body)); request->set_upload( - net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); } if (params->post_id() >= 0) { // The POST in this case does not have an actual body, and only works @@ -204,9 +205,8 @@ class DownloadItemFactoryImpl : public DownloadItemFactory { const std::string& mime_type, scoped_ptr<DownloadRequestHandleInterface> request_handle, const net::BoundNetLog& bound_net_log) override { - return new DownloadItemImpl(delegate, download_id, path, url, - mime_type, request_handle.Pass(), - bound_net_log); + return new DownloadItemImpl(delegate, download_id, path, url, mime_type, + std::move(request_handle), bound_net_log); } }; @@ -463,12 +463,8 @@ void DownloadManagerImpl::CreateSavePackageDownloadItem( DCHECK_CURRENTLY_ON(BrowserThread::UI); GetNextId(base::Bind( &DownloadManagerImpl::CreateSavePackageDownloadItemWithId, - weak_factory_.GetWeakPtr(), - main_file_path, - page_url, - mime_type, - base::Passed(request_handle.Pass()), - item_created)); + weak_factory_.GetWeakPtr(), main_file_path, page_url, mime_type, + base::Passed(std::move(request_handle)), item_created)); } void DownloadManagerImpl::CreateSavePackageDownloadItemWithId( @@ -484,12 +480,7 @@ void DownloadManagerImpl::CreateSavePackageDownloadItemWithId( net::BoundNetLog bound_net_log = net::BoundNetLog::Make(net_log_, net::NetLog::SOURCE_DOWNLOAD); DownloadItemImpl* download_item = item_factory_->CreateSavePageItem( - this, - id, - main_file_path, - page_url, - mime_type, - request_handle.Pass(), + this, id, main_file_path, page_url, mime_type, std::move(request_handle), bound_net_log); downloads_[download_item->GetId()] = download_item; FOR_EACH_OBSERVER(Observer, observers_, OnDownloadCreated( @@ -521,12 +512,12 @@ void DownloadManagerImpl::ResumeInterruptedDownload( void DownloadManagerImpl::SetDownloadItemFactoryForTesting( scoped_ptr<DownloadItemFactory> item_factory) { - item_factory_ = item_factory.Pass(); + item_factory_ = std::move(item_factory); } void DownloadManagerImpl::SetDownloadFileFactoryForTesting( scoped_ptr<DownloadFileFactory> file_factory) { - file_factory_ = file_factory.Pass(); + file_factory_ = std::move(file_factory); } DownloadFileFactory* DownloadManagerImpl::GetDownloadFileFactoryForTesting() { @@ -546,7 +537,7 @@ void DownloadManagerImpl::DownloadRemoved(DownloadItemImpl* download) { void DownloadManagerImpl::AddUrlDownloader( scoped_ptr<UrlDownloader, BrowserThread::DeleteOnIOThread> downloader) { if (downloader) - url_downloaders_.push_back(downloader.Pass()); + url_downloaders_.push_back(std::move(downloader)); } void DownloadManagerImpl::RemoveUrlDownloader(UrlDownloader* downloader) { diff --git a/content/browser/download/download_manager_impl_unittest.cc b/content/browser/download/download_manager_impl_unittest.cc index cf73cc1..78d1386 100644 --- a/content/browser/download/download_manager_impl_unittest.cc +++ b/content/browser/download/download_manager_impl_unittest.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/download/download_manager_impl.h" + #include <stddef.h> #include <stdint.h> - #include <set> #include <string> +#include <utility> #include "base/bind.h" #include "base/files/scoped_temp_dir.h" @@ -25,7 +27,6 @@ #include "content/browser/download/download_item_factory.h" #include "content/browser/download/download_item_impl.h" #include "content/browser/download/download_item_impl_delegate.h" -#include "content/browser/download/download_manager_impl.h" #include "content/browser/download/download_request_handle.h" #include "content/browser/download/mock_download_file.h" #include "content/public/browser/browser_context.h" @@ -480,11 +481,9 @@ class DownloadManagerTest : public testing::Test { download_manager_.reset(new DownloadManagerImpl( NULL, mock_browser_context_.get())); download_manager_->SetDownloadItemFactoryForTesting( - scoped_ptr<DownloadItemFactory>( - mock_download_item_factory_.get()).Pass()); + scoped_ptr<DownloadItemFactory>(mock_download_item_factory_.get())); download_manager_->SetDownloadFileFactoryForTesting( - scoped_ptr<DownloadFileFactory>( - mock_download_file_factory_.get()).Pass()); + scoped_ptr<DownloadFileFactory>(mock_download_file_factory_.get())); observer_.reset(new MockDownloadManagerObserver()); download_manager_->AddObserver(observer_.get()); download_manager_->SetDelegate(mock_download_manager_delegate_.get()); @@ -530,7 +529,7 @@ class DownloadManagerTest : public testing::Test { // we call Start on it immediately, so we need to set that expectation // in the factory. scoped_ptr<DownloadRequestHandleInterface> req_handle; - item.Start(scoped_ptr<DownloadFile>(), req_handle.Pass()); + item.Start(scoped_ptr<DownloadFile>(), std::move(req_handle)); DCHECK(id < download_urls_.size()); EXPECT_CALL(item, GetURL()).WillRepeatedly(ReturnRef(download_urls_[id])); @@ -631,8 +630,8 @@ TEST_F(DownloadManagerTest, StartDownload) { stream.get(), _, _)) .WillOnce(Return(mock_file)); - download_manager_->StartDownload( - info.Pass(), stream.Pass(), DownloadUrlParameters::OnStartedCallback()); + download_manager_->StartDownload(std::move(info), std::move(stream), + DownloadUrlParameters::OnStartedCallback()); EXPECT_TRUE(download_manager_->GetDownload(local_id)); } diff --git a/content/browser/download/download_net_log_parameters.cc b/content/browser/download/download_net_log_parameters.cc index ea920af..e81c813 100644 --- a/content/browser/download/download_net_log_parameters.cc +++ b/content/browser/download/download_net_log_parameters.cc @@ -4,6 +4,8 @@ #include "content/browser/download/download_net_log_parameters.h" +#include <utility> + #include "base/files/file_path.h" #include "base/logging.h" #include "base/macros.h" @@ -59,7 +61,7 @@ scoped_ptr<base::Value> ItemActivatedNetLogCallback( base::Int64ToString(download_item->GetReceivedBytes())); dict->SetBoolean("has_user_gesture", download_item->HasUserGesture()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemCheckedNetLogCallback( @@ -69,7 +71,7 @@ scoped_ptr<base::Value> ItemCheckedNetLogCallback( dict->SetString("danger_type", download_danger_names[danger_type]); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemRenamedNetLogCallback( @@ -81,7 +83,7 @@ scoped_ptr<base::Value> ItemRenamedNetLogCallback( dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemInterruptedNetLogCallback( @@ -96,7 +98,7 @@ scoped_ptr<base::Value> ItemInterruptedNetLogCallback( dict->SetString("hash_state", base::HexEncode(hash_state->data(), hash_state->size())); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemResumingNetLogCallback( @@ -113,7 +115,7 @@ scoped_ptr<base::Value> ItemResumingNetLogCallback( dict->SetString("hash_state", base::HexEncode(hash_state->data(), hash_state->size())); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemCompletingNetLogCallback( @@ -126,7 +128,7 @@ scoped_ptr<base::Value> ItemCompletingNetLogCallback( dict->SetString("final_hash", base::HexEncode(final_hash->data(), final_hash->size())); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemFinishedNetLogCallback( @@ -136,7 +138,7 @@ scoped_ptr<base::Value> ItemFinishedNetLogCallback( dict->SetString("auto_opened", auto_opened ? "yes" : "no"); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> ItemCanceledNetLogCallback( @@ -149,7 +151,7 @@ scoped_ptr<base::Value> ItemCanceledNetLogCallback( dict->SetString("hash_state", base::HexEncode(hash_state->data(), hash_state->size())); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> FileOpenedNetLogCallback( @@ -161,7 +163,7 @@ scoped_ptr<base::Value> FileOpenedNetLogCallback( dict->SetString("file_name", file_name->AsUTF8Unsafe()); dict->SetString("start_offset", base::Int64ToString(start_offset)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> FileStreamDrainedNetLogCallback( @@ -173,7 +175,7 @@ scoped_ptr<base::Value> FileStreamDrainedNetLogCallback( dict->SetInteger("stream_size", static_cast<int>(stream_size)); dict->SetInteger("num_buffers", static_cast<int>(num_buffers)); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> FileRenamedNetLogCallback( @@ -185,7 +187,7 @@ scoped_ptr<base::Value> FileRenamedNetLogCallback( dict->SetString("old_filename", old_filename->AsUTF8Unsafe()); dict->SetString("new_filename", new_filename->AsUTF8Unsafe()); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> FileErrorNetLogCallback( @@ -197,7 +199,7 @@ scoped_ptr<base::Value> FileErrorNetLogCallback( dict->SetString("operation", operation); dict->SetInteger("net_error", net_error); - return dict.Pass(); + return std::move(dict); } scoped_ptr<base::Value> FileInterruptedNetLogCallback( @@ -212,7 +214,7 @@ scoped_ptr<base::Value> FileInterruptedNetLogCallback( dict->SetInteger("os_error", os_error); dict->SetString("interrupt_reason", DownloadInterruptReasonToString(reason)); - return dict.Pass(); + return std::move(dict); } } // namespace content diff --git a/content/browser/download/drag_download_file.cc b/content/browser/download/drag_download_file.cc index 3d8c0fc..afb533a 100644 --- a/content/browser/download/drag_download_file.cc +++ b/content/browser/download/drag_download_file.cc @@ -4,6 +4,8 @@ #include "content/browser/download/drag_download_file.h" +#include <utility> + #include "base/bind.h" #include "base/files/file.h" #include "base/location.h" @@ -70,8 +72,8 @@ class DragDownloadFile::DragDownloadFileUI : public DownloadItem::Observer { params->set_callback(base::Bind(&DragDownloadFileUI::OnDownloadStarted, weak_ptr_factory_.GetWeakPtr())); params->set_file_path(file_path); - params->set_file(file.Pass()); // Nulls file. - download_manager->DownloadUrl(params.Pass()); + params->set_file(std::move(file)); // Nulls file. + download_manager->DownloadUrl(std::move(params)); } void Cancel() { @@ -161,7 +163,7 @@ DragDownloadFile::DragDownloadFile(const base::FilePath& file_path, const std::string& referrer_encoding, WebContents* web_contents) : file_path_(file_path), - file_(file.Pass()), + file_(std::move(file)), drag_message_loop_(base::MessageLoop::current()), state_(INITIALIZED), drag_ui_(NULL), diff --git a/content/browser/download/drag_download_util.cc b/content/browser/download/drag_download_util.cc index 4172150..b9e5f9e 100644 --- a/content/browser/download/drag_download_util.cc +++ b/content/browser/download/drag_download_util.cc @@ -82,7 +82,7 @@ base::File CreateFileForDrop(base::FilePath* file_path) { new_file_path, base::File::FLAG_CREATE | base::File::FLAG_WRITE); if (file.IsValid()) { *file_path = new_file_path; - return file.Pass(); + return file; } } diff --git a/content/browser/download/mhtml_generation_manager.cc b/content/browser/download/mhtml_generation_manager.cc index 6c14c3b..9937db7 100644 --- a/content/browser/download/mhtml_generation_manager.cc +++ b/content/browser/download/mhtml_generation_manager.cc @@ -6,6 +6,7 @@ #include <map> #include <queue> +#include <utility> #include "base/bind.h" #include "base/files/file.h" @@ -33,7 +34,7 @@ class MHTMLGenerationManager::Job : public RenderProcessHostObserver { Job(int job_id, WebContents* web_contents, GenerateMHTMLCallback callback); ~Job() override; - void set_browser_file(base::File file) { browser_file_ = file.Pass(); } + void set_browser_file(base::File file) { browser_file_ = std::move(file); } GenerateMHTMLCallback callback() const { return callback_; } @@ -202,7 +203,7 @@ void MHTMLGenerationManager::Job::CloseFile( BrowserThread::PostTaskAndReplyWithResult( BrowserThread::FILE, FROM_HERE, base::Bind(&MHTMLGenerationManager::Job::CloseFileOnFileThread, - base::Passed(browser_file_.Pass())), + base::Passed(std::move(browser_file_))), callback); } @@ -300,7 +301,7 @@ base::File MHTMLGenerationManager::CreateFile(const base::FilePath& file_path) { LOG(ERROR) << "Failed to create file to save MHTML at: " << file_path.value(); } - return browser_file.Pass(); + return browser_file; } void MHTMLGenerationManager::OnFileAvailable(int job_id, @@ -317,7 +318,7 @@ void MHTMLGenerationManager::OnFileAvailable(int job_id, if (!job) return; - job->set_browser_file(browser_file.Pass()); + job->set_browser_file(std::move(browser_file)); if (!job->SendToNextRenderFrame()) { JobFinished(job_id, JobStatus::FAILURE); diff --git a/content/browser/download/save_package.cc b/content/browser/download/save_package.cc index b55220d..eae1e0d 100644 --- a/content/browser/download/save_package.cc +++ b/content/browser/download/save_package.cc @@ -5,6 +5,7 @@ #include "content/browser/download/save_package.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -315,11 +316,10 @@ bool SavePackage::Init( new SavePackageRequestHandle(AsWeakPtr())); // The download manager keeps ownership but adds us as an observer. download_manager_->CreateSavePackageDownloadItem( - saved_main_file_path_, - page_url_, - ((save_type_ == SAVE_PAGE_TYPE_AS_MHTML) ? - "multipart/related" : "text/html"), - request_handle.Pass(), + saved_main_file_path_, page_url_, + ((save_type_ == SAVE_PAGE_TYPE_AS_MHTML) ? "multipart/related" + : "text/html"), + std::move(request_handle), base::Bind(&SavePackage::InitWithDownloadItem, AsWeakPtr(), download_created_callback)); return true; diff --git a/content/browser/fileapi/blob_reader_unittest.cc b/content/browser/fileapi/blob_reader_unittest.cc index 66c5da6..d16b552 100644 --- a/content/browser/fileapi/blob_reader_unittest.cc +++ b/content/browser/fileapi/blob_reader_unittest.cc @@ -2,11 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "storage/browser/blob/blob_reader.h" - #include <stddef.h> #include <stdint.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -29,6 +28,7 @@ #include "net/disk_cache/disk_cache.h" #include "storage/browser/blob/blob_data_builder.h" #include "storage/browser/blob/blob_data_handle.h" +#include "storage/browser/blob/blob_reader.h" #include "storage/browser/blob/blob_storage_context.h" #include "storage/browser/fileapi/file_stream_reader.h" #include "storage/browser/fileapi/file_system_context.h" @@ -60,7 +60,7 @@ class EmptyDataHandle : public storage::BlobDataBuilder::DataHandle { class DelayedReadEntry : public disk_cache::Entry { public: explicit DelayedReadEntry(disk_cache::ScopedEntryPtr entry) - : entry_(entry.Pass()) {} + : entry_(std::move(entry)) {} ~DelayedReadEntry() override { EXPECT_FALSE(HasPendingReadCallbacks()); } bool HasPendingReadCallbacks() { return !pending_read_callbacks_.empty(); } @@ -154,7 +154,7 @@ scoped_ptr<disk_cache::Backend> CreateInMemoryDiskCache( thread, nullptr, &cache, callback.callback()); EXPECT_EQ(net::OK, callback.GetResult(rv)); - return cache.Pass(); + return cache; } disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, @@ -171,7 +171,7 @@ disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, rv = entry->WriteData(kTestDiskCacheStreamIndex, 0, iobuffer.get(), iobuffer->size(), callback.callback(), false); EXPECT_EQ(static_cast<int>(data.size()), callback.GetResult(rv)); - return entry.Pass(); + return entry; } template <typename T> @@ -325,10 +325,10 @@ class BlobReaderTest : public ::testing::Test { protected: void InitializeReader(BlobDataBuilder* builder) { - blob_handle_ = builder ? context_.AddFinishedBlob(builder).Pass() : nullptr; + blob_handle_ = builder ? context_.AddFinishedBlob(builder) : nullptr; provider_ = new MockFileStreamReaderProvider(); scoped_ptr<BlobReader::FileStreamReaderProvider> temp_ptr(provider_); - reader_.reset(new BlobReader(blob_handle_.get(), temp_ptr.Pass(), + reader_.reset(new BlobReader(blob_handle_.get(), std::move(temp_ptr), message_loop_.task_runner().get())); } @@ -729,7 +729,7 @@ TEST_F(BlobReaderTest, DiskCacheAsync) { scoped_refptr<BlobDataBuilder::DataHandle> data_handle = new EmptyDataHandle(); scoped_ptr<DelayedReadEntry> delayed_read_entry(new DelayedReadEntry( - CreateDiskCacheEntry(cache.get(), "test entry", kData).Pass())); + CreateDiskCacheEntry(cache.get(), "test entry", kData))); b.AppendDiskCacheEntry(data_handle, delayed_read_entry.get(), kTestDiskCacheStreamIndex); this->InitializeReader(&b); diff --git a/content/browser/fileapi/blob_storage_context_unittest.cc b/content/browser/fileapi/blob_storage_context_unittest.cc index a2216ca..72df984 100644 --- a/content/browser/fileapi/blob_storage_context_unittest.cc +++ b/content/browser/fileapi/blob_storage_context_unittest.cc @@ -54,7 +54,7 @@ scoped_ptr<disk_cache::Backend> CreateInMemoryDiskCache() { callback.callback()); EXPECT_EQ(net::OK, callback.GetResult(rv)); - return cache.Pass(); + return cache; } disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, @@ -71,7 +71,7 @@ disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, rv = entry->WriteData(kTestDiskCacheStreamIndex, 0, iobuffer.get(), iobuffer->size(), callback.callback(), false); EXPECT_EQ(static_cast<int>(data.size()), callback.GetResult(rv)); - return entry.Pass(); + return entry; } void SetupBasicBlob(BlobStorageHost* host, const std::string& id) { diff --git a/content/browser/fileapi/blob_url_request_job_unittest.cc b/content/browser/fileapi/blob_url_request_job_unittest.cc index 5edc79a..782a1e5 100644 --- a/content/browser/fileapi/blob_url_request_job_unittest.cc +++ b/content/browser/fileapi/blob_url_request_job_unittest.cc @@ -83,7 +83,7 @@ scoped_ptr<disk_cache::Backend> CreateInMemoryDiskCache() { callback.callback()); EXPECT_EQ(net::OK, callback.GetResult(rv)); - return cache.Pass(); + return cache; } disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, @@ -100,7 +100,7 @@ disk_cache::ScopedEntryPtr CreateDiskCacheEntry(disk_cache::Backend* cache, rv = entry->WriteData(kTestDiskCacheStreamIndex, 0, iobuffer.get(), iobuffer->size(), callback.callback(), false); EXPECT_EQ(static_cast<int>(data.size()), callback.GetResult(rv)); - return entry.Pass(); + return entry; } } // namespace @@ -288,7 +288,7 @@ class BlobURLRequestJobTest : public testing::Test { storage::BlobDataHandle* GetHandleFromBuilder() { if (!blob_handle_) { - blob_handle_ = blob_context_.AddFinishedBlob(blob_data_.get()).Pass(); + blob_handle_ = blob_context_.AddFinishedBlob(blob_data_.get()); } return blob_handle_.get(); } diff --git a/content/browser/fileapi/browser_file_system_helper.cc b/content/browser/fileapi/browser_file_system_helper.cc index ee8ffb2..64402cd 100644 --- a/content/browser/fileapi/browser_file_system_helper.cc +++ b/content/browser/fileapi/browser_file_system_helper.cc @@ -5,8 +5,8 @@ #include "content/browser/fileapi/browser_file_system_helper.h" #include <stddef.h> - #include <string> +#include <utility> #include <vector> #include "base/command_line.h" @@ -79,12 +79,9 @@ scoped_refptr<storage::FileSystemContext> CreateFileSystemContext( BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO).get(), file_task_runner.get(), BrowserContext::GetMountPoints(browser_context), - browser_context->GetSpecialStoragePolicy(), - quota_manager_proxy, - additional_backends.Pass(), - url_request_auto_mount_handlers, - profile_path, - CreateBrowserFileSystemOptions(is_incognito)); + browser_context->GetSpecialStoragePolicy(), quota_manager_proxy, + std::move(additional_backends), url_request_auto_mount_handlers, + profile_path, CreateBrowserFileSystemOptions(is_incognito)); std::vector<storage::FileSystemType> types; file_system_context->GetFileSystemTypes(&types); diff --git a/content/browser/fileapi/chrome_blob_storage_context.cc b/content/browser/fileapi/chrome_blob_storage_context.cc index 5e2c4c8..8b9ed71 100644 --- a/content/browser/fileapi/chrome_blob_storage_context.cc +++ b/content/browser/fileapi/chrome_blob_storage_context.cc @@ -4,6 +4,8 @@ #include "content/browser/fileapi/chrome_blob_storage_context.h" +#include <utility> + #include "base/bind.h" #include "base/guid.h" #include "content/public/browser/blob_handle.h" @@ -25,7 +27,7 @@ const char kBlobStorageContextKeyName[] = "content_blob_storage_context"; class BlobHandleImpl : public BlobHandle { public: explicit BlobHandleImpl(scoped_ptr<storage::BlobDataHandle> handle) - : handle_(handle.Pass()) {} + : handle_(std::move(handle)) {} ~BlobHandleImpl() override {} @@ -78,8 +80,8 @@ scoped_ptr<BlobHandle> ChromeBlobStorageContext::CreateMemoryBackedBlob( return scoped_ptr<BlobHandle>(); scoped_ptr<BlobHandle> blob_handle( - new BlobHandleImpl(blob_data_handle.Pass())); - return blob_handle.Pass(); + new BlobHandleImpl(std::move(blob_data_handle))); + return blob_handle; } scoped_ptr<BlobHandle> ChromeBlobStorageContext::CreateFileBackedBlob( @@ -99,8 +101,8 @@ scoped_ptr<BlobHandle> ChromeBlobStorageContext::CreateFileBackedBlob( return scoped_ptr<BlobHandle>(); scoped_ptr<BlobHandle> blob_handle( - new BlobHandleImpl(blob_data_handle.Pass())); - return blob_handle.Pass(); + new BlobHandleImpl(std::move(blob_data_handle))); + return blob_handle; } ChromeBlobStorageContext::~ChromeBlobStorageContext() {} diff --git a/content/browser/fileapi/copy_or_move_file_validator_unittest.cc b/content/browser/fileapi/copy_or_move_file_validator_unittest.cc index c099f29..2b62b53 100644 --- a/content/browser/fileapi/copy_or_move_file_validator_unittest.cc +++ b/content/browser/fileapi/copy_or_move_file_validator_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -102,7 +103,7 @@ class CopyOrMoveFileValidatorTestHelper { scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory) { TestFileSystemBackend* backend = static_cast<TestFileSystemBackend*>( file_system_context_->GetFileSystemBackend(kWithValidatorType)); - backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); + backend->InitializeCopyOrMoveFileValidatorFactory(std::move(factory)); } void CopyTest(base::File::Error expected) { @@ -282,7 +283,7 @@ TEST(CopyOrMoveFileValidatorTest, AcceptAll) { helper.SetUp(); scoped_ptr<CopyOrMoveFileValidatorFactory> factory( new TestCopyOrMoveFileValidatorFactory(VALID)); - helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); + helper.SetMediaCopyOrMoveFileValidatorFactory(std::move(factory)); helper.CopyTest(base::File::FILE_OK); helper.MoveTest(base::File::FILE_OK); @@ -295,7 +296,7 @@ TEST(CopyOrMoveFileValidatorTest, AcceptNone) { helper.SetUp(); scoped_ptr<CopyOrMoveFileValidatorFactory> factory( new TestCopyOrMoveFileValidatorFactory(PRE_WRITE_INVALID)); - helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); + helper.SetMediaCopyOrMoveFileValidatorFactory(std::move(factory)); helper.CopyTest(base::File::FILE_ERROR_SECURITY); helper.MoveTest(base::File::FILE_ERROR_SECURITY); @@ -309,11 +310,11 @@ TEST(CopyOrMoveFileValidatorTest, OverrideValidator) { helper.SetUp(); scoped_ptr<CopyOrMoveFileValidatorFactory> reject_factory( new TestCopyOrMoveFileValidatorFactory(PRE_WRITE_INVALID)); - helper.SetMediaCopyOrMoveFileValidatorFactory(reject_factory.Pass()); + helper.SetMediaCopyOrMoveFileValidatorFactory(std::move(reject_factory)); scoped_ptr<CopyOrMoveFileValidatorFactory> accept_factory( new TestCopyOrMoveFileValidatorFactory(VALID)); - helper.SetMediaCopyOrMoveFileValidatorFactory(accept_factory.Pass()); + helper.SetMediaCopyOrMoveFileValidatorFactory(std::move(accept_factory)); helper.CopyTest(base::File::FILE_ERROR_SECURITY); helper.MoveTest(base::File::FILE_ERROR_SECURITY); @@ -326,7 +327,7 @@ TEST(CopyOrMoveFileValidatorTest, RejectPostWrite) { helper.SetUp(); scoped_ptr<CopyOrMoveFileValidatorFactory> factory( new TestCopyOrMoveFileValidatorFactory(POST_WRITE_INVALID)); - helper.SetMediaCopyOrMoveFileValidatorFactory(factory.Pass()); + helper.SetMediaCopyOrMoveFileValidatorFactory(std::move(factory)); helper.CopyTest(base::File::FILE_ERROR_SECURITY); helper.MoveTest(base::File::FILE_ERROR_SECURITY); diff --git a/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc b/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc index 85f3c7e..055b8f2 100644 --- a/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc +++ b/content/browser/fileapi/copy_or_move_operation_delegate_unittest.cc @@ -4,9 +4,9 @@ #include <stddef.h> #include <stdint.h> - #include <map> #include <queue> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -221,7 +221,8 @@ class CopyOrMoveOperationTestHelper { test_backend->set_require_copy_or_move_validator( require_copy_or_move_validator); if (init_copy_or_move_validator) - test_backend->InitializeCopyOrMoveFileValidatorFactory(factory.Pass()); + test_backend->InitializeCopyOrMoveFileValidatorFactory( + std::move(factory)); } backend->ResolveURL( FileSystemURL::CreateForTest(origin_, dest_type_, base::FilePath()), @@ -744,7 +745,7 @@ TEST(LocalFileSystemCopyOrMoveOperationTest, StreamCopyHelper) { std::vector<int64_t> progress; CopyOrMoveOperationDelegate::StreamCopyHelper helper( - reader.Pass(), writer.Pass(), + std::move(reader), std::move(writer), storage::FlushPolicy::NO_FLUSH_ON_COMPLETION, 10, // buffer size base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)), @@ -800,7 +801,7 @@ TEST(LocalFileSystemCopyOrMoveOperationTest, StreamCopyHelperWithFlush) { std::vector<int64_t> progress; CopyOrMoveOperationDelegate::StreamCopyHelper helper( - reader.Pass(), writer.Pass(), + std::move(reader), std::move(writer), storage::FlushPolicy::NO_FLUSH_ON_COMPLETION, 10, // buffer size base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)), @@ -851,7 +852,7 @@ TEST(LocalFileSystemCopyOrMoveOperationTest, StreamCopyHelper_Cancel) { std::vector<int64_t> progress; CopyOrMoveOperationDelegate::StreamCopyHelper helper( - reader.Pass(), writer.Pass(), + std::move(reader), std::move(writer), storage::FlushPolicy::NO_FLUSH_ON_COMPLETION, 10, // buffer size base::Bind(&RecordFileProgressCallback, base::Unretained(&progress)), diff --git a/content/browser/fileapi/dragged_file_util_unittest.cc b/content/browser/fileapi/dragged_file_util_unittest.cc index 3ef9f8c..07c983b 100644 --- a/content/browser/fileapi/dragged_file_util_unittest.cc +++ b/content/browser/fileapi/dragged_file_util_unittest.cc @@ -251,8 +251,8 @@ class DraggedFileUtilTest : public testing::Test { } scoped_ptr<storage::FileSystemOperationContext> GetOperationContext() { - return make_scoped_ptr(new storage::FileSystemOperationContext( - file_system_context())).Pass(); + return make_scoped_ptr( + new storage::FileSystemOperationContext(file_system_context())); } diff --git a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc index 1cce5e7..15f376c 100644 --- a/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc +++ b/content/browser/fileapi/file_system_dir_url_request_job_unittest.cc @@ -2,11 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "storage/browser/fileapi/file_system_dir_url_request_job.h" - #include <stdint.h> - #include <string> +#include <utility> #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -32,6 +30,7 @@ #include "net/url_request/url_request_test_util.h" #include "storage/browser/fileapi/external_mount_points.h" #include "storage/browser/fileapi/file_system_context.h" +#include "storage/browser/fileapi/file_system_dir_url_request_job.h" #include "storage/browser/fileapi/file_system_file_util.h" #include "storage/browser/fileapi/file_system_operation_context.h" #include "storage/browser/fileapi/file_system_url.h" @@ -164,7 +163,7 @@ class FileSystemDirURLRequestJobTest : public testing::Test { handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( - NULL, additional_providers.Pass(), handlers, temp_dir_.path()); + NULL, std::move(additional_providers), handlers, temp_dir_.path()); } void OnOpenFileSystem(const GURL& root_url, diff --git a/content/browser/fileapi/file_system_operation_impl_write_unittest.cc b/content/browser/fileapi/file_system_operation_impl_write_unittest.cc index b6e07e8..34ed554 100644 --- a/content/browser/fileapi/file_system_operation_impl_write_unittest.cc +++ b/content/browser/fileapi/file_system_operation_impl_write_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include <stdint.h> - +#include <utility> #include <vector> #include "base/files/scoped_temp_dir.h" @@ -212,8 +212,8 @@ TEST_F(FileSystemOperationImplWriteTest, TestWriteZero) { TEST_F(FileSystemOperationImplWriteTest, TestWriteInvalidBlobUrl) { scoped_ptr<storage::BlobDataHandle> null_handle; file_system_context_->operation_runner()->Write( - &url_request_context(), URLForPath(virtual_path_), - null_handle.Pass(), 0, RecordWriteCallback()); + &url_request_context(), URLForPath(virtual_path_), std::move(null_handle), + 0, RecordWriteCallback()); base::MessageLoop::current()->Run(); EXPECT_EQ(0, bytes_written()); diff --git a/content/browser/fileapi/file_system_operation_runner_unittest.cc b/content/browser/fileapi/file_system_operation_runner_unittest.cc index 6701805..082a7e3d 100644 --- a/content/browser/fileapi/file_system_operation_runner_unittest.cc +++ b/content/browser/fileapi/file_system_operation_runner_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/files/file_path.h" #include "base/files/scoped_temp_dir.h" #include "base/macros.h" @@ -194,11 +196,9 @@ class MultiThreadFileSystemOperationRunnerTest : public testing::Test { base::ThreadTaskRunnerHandle::Get().get(), BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE).get(), storage::ExternalMountPoints::CreateRefCounted().get(), - make_scoped_refptr(new MockSpecialStoragePolicy()).get(), - nullptr, - additional_providers.Pass(), - std::vector<storage::URLRequestAutoMountHandler>(), - base_dir, + make_scoped_refptr(new MockSpecialStoragePolicy()).get(), nullptr, + std::move(additional_providers), + std::vector<storage::URLRequestAutoMountHandler>(), base_dir, CreateAllowFileAccessOptions()); // Disallow IO on the main loop. diff --git a/content/browser/fileapi/file_system_url_request_job_unittest.cc b/content/browser/fileapi/file_system_url_request_job_unittest.cc index f9b72ed..4b2715c 100644 --- a/content/browser/fileapi/file_system_url_request_job_unittest.cc +++ b/content/browser/fileapi/file_system_url_request_job_unittest.cc @@ -2,11 +2,9 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "storage/browser/fileapi/file_system_url_request_job.h" - #include <stddef.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -39,6 +37,7 @@ #include "storage/browser/fileapi/external_mount_points.h" #include "storage/browser/fileapi/file_system_context.h" #include "storage/browser/fileapi/file_system_file_util.h" +#include "storage/browser/fileapi/file_system_url_request_job.h" #include "testing/gtest/include/gtest/gtest.h" using content::AsyncFileTestHelper; @@ -169,7 +168,7 @@ class FileSystemURLRequestJobTest : public testing::Test { handlers.push_back(base::Bind(&TestAutoMountForURLRequest)); file_system_context_ = CreateFileSystemContextWithAutoMountersForTesting( - NULL, additional_providers.Pass(), handlers, temp_dir_.path()); + NULL, std::move(additional_providers), handlers, temp_dir_.path()); ASSERT_EQ(static_cast<int>(sizeof(kTestFileData)) - 1, base::WriteFile(mnt_point.AppendASCII("foo"), kTestFileData, diff --git a/content/browser/fileapi/file_writer_delegate_unittest.cc b/content/browser/fileapi/file_writer_delegate_unittest.cc index ad3cc76..c12e3c3 100644 --- a/content/browser/fileapi/file_writer_delegate_unittest.cc +++ b/content/browser/fileapi/file_writer_delegate_unittest.cc @@ -3,9 +3,9 @@ // found in the LICENSE file. #include <stdint.h> - #include <limits> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -284,7 +284,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimit) { Result result; ASSERT_EQ(0, usage()); - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status()); @@ -304,7 +304,7 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithJustQuota) { Result result; ASSERT_EQ(0, usage()); - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status()); file_writer_delegate_.reset(); @@ -324,7 +324,7 @@ TEST_F(FileWriterDelegateTest, DISABLED_WriteFailureByQuota) { Result result; ASSERT_EQ(0, usage()); - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::ERROR_WRITE_STARTED, result.write_status()); file_writer_delegate_.reset(); @@ -345,7 +345,7 @@ TEST_F(FileWriterDelegateTest, WriteZeroBytesSuccessfullyWithZeroQuota) { Result result; ASSERT_EQ(0, usage()); - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status()); file_writer_delegate_.reset(); @@ -380,8 +380,8 @@ TEST_F(FileWriterDelegateTest, WriteSuccessWithoutQuotaLimitConcurrent) { Result result, result2; ASSERT_EQ(0, usage()); - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); - file_writer_delegate2->Start(request2.Pass(), GetWriteCallback(&result2)); + file_writer_delegate_->Start(std::move(request_), GetWriteCallback(&result)); + file_writer_delegate2->Start(std::move(request2), GetWriteCallback(&result2)); base::MessageLoop::current()->Run(); if (result.write_status() == FileWriterDelegate::SUCCESS_IO_PENDING || result2.write_status() == FileWriterDelegate::SUCCESS_IO_PENDING) @@ -414,7 +414,8 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) { { Result result; ASSERT_EQ(0, usage()); - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), + GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status()); file_writer_delegate_.reset(); @@ -432,7 +433,8 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) { { Result result; - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), + GetWriteCallback(&result)); base::MessageLoop::current()->Run(); EXPECT_EQ(kDataSize, usage()); EXPECT_EQ(GetFileSizeOnDisk("test"), usage()); @@ -449,7 +451,8 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) { { Result result; - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), + GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status()); file_writer_delegate_.reset(); @@ -468,7 +471,8 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) { { Result result; - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), + GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::SUCCESS_COMPLETED, result.write_status()); file_writer_delegate_.reset(); @@ -488,7 +492,8 @@ TEST_F(FileWriterDelegateTest, WritesWithQuotaAndOffset) { { Result result; - file_writer_delegate_->Start(request_.Pass(), GetWriteCallback(&result)); + file_writer_delegate_->Start(std::move(request_), + GetWriteCallback(&result)); base::MessageLoop::current()->Run(); ASSERT_EQ(FileWriterDelegate::ERROR_WRITE_STARTED, result.write_status()); file_writer_delegate_.reset(); diff --git a/content/browser/fileapi/fileapi_message_filter.cc b/content/browser/fileapi/fileapi_message_filter.cc index 6ce1d4a..8594aef 100644 --- a/content/browser/fileapi/fileapi_message_filter.cc +++ b/content/browser/fileapi/fileapi_message_filter.cc @@ -5,6 +5,7 @@ #include "content/browser/fileapi/fileapi_message_filter.h" #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -411,7 +412,7 @@ void FileAPIMessageFilter::OnWrite(int request_id, blob_storage_context_->context()->GetBlobDataFromUUID(blob_uuid); operations_[request_id] = operation_runner()->Write( - request_context_, url, blob.Pass(), offset, + request_context_, url, std::move(blob), offset, base::Bind(&FileAPIMessageFilter::DidWrite, this, request_id)); } diff --git a/content/browser/fileapi/obfuscated_file_util_unittest.cc b/content/browser/fileapi/obfuscated_file_util_unittest.cc index cda3c92..8d434fa 100644 --- a/content/browser/fileapi/obfuscated_file_util_unittest.cc +++ b/content/browser/fileapi/obfuscated_file_util_unittest.cc @@ -4,10 +4,10 @@ #include <stddef.h> #include <stdint.h> - #include <limits> #include <set> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -192,7 +192,7 @@ class ObfuscatedFileUtilTest : public testing::Test { scoped_ptr<FileSystemOperationContext> context( sandbox_file_system_.NewOperationContext()); context->set_allowed_bytes_growth(allowed_bytes_growth); - return context.Pass(); + return context; } scoped_ptr<FileSystemOperationContext> UnlimitedContext() { @@ -400,7 +400,7 @@ class ObfuscatedFileUtilTest : public testing::Test { UsageVerifyHelper(scoped_ptr<FileSystemOperationContext> context, SandboxFileSystemTestHelper* file_system, int64_t expected_usage) - : context_(context.Pass()), + : context_(std::move(context)), sandbox_file_system_(file_system), expected_usage_(expected_usage) {} @@ -851,7 +851,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { ASSERT_TRUE(file.created()); EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count()); - CheckFileAndCloseHandle(url, file.Pass()); + CheckFileAndCloseHandle(url, std::move(file)); context.reset(NewContext(NULL)); base::FilePath local_path; @@ -887,7 +887,7 @@ TEST_F(ObfuscatedFileUtilTest, TestCreateAndDeleteFile) { ASSERT_TRUE(file.created()); EXPECT_EQ(1, change_observer()->get_and_reset_create_file_count()); - CheckFileAndCloseHandle(url, file.Pass()); + CheckFileAndCloseHandle(url, std::move(file)); context.reset(NewContext(NULL)); EXPECT_EQ(base::File::FILE_OK, diff --git a/content/browser/font_list_async.cc b/content/browser/font_list_async.cc index 4225319..730f673 100644 --- a/content/browser/font_list_async.cc +++ b/content/browser/font_list_async.cc @@ -4,6 +4,8 @@ #include "content/public/browser/font_list_async.h" +#include <utility> + #include "base/bind.h" #include "base/values.h" #include "content/common/font_list.h" @@ -17,7 +19,7 @@ namespace { void ReturnFontListToOriginalThread( const base::Callback<void(scoped_ptr<base::ListValue>)>& callback, scoped_ptr<base::ListValue> result) { - callback.Run(result.Pass()); + callback.Run(std::move(result)); } void GetFontListInBlockingPool( diff --git a/content/browser/frame_host/frame_mojo_shell.cc b/content/browser/frame_host/frame_mojo_shell.cc index 28bbc2e..ece0356 100644 --- a/content/browser/frame_host/frame_mojo_shell.cc +++ b/content/browser/frame_host/frame_mojo_shell.cc @@ -4,6 +4,8 @@ #include "content/browser/frame_host/frame_mojo_shell.h" +#include <utility> + #include "build/build_config.h" #include "content/browser/mojo/mojo_shell_context.h" #include "content/common/mojo/service_registry_impl.h" @@ -61,7 +63,8 @@ void FrameMojoShell::ConnectToApplication( capability_filter = filter->filter.To<mojo::shell::CapabilityFilter>(); MojoShellContext::ConnectToApplication( GURL(application_url->url), frame_host_->GetSiteInstance()->GetSiteURL(), - services.Pass(), frame_services.Pass(), capability_filter, callback); + std::move(services), std::move(frame_services), capability_filter, + callback); } void FrameMojoShell::QuitApplication() { diff --git a/content/browser/frame_host/frame_tree_node.cc b/content/browser/frame_host/frame_tree_node.cc index c61e3fc..b975a05 100644 --- a/content/browser/frame_host/frame_tree_node.cc +++ b/content/browser/frame_host/frame_tree_node.cc @@ -5,6 +5,7 @@ #include "content/browser/frame_host/frame_tree_node.h" #include <queue> +#include <utility> #include "base/macros.h" #include "base/profiler/scoped_tracker.h" @@ -152,7 +153,7 @@ FrameTreeNode* FrameTreeNode::AddChild(scoped_ptr<FrameTreeNode> child, if (SiteIsolationPolicy::AreCrossProcessFramesPossible()) render_manager_.CreateProxiesForChildFrame(child.get()); - children_.push_back(child.Pass()); + children_.push_back(std::move(child)); return children_.back().get(); } @@ -161,7 +162,7 @@ void FrameTreeNode::RemoveChild(FrameTreeNode* child) { if (iter->get() == child) { // Subtle: we need to make sure the node is gone from the tree before // observers are notified of its deletion. - scoped_ptr<FrameTreeNode> node_to_delete(iter->Pass()); + scoped_ptr<FrameTreeNode> node_to_delete(std::move(*iter)); children_.erase(iter); node_to_delete.reset(); return; @@ -290,7 +291,7 @@ void FrameTreeNode::CreatedNavigationRequest( DidStartLoading(true); } - navigation_request_ = navigation_request.Pass(); + navigation_request_ = std::move(navigation_request); render_manager()->DidCreateNavigationRequest(*navigation_request_); } diff --git a/content/browser/frame_host/interstitial_page_impl.cc b/content/browser/frame_host/interstitial_page_impl.cc index 4fcdcfb..9e63d82 100644 --- a/content/browser/frame_host/interstitial_page_impl.cc +++ b/content/browser/frame_host/interstitial_page_impl.cc @@ -4,6 +4,7 @@ #include "content/browser/frame_host/interstitial_page_impl.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -241,7 +242,7 @@ void InterstitialPageImpl::Show() { // Give delegates a chance to set some states on the navigation entry. delegate_->OverrideEntry(entry.get()); - controller_->SetTransientEntry(entry.Pass()); + controller_->SetTransientEntry(std::move(entry)); static_cast<WebContentsImpl*>(web_contents_)->DidChangeVisibleSSLState(); } diff --git a/content/browser/frame_host/navigation_controller_impl.cc b/content/browser/frame_host/navigation_controller_impl.cc index 4ae518f..071cec8 100644 --- a/content/browser/frame_host/navigation_controller_impl.cc +++ b/content/browser/frame_host/navigation_controller_impl.cc @@ -35,6 +35,8 @@ #include "content/browser/frame_host/navigation_controller_impl.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/logging.h" @@ -278,7 +280,8 @@ void NavigationControllerImpl::Restore( needs_reload_ = true; entries_.reserve(entries->size()); for (auto& entry : *entries) - entries_.push_back(NavigationEntryImpl::FromNavigationEntry(entry.Pass())); + entries_.push_back( + NavigationEntryImpl::FromNavigationEntry(std::move(entry))); // At this point, the |entries| is full of empty scoped_ptrs, so it can be // cleared out safely. @@ -447,7 +450,7 @@ void NavigationControllerImpl::LoadEntry( // When navigating to a new page, we don't know for sure if we will actually // end up leaving the current page. The new page load could for example // result in a download or a 'no content' response (e.g., a mailto: URL). - SetPendingEntry(entry.Pass()); + SetPendingEntry(std::move(entry)); NavigateToPendingEntry(NO_RELOAD); } @@ -559,7 +562,7 @@ void NavigationControllerImpl::TakeScreenshot() { void NavigationControllerImpl::SetScreenshotManager( scoped_ptr<NavigationEntryScreenshotManager> manager) { if (manager.get()) - screenshot_manager_ = manager.Pass(); + screenshot_manager_ = std::move(manager); else screenshot_manager_.reset(new NavigationEntryScreenshotManager(this)); } @@ -816,7 +819,7 @@ void NavigationControllerImpl::LoadURLWithParams(const LoadURLParams& params) { break; }; - LoadEntry(entry.Pass()); + LoadEntry(std::move(entry)); } bool NavigationControllerImpl::RendererDidNavigate( @@ -1160,7 +1163,7 @@ void NavigationControllerImpl::RendererDidNavigateToNewPage( last_committed_entry_index_ = -1; } - InsertOrReplaceEntry(new_entry.Pass(), replace_entry); + InsertOrReplaceEntry(std::move(new_entry), replace_entry); } void NavigationControllerImpl::RendererDidNavigateToExistingPage( @@ -1289,7 +1292,7 @@ void NavigationControllerImpl::RendererDidNavigateNewSubframe( } new_entry->SetPageID(params.page_id); - InsertOrReplaceEntry(new_entry.Pass(), false); + InsertOrReplaceEntry(std::move(new_entry), false); } bool NavigationControllerImpl::RendererDidNavigateAutoSubframe( @@ -1683,7 +1686,7 @@ void NavigationControllerImpl::InsertOrReplaceEntry( if (replace && current_size > 0) { int32_t page_id = entry->GetPageID(); - entries_[last_committed_entry_index_] = entry.Pass(); + entries_[last_committed_entry_index_] = std::move(entry); // This is a new page ID, so we need everybody to know about it. delegate_->UpdateMaxPageID(page_id); @@ -1711,7 +1714,7 @@ void NavigationControllerImpl::InsertOrReplaceEntry( PruneOldestEntryIfFull(); int32_t page_id = entry->GetPageID(); - entries_.push_back(entry.Pass()); + entries_.push_back(std::move(entry)); last_committed_entry_index_ = static_cast<int>(entries_.size()) - 1; // This is a new page ID, so we need everybody to know about it. @@ -2024,7 +2027,7 @@ void NavigationControllerImpl::SetTransientEntry( index = last_committed_entry_index_ + 1; DiscardTransientEntry(); entries_.insert(entries_.begin() + index, - NavigationEntryImpl::FromNavigationEntry(entry.Pass())); + NavigationEntryImpl::FromNavigationEntry(std::move(entry))); transient_entry_index_ = index; delegate_->NotifyNavigationStateChanged(INVALIDATE_TYPE_ALL); } @@ -2041,7 +2044,7 @@ void NavigationControllerImpl::InsertEntriesFrom( // NavigationEntries, it will not be safe to share them with another tab. // Must have a version of Clone that recreates them. entries_.insert(entries_.begin() + insert_index++, - source.entries_[i]->Clone().Pass()); + source.entries_[i]->Clone()); } } } diff --git a/content/browser/frame_host/navigation_controller_impl_browsertest.cc b/content/browser/frame_host/navigation_controller_impl_browsertest.cc index c19a4ea..c9fa5bd 100644 --- a/content/browser/frame_host/navigation_controller_impl_browsertest.cc +++ b/content/browser/frame_host/navigation_controller_impl_browsertest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/frame_host/navigation_controller_impl.h" + #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -11,7 +14,6 @@ #include "base/strings/utf_string_conversions.h" #include "content/browser/frame_host/frame_navigation_entry.h" #include "content/browser/frame_host/frame_tree.h" -#include "content/browser/frame_host/navigation_controller_impl.h" #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/web_contents/web_contents_impl.h" #include "content/common/site_isolation_policy.h" @@ -2481,7 +2483,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerBrowserTest, // 5. Restore the new entry in a new tab and verify the correct URLs load. std::vector<scoped_ptr<NavigationEntry>> entries; - entries.push_back(restored_entry.Pass()); + entries.push_back(std::move(restored_entry)); Shell* new_shell = Shell::CreateNewWindow( controller.GetBrowserContext(), GURL::EmptyGURL(), nullptr, gfx::Size()); FrameTreeNode* new_root = @@ -2750,7 +2752,7 @@ IN_PROC_BROWSER_TEST_F(NavigationControllerOopifBrowserTest, // 4. Restore the new entry in a new tab and verify the correct URLs load. std::vector<scoped_ptr<NavigationEntry>> entries; - entries.push_back(restored_entry.Pass()); + entries.push_back(std::move(restored_entry)); Shell* new_shell = Shell::CreateNewWindow( controller.GetBrowserContext(), GURL::EmptyGURL(), nullptr, gfx::Size()); FrameTreeNode* new_root = diff --git a/content/browser/frame_host/navigation_controller_impl_unittest.cc b/content/browser/frame_host/navigation_controller_impl_unittest.cc index ac73cc5..6658520 100644 --- a/content/browser/frame_host/navigation_controller_impl_unittest.cc +++ b/content/browser/frame_host/navigation_controller_impl_unittest.cc @@ -2,8 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/frame_host/navigation_controller_impl.h" + #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" @@ -16,7 +19,6 @@ #include "build/build_config.h" #include "content/browser/frame_host/cross_site_transferring_request.h" #include "content/browser/frame_host/frame_navigation_entry.h" -#include "content/browser/frame_host/navigation_controller_impl.h" #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/frame_host/navigation_entry_screenshot_manager.h" #include "content/browser/frame_host/navigation_request.h" @@ -2801,7 +2803,7 @@ TEST_F(NavigationControllerTest, RestoreNavigate) { entry->SetPageState(PageState::CreateFromEncodedData("state")); const base::Time timestamp = base::Time::Now(); entry->SetTimestamp(timestamp); - entries.push_back(entry.Pass()); + entries.push_back(std::move(entry)); scoped_ptr<WebContentsImpl> our_contents(static_cast<WebContentsImpl*>( WebContents::Create(WebContents::CreateParams(browser_context())))); NavigationControllerImpl& our_controller = our_contents->GetController(); @@ -2872,7 +2874,7 @@ TEST_F(NavigationControllerTest, RestoreNavigateAfterFailure) { new_entry->SetPageID(0); new_entry->SetTitle(base::ASCIIToUTF16("Title")); new_entry->SetPageState(PageState::CreateFromEncodedData("state")); - entries.push_back(new_entry.Pass()); + entries.push_back(std::move(new_entry)); scoped_ptr<WebContentsImpl> our_contents(static_cast<WebContentsImpl*>( WebContents::Create(WebContents::CreateParams(browser_context())))); NavigationControllerImpl& our_controller = our_contents->GetController(); @@ -3113,7 +3115,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Adding a transient with no pending entry. scoped_ptr<NavigationEntry> transient_entry(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); // We should not have received any notifications. EXPECT_EQ(0U, notifications.size()); @@ -3143,7 +3145,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Add a transient again, then navigate with no pending entry this time. transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->SendRendererInitiatedNavigationRequest(url3, true); main_test_rfh()->PrepareForCommit(); @@ -3158,7 +3160,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { entry_id = controller.GetPendingEntry()->GetUniqueID(); transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->PrepareForCommit(); main_test_rfh()->SendNavigate(4, entry_id, true, url4); @@ -3168,7 +3170,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Add a transient and go back. This should simply remove the transient. transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); EXPECT_TRUE(controller.CanGoBack()); EXPECT_FALSE(controller.CanGoForward()); @@ -3186,7 +3188,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Add a transient and go to an entry before the current one. transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); controller.GoToIndex(1); entry_id = controller.GetPendingEntry()->GetUniqueID(); @@ -3202,7 +3204,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Add a transient and go to an entry after the current one. transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); controller.GoToIndex(3); entry_id = controller.GetPendingEntry()->GetUniqueID(); @@ -3218,7 +3220,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Add a transient and go forward. transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); EXPECT_TRUE(controller.CanGoForward()); controller.GoForward(); @@ -3234,7 +3236,7 @@ TEST_F(NavigationControllerTest, TransientEntry) { // Add a transient and do an in-page navigation, replacing the current entry. transient_entry.reset(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); main_test_rfh()->SendRendererInitiatedNavigationRequest(url3_ref, false); @@ -3272,7 +3274,7 @@ TEST_F(NavigationControllerTest, ReloadTransient) { // A transient entry is added, interrupting the navigation. scoped_ptr<NavigationEntry> transient_entry(new NavigationEntryImpl); transient_entry->SetURL(transient_url); - controller.SetTransientEntry(transient_entry.Pass()); + controller.SetTransientEntry(std::move(transient_entry)); EXPECT_TRUE(controller.GetTransientEntry()); EXPECT_EQ(transient_url, controller.GetVisibleEntry()->GetURL()); @@ -4422,7 +4424,7 @@ TEST_F(NavigationControllerTest, CopyRestoredStateAndNavigate) { kRestoredUrls[i], Referrer(), ui::PAGE_TRANSITION_RELOAD, false, std::string(), browser_context()); entry->SetPageID(static_cast<int>(i)); - entries.push_back(entry.Pass()); + entries.push_back(std::move(entry)); } // Create a WebContents with restored entries. diff --git a/content/browser/frame_host/navigation_entry_impl.cc b/content/browser/frame_host/navigation_entry_impl.cc index bab6248..6bf6c13 100644 --- a/content/browser/frame_host/navigation_entry_impl.cc +++ b/content/browser/frame_host/navigation_entry_impl.cc @@ -129,11 +129,11 @@ NavigationEntryImpl::TreeNode::CloneAndReplace( child->CloneAndReplace(frame_tree_node, frame_navigation_entry)); } - return copy.Pass(); + return copy; } scoped_ptr<NavigationEntry> NavigationEntry::Create() { - return make_scoped_ptr(new NavigationEntryImpl()).Pass(); + return make_scoped_ptr(new NavigationEntryImpl()); } NavigationEntryImpl* NavigationEntryImpl::FromNavigationEntry( @@ -554,7 +554,7 @@ scoped_ptr<NavigationEntryImpl> NavigationEntryImpl::CloneAndReplace( // ResetForCommit: intent_received_timestamp_ copy->extra_data_ = extra_data_; - return copy.Pass(); + return copy; } CommonNavigationParams NavigationEntryImpl::ConstructCommonNavigationParams( diff --git a/content/browser/frame_host/navigation_handle_impl.cc b/content/browser/frame_host/navigation_handle_impl.cc index fa87297..743d2ea 100644 --- a/content/browser/frame_host/navigation_handle_impl.cc +++ b/content/browser/frame_host/navigation_handle_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/frame_host/navigation_handle_impl.h" +#include <utility> + #include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/navigator.h" #include "content/browser/frame_host/navigator_delegate.h" @@ -168,7 +170,7 @@ void NavigationHandleImpl::CancelDeferredNavigation( void NavigationHandleImpl::RegisterThrottleForTesting( scoped_ptr<NavigationThrottle> navigation_throttle) { - throttles_.push_back(navigation_throttle.Pass()); + throttles_.push_back(std::move(navigation_throttle)); } NavigationThrottle::ThrottleCheckResult diff --git a/content/browser/frame_host/navigation_request.cc b/content/browser/frame_host/navigation_request.cc index 027ba75..f8ab2c2 100644 --- a/content/browser/frame_host/navigation_request.cc +++ b/content/browser/frame_host/navigation_request.cc @@ -4,6 +4,8 @@ #include "content/browser/frame_host/navigation_request.h" +#include <utility> + #include "content/browser/frame_host/frame_tree.h" #include "content/browser/frame_host/frame_tree_node.h" #include "content/browser/frame_host/navigation_controller_impl.h" @@ -107,7 +109,7 @@ scoped_ptr<NavigationRequest> NavigationRequest::CreateBrowserInitiated( controller->GetLastCommittedEntryIndex(), controller->GetEntryCount()), request_body, true, &frame_entry, &entry)); - return navigation_request.Pass(); + return navigation_request; } // static @@ -143,7 +145,7 @@ scoped_ptr<NavigationRequest> NavigationRequest::CreateRendererInitiated( scoped_ptr<NavigationRequest> navigation_request( new NavigationRequest(frame_tree_node, common_params, begin_params, request_params, body, false, nullptr, nullptr)); - return navigation_request.Pass(); + return navigation_request; } NavigationRequest::NavigationRequest( @@ -228,7 +230,7 @@ void NavigationRequest::CreateNavigationHandle() { void NavigationRequest::TransferNavigationHandleOwnership( RenderFrameHostImpl* render_frame_host) { - render_frame_host->SetNavigationHandle(navigation_handle_.Pass()); + render_frame_host->SetNavigationHandle(std::move(navigation_handle_)); } void NavigationRequest::OnRequestRedirected( @@ -267,8 +269,8 @@ void NavigationRequest::OnResponseStarted( ->service_worker_provider_host_id(); } - frame_tree_node_->navigator()->CommitNavigation(frame_tree_node_, - response.get(), body.Pass()); + frame_tree_node_->navigator()->CommitNavigation( + frame_tree_node_, response.get(), std::move(body)); } void NavigationRequest::OnRequestFailed(bool has_stale_copy_in_cache, @@ -300,7 +302,7 @@ void NavigationRequest::OnStartChecksComplete( InitializeServiceWorkerHandleIfNeeded(); loader_ = NavigationURLLoader::Create( frame_tree_node_->navigator()->GetController()->GetBrowserContext(), - info_.Pass(), navigation_handle_->service_worker_handle(), this); + std::move(info_), navigation_handle_->service_worker_handle(), this); } void NavigationRequest::OnRedirectChecksComplete( diff --git a/content/browser/frame_host/navigator_impl.cc b/content/browser/frame_host/navigator_impl.cc index 5e6ba3c..6ca1f05 100644 --- a/content/browser/frame_host/navigator_impl.cc +++ b/content/browser/frame_host/navigator_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/frame_host/navigator_impl.h" +#include <utility> + #include "base/metrics/histogram.h" #include "base/time/time.h" #include "content/browser/frame_host/frame_tree.h" @@ -809,10 +811,9 @@ void NavigatorImpl::CommitNavigation(FrameTreeNode* frame_tree_node, navigation_request->TransferNavigationHandleOwnership(render_frame_host); render_frame_host->navigation_handle()->ReadyToCommitNavigation( render_frame_host, response ? response->head.headers : nullptr); - render_frame_host->CommitNavigation(response, body.Pass(), + render_frame_host->CommitNavigation(response, std::move(body), navigation_request->common_params(), navigation_request->request_params()); - } // PlzNavigate @@ -1013,7 +1014,7 @@ void NavigatorImpl::DidStartMainFrameNavigation( entry->set_should_replace_entry(pending_entry->should_replace_entry()); entry->SetRedirectChain(pending_entry->GetRedirectChain()); } - controller_->SetPendingEntry(entry.Pass()); + controller_->SetPendingEntry(std::move(entry)); if (delegate_) delegate_->NotifyChangedNavigationState(content::INVALIDATE_TYPE_URL); } diff --git a/content/browser/frame_host/render_frame_host_impl.cc b/content/browser/frame_host/render_frame_host_impl.cc index 5701ac6..e49f141 100644 --- a/content/browser/frame_host/render_frame_host_impl.cc +++ b/content/browser/frame_host/render_frame_host_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/frame_host/render_frame_host_impl.h" +#include <utility> + #include "base/bind.h" #include "base/containers/hash_tables.h" #include "base/lazy_instance.h" @@ -1067,7 +1069,7 @@ int RenderFrameHostImpl::GetEnabledBindings() { void RenderFrameHostImpl::SetNavigationHandle( scoped_ptr<NavigationHandleImpl> navigation_handle) { - navigation_handle_ = navigation_handle.Pass(); + navigation_handle_ = std::move(navigation_handle); if (navigation_handle_) navigation_handle_->set_render_frame_host(this); } @@ -1076,7 +1078,7 @@ scoped_ptr<NavigationHandleImpl> RenderFrameHostImpl::PassNavigationHandleOwnership() { DCHECK(!IsBrowserSideNavigationEnabled()); navigation_handle_->set_is_transferring(true); - return navigation_handle_.Pass(); + return std::move(navigation_handle_); } void RenderFrameHostImpl::OnCrossSiteResponse( @@ -1087,7 +1089,7 @@ void RenderFrameHostImpl::OnCrossSiteResponse( ui::PageTransition page_transition, bool should_replace_current_entry) { frame_tree_node_->render_manager()->OnCrossSiteResponse( - this, global_request_id, cross_site_transferring_request.Pass(), + this, global_request_id, std::move(cross_site_transferring_request), transfer_url_chain, referrer, page_transition, should_replace_current_entry); } @@ -2041,7 +2043,7 @@ void RenderFrameHostImpl::CommitNavigation( // TODO(clamy): Release the stream handle once the renderer has finished // reading it. - stream_handle_ = body.Pass(); + stream_handle_ = std::move(body); // When navigating to a Javascript url, no commit is expected from the // RenderFrameHost, nor should the throbber start. @@ -2087,8 +2089,8 @@ void RenderFrameHostImpl::SetUpMojoIfNeeded() { mojo::ServiceProviderPtr services; setup->ExchangeServiceProviders(routing_id_, GetProxy(&services), - exposed_services.Pass()); - service_registry_->BindRemoteServiceProvider(services.Pass()); + std::move(exposed_services)); + service_registry_->BindRemoteServiceProvider(std::move(services)); #if defined(OS_ANDROID) service_registry_android_.reset( @@ -2192,7 +2194,7 @@ void RenderFrameHostImpl::CommitPendingWebUI() { if (should_reuse_web_ui_) { should_reuse_web_ui_ = false; } else { - web_ui_ = pending_web_ui_.Pass(); + web_ui_ = std::move(pending_web_ui_); web_ui_type_ = pending_web_ui_type_; pending_web_ui_type_ = WebUI::kNoWebUI; } diff --git a/content/browser/frame_host/render_frame_host_manager.cc b/content/browser/frame_host/render_frame_host_manager.cc index d67ba0e..2f36dfb7 100644 --- a/content/browser/frame_host/render_frame_host_manager.cc +++ b/content/browser/frame_host/render_frame_host_manager.cc @@ -474,7 +474,7 @@ RenderFrameHostImpl* RenderFrameHostManager::Navigate( // NavigationHandle that came from the transferring RenderFrameHost. DCHECK(transfer_navigation_handle_); dest_render_frame_host->SetNavigationHandle( - transfer_navigation_handle_.Pass()); + std::move(transfer_navigation_handle_)); } DCHECK(!transfer_navigation_handle_); @@ -617,7 +617,7 @@ void RenderFrameHostManager::OnCrossSiteResponse( // Store the transferring request so that we can release it if the transfer // navigation matches. - cross_site_transferring_request_ = cross_site_transferring_request.Pass(); + cross_site_transferring_request_ = std::move(cross_site_transferring_request); // Store the NavigationHandle to give it to the appropriate RenderFrameHost // after it started navigating. @@ -858,7 +858,7 @@ void RenderFrameHostManager::SwapOutOldFrame( // Tell the old RenderFrameHost to swap out, with no proxy to replace it. old_render_frame_host->SwapOut(nullptr, true); - MoveToPendingDeleteHosts(old_render_frame_host.Pass()); + MoveToPendingDeleteHosts(std::move(old_render_frame_host)); return; } @@ -879,7 +879,7 @@ void RenderFrameHostManager::SwapOutOldFrame( // In --site-per-process, frames delete their RFH rather than storing it // in the proxy. Schedule it for deletion once the SwapOutACK comes in. // TODO(creis): This will be the default when we remove swappedout://. - MoveToPendingDeleteHosts(old_render_frame_host.Pass()); + MoveToPendingDeleteHosts(std::move(old_render_frame_host)); } else { // We shouldn't get here for subframes, since we only swap subframes when // --site-per-process is used. @@ -887,7 +887,7 @@ void RenderFrameHostManager::SwapOutOldFrame( // The old RenderFrameHost will stay alive inside the proxy so that existing // JavaScript window references to it stay valid. - proxy->TakeFrameHostOwnership(old_render_frame_host.Pass()); + proxy->TakeFrameHostOwnership(std::move(old_render_frame_host)); } } @@ -929,7 +929,7 @@ void RenderFrameHostManager::DiscardUnusedFrame( if (!render_frame_host->is_swapped_out()) render_frame_host->SwapOut(proxy, false); - proxy->TakeFrameHostOwnership(render_frame_host.Pass()); + proxy->TakeFrameHostOwnership(std::move(render_frame_host)); } } @@ -1141,7 +1141,7 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::UnsetSpeculativeRenderFrameHost() { CHECK(IsBrowserSideNavigationEnabled()); speculative_render_frame_host_->GetProcess()->RemovePendingView(); - return speculative_render_frame_host_.Pass(); + return std::move(speculative_render_frame_host_); } void RenderFrameHostManager::OnDidStartLoading() { @@ -1219,7 +1219,8 @@ bool RenderFrameHostManager::ClearProxiesInSiteInstance( DCHECK(!SiteIsolationPolicy::IsSwappedOutStateForbidden()); scoped_ptr<RenderFrameHostImpl> swapped_out_rfh = proxy->PassFrameHostOwnership(); - node->render_manager()->MoveToPendingDeleteHosts(swapped_out_rfh.Pass()); + node->render_manager()->MoveToPendingDeleteHosts( + std::move(swapped_out_rfh)); } node->render_manager()->proxy_hosts_->Remove(site_instance_id); } @@ -1880,7 +1881,7 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( new_render_frame_host->GetSiteInstance(), new_render_frame_host->render_view_host(), frame_tree_node_); proxy_hosts_->Add(instance->GetId(), make_scoped_ptr(proxy)); - proxy->TakeFrameHostOwnership(new_render_frame_host.Pass()); + proxy->TakeFrameHostOwnership(std::move(new_render_frame_host)); } if (frame_tree_node_->IsMainFrame()) { @@ -1923,7 +1924,7 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::CreateRenderFrame( // Returns the new RFH if it isn't swapped out. if (success && !swapped_out) { DCHECK(new_render_frame_host->GetSiteInstance() == instance); - return new_render_frame_host.Pass(); + return new_render_frame_host; } return nullptr; } @@ -2171,12 +2172,12 @@ void RenderFrameHostManager::CommitPending() { if (!IsBrowserSideNavigationEnabled()) { DCHECK(!speculative_render_frame_host_); old_render_frame_host = - SetRenderFrameHost(pending_render_frame_host_.Pass()); + SetRenderFrameHost(std::move(pending_render_frame_host_)); } else { // PlzNavigate DCHECK(speculative_render_frame_host_); old_render_frame_host = - SetRenderFrameHost(speculative_render_frame_host_.Pass()); + SetRenderFrameHost(std::move(speculative_render_frame_host_)); } // The process will no longer try to exit, so we can decrement the count. @@ -2244,7 +2245,7 @@ void RenderFrameHostManager::CommitPending() { // out ack arrives (or immediately if the process isn't live). // In the --site-per-process case, old subframe RFHs are not kept alive inside // the proxy. - SwapOutOldFrame(old_render_frame_host.Pass()); + SwapOutOldFrame(std::move(old_render_frame_host)); if (SiteIsolationPolicy::IsSwappedOutStateForbidden()) { // Since the new RenderFrameHost is now committed, there must be no proxies @@ -2490,7 +2491,7 @@ void RenderFrameHostManager::CancelPending() { scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::UnsetPendingRenderFrameHost() { scoped_ptr<RenderFrameHostImpl> pending_render_frame_host = - pending_render_frame_host_.Pass(); + std::move(pending_render_frame_host_); RenderFrameDevToolsAgentHost::OnCancelPendingNavigation( pending_render_frame_host.get(), @@ -2499,15 +2500,15 @@ RenderFrameHostManager::UnsetPendingRenderFrameHost() { // We no longer need to prevent the process from exiting. pending_render_frame_host->GetProcess()->RemovePendingView(); - return pending_render_frame_host.Pass(); + return pending_render_frame_host; } scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::SetRenderFrameHost( scoped_ptr<RenderFrameHostImpl> render_frame_host) { // Swap the two. scoped_ptr<RenderFrameHostImpl> old_render_frame_host = - render_frame_host_.Pass(); - render_frame_host_ = render_frame_host.Pass(); + std::move(render_frame_host_); + render_frame_host_ = std::move(render_frame_host); if (frame_tree_node_->IsMainFrame()) { // Update the count of top-level frames using this SiteInstance. All @@ -2524,7 +2525,7 @@ scoped_ptr<RenderFrameHostImpl> RenderFrameHostManager::SetRenderFrameHost( } } - return old_render_frame_host.Pass(); + return old_render_frame_host; } bool RenderFrameHostManager::IsRVHOnSwappedOutList( diff --git a/content/browser/frame_host/render_frame_host_manager_unittest.cc b/content/browser/frame_host/render_frame_host_manager_unittest.cc index b6e72e9..d633aca 100644 --- a/content/browser/frame_host/render_frame_host_manager_unittest.cc +++ b/content/browser/frame_host/render_frame_host_manager_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/frame_host/render_frame_host_manager.h" + #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "base/files/file_path.h" @@ -17,7 +20,6 @@ #include "content/browser/frame_host/navigation_entry_impl.h" #include "content/browser/frame_host/navigation_request.h" #include "content/browser/frame_host/navigator.h" -#include "content/browser/frame_host/render_frame_host_manager.h" #include "content/browser/frame_host/render_frame_proxy_host.h" #include "content/browser/site_instance_impl.h" #include "content/browser/webui/web_ui_controller_factory_registry.h" @@ -2750,7 +2752,7 @@ TEST_F(RenderFrameHostManagerTest, RestoreNavigationToWebUI) { kInitUrl, Referrer(), ui::PAGE_TRANSITION_TYPED, false, std::string(), browser_context()); new_entry->SetPageID(0); - entries.push_back(new_entry.Pass()); + entries.push_back(std::move(new_entry)); controller.Restore( 0, NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, &entries); ASSERT_EQ(0u, entries.size()); diff --git a/content/browser/frame_host/render_frame_proxy_host.cc b/content/browser/frame_host/render_frame_proxy_host.cc index ac53e5a..49bcfc9 100644 --- a/content/browser/frame_host/render_frame_proxy_host.cc +++ b/content/browser/frame_host/render_frame_proxy_host.cc @@ -4,6 +4,8 @@ #include "content/browser/frame_host/render_frame_proxy_host.h" +#include <utility> + #include "base/lazy_instance.h" #include "content/browser/bad_message.h" #include "content/browser/frame_host/cross_process_frame_connector.h" @@ -122,13 +124,13 @@ RenderWidgetHostView* RenderFrameProxyHost::GetRenderWidgetHostView() { void RenderFrameProxyHost::TakeFrameHostOwnership( scoped_ptr<RenderFrameHostImpl> render_frame_host) { CHECK(render_frame_host_ == nullptr); - render_frame_host_ = render_frame_host.Pass(); + render_frame_host_ = std::move(render_frame_host); render_frame_host_->set_render_frame_proxy_host(this); } scoped_ptr<RenderFrameHostImpl> RenderFrameProxyHost::PassFrameHostOwnership() { render_frame_host_->set_render_frame_proxy_host(NULL); - return render_frame_host_.Pass(); + return std::move(render_frame_host_); } bool RenderFrameProxyHost::Send(IPC::Message *msg) { diff --git a/content/browser/frame_host/render_widget_host_view_child_frame.cc b/content/browser/frame_host/render_widget_host_view_child_frame.cc index f5760a6..be10946 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame.cc @@ -5,6 +5,7 @@ #include "content/browser/frame_host/render_widget_host_view_child_frame.h" #include <algorithm> +#include <utility> #include <vector> #include "build/build_config.h" @@ -267,10 +268,8 @@ void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( // the embedder's renderer to be composited. if (!frame->delegated_frame_data || !use_surfaces_) { frame_connector_->ChildFrameCompositorFrameSwapped( - output_surface_id, - host_->GetProcess()->GetID(), - host_->GetRoutingID(), - frame.Pass()); + output_surface_id, host_->GetProcess()->GetID(), host_->GetRoutingID(), + std::move(frame)); return; } @@ -320,7 +319,7 @@ void RenderWidgetHostViewChildFrame::OnSwapCompositorFrame( ack_pending_count_++; // If this value grows very large, something is going wrong. DCHECK_LT(ack_pending_count_, 1000U); - surface_factory_->SubmitCompositorFrame(surface_id_, frame.Pass(), + surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), ack_callback); } diff --git a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc index c1f23da..fbf418b 100644 --- a/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc +++ b/content/browser/frame_host/render_widget_host_view_child_frame_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/frame_host/render_widget_host_view_child_frame.h" #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/message_loop/message_loop.h" @@ -142,7 +143,7 @@ scoped_ptr<cc::CompositorFrame> CreateDelegatedFrame(float scale_factor, scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); pass->SetNew(cc::RenderPassId(1, 1), gfx::Rect(size), damage, gfx::Transform()); - frame->delegated_frame_data->render_pass_list.push_back(pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back(std::move(pass)); return frame; } diff --git a/content/browser/frame_host/render_widget_host_view_guest.cc b/content/browser/frame_host/render_widget_host_view_guest.cc index 48a6284..6d4a181 100644 --- a/content/browser/frame_host/render_widget_host_view_guest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest.cc @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/frame_host/render_widget_host_view_guest.h" + +#include <utility> + #include "base/bind_helpers.h" #include "base/command_line.h" #include "base/logging.h" @@ -13,7 +17,6 @@ #include "cc/surfaces/surface_sequence.h" #include "content/browser/browser_plugin/browser_plugin_guest.h" #include "content/browser/compositor/surface_utils.h" -#include "content/browser/frame_host/render_widget_host_view_guest.h" #include "content/browser/renderer_host/render_view_host_impl.h" #include "content/browser/renderer_host/render_widget_host_delegate.h" #include "content/browser/renderer_host/render_widget_host_input_event_router.h" @@ -241,10 +244,8 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame( // When not using surfaces, the frame just gets proxied to // the embedder's renderer to be composited. if (!frame->delegated_frame_data || !use_surfaces_) { - guest_->SwapCompositorFrame(output_surface_id, - host_->GetProcess()->GetID(), - host_->GetRoutingID(), - frame.Pass()); + guest_->SwapCompositorFrame(output_surface_id, host_->GetProcess()->GetID(), + host_->GetRoutingID(), std::move(frame)); return; } @@ -295,7 +296,7 @@ void RenderWidgetHostViewGuest::OnSwapCompositorFrame( ack_pending_count_++; // If this value grows very large, something is going wrong. DCHECK(ack_pending_count_ < 1000); - surface_factory_->SubmitCompositorFrame(surface_id_, frame.Pass(), + surface_factory_->SubmitCompositorFrame(surface_id_, std::move(frame), ack_callback); } diff --git a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc index 52288b3..119eb38 100644 --- a/content/browser/frame_host/render_widget_host_view_guest_unittest.cc +++ b/content/browser/frame_host/render_widget_host_view_guest_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/frame_host/render_widget_host_view_guest.h" #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/message_loop/message_loop.h" @@ -139,7 +140,7 @@ class TestBrowserPluginGuest : public BrowserPluginGuest { // Call base-class version so that we can test UpdateGuestSizeIfNecessary(). BrowserPluginGuest::SwapCompositorFrame(output_surface_id, host_process_id, - host_routing_id, frame.Pass()); + host_routing_id, std::move(frame)); } void SetChildFrameSurface(const cc::SurfaceId& surface_id, @@ -239,7 +240,7 @@ scoped_ptr<cc::CompositorFrame> CreateDelegatedFrame(float scale_factor, scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); pass->SetNew(cc::RenderPassId(1, 1), gfx::Rect(size), damage, gfx::Transform()); - frame->delegated_frame_data->render_pass_list.push_back(pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back(std::move(pass)); return frame; } } // anonymous namespace diff --git a/content/browser/gamepad/gamepad_provider.cc b/content/browser/gamepad/gamepad_provider.cc index 438fcea..682afc5 100644 --- a/content/browser/gamepad/gamepad_provider.cc +++ b/content/browser/gamepad/gamepad_provider.cc @@ -2,11 +2,13 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/gamepad/gamepad_provider.h" + #include <stddef.h> #include <string.h> - #include <cmath> #include <set> +#include <utility> #include <vector> #include "base/bind.h" @@ -20,7 +22,6 @@ #include "build/build_config.h" #include "content/browser/gamepad/gamepad_data_fetcher.h" #include "content/browser/gamepad/gamepad_platform_data_fetcher.h" -#include "content/browser/gamepad/gamepad_provider.h" #include "content/browser/gamepad/gamepad_service.h" #include "content/common/gamepad_hardware_buffer.h" #include "content/common/gamepad_messages.h" @@ -54,7 +55,7 @@ GamepadProvider::GamepadProvider(scoped_ptr<GamepadDataFetcher> fetcher) have_scheduled_do_poll_(false), devices_changed_(true), ever_had_user_gesture_(false) { - Initialize(fetcher.Pass()); + Initialize(std::move(fetcher)); } GamepadProvider::~GamepadProvider() { @@ -160,7 +161,7 @@ void GamepadProvider::DoInitializePollingThread( if (!fetcher) fetcher.reset(new GamepadPlatformDataFetcher); - data_fetcher_ = fetcher.Pass(); + data_fetcher_ = std::move(fetcher); } void GamepadProvider::SendPauseHint(bool paused) { diff --git a/content/browser/gamepad/gamepad_service.cc b/content/browser/gamepad/gamepad_service.cc index 67930f6..411ae01 100644 --- a/content/browser/gamepad/gamepad_service.cc +++ b/content/browser/gamepad/gamepad_service.cc @@ -4,6 +4,8 @@ #include "content/browser/gamepad/gamepad_service.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/memory/singleton.h" @@ -26,7 +28,7 @@ GamepadService::GamepadService() } GamepadService::GamepadService(scoped_ptr<GamepadDataFetcher> fetcher) - : provider_(new GamepadProvider(fetcher.Pass())), + : provider_(new GamepadProvider(std::move(fetcher))), num_active_consumers_(0), gesture_callback_pending_(false) { SetInstance(this); diff --git a/content/browser/geofencing/geofencing_service.cc b/content/browser/geofencing/geofencing_service.cc index 1edb605..9f429d5 100644 --- a/content/browser/geofencing/geofencing_service.cc +++ b/content/browser/geofencing/geofencing_service.cc @@ -4,6 +4,8 @@ #include "content/browser/geofencing/geofencing_service.h" +#include <utility> + #include "base/location.h" #include "base/memory/singleton.h" #include "base/single_thread_task_runner.h" @@ -140,7 +142,7 @@ void GeofencingServiceImpl::UnregisterRegion( void GeofencingServiceImpl::SetProviderForTesting( scoped_ptr<GeofencingProvider> provider) { DCHECK(!provider_.get()); - provider_ = provider.Pass(); + provider_ = std::move(provider); } int GeofencingServiceImpl::RegistrationCountForTesting() { diff --git a/content/browser/geolocation/geolocation_provider_impl.cc b/content/browser/geolocation/geolocation_provider_impl.cc index fc792f2..60d9efb 100644 --- a/content/browser/geolocation/geolocation_provider_impl.cc +++ b/content/browser/geolocation/geolocation_provider_impl.cc @@ -37,7 +37,7 @@ GeolocationProviderImpl::AddLocationUpdateCallback( callback.Run(position_); } - return subscription.Pass(); + return subscription; } void GeolocationProviderImpl::UserDidOptIntoLocationServices() { diff --git a/content/browser/geolocation/geolocation_service_context.cc b/content/browser/geolocation/geolocation_service_context.cc index 7a25023..7cdeb35 100644 --- a/content/browser/geolocation/geolocation_service_context.cc +++ b/content/browser/geolocation/geolocation_service_context.cc @@ -4,6 +4,8 @@ #include "content/browser/geolocation/geolocation_service_context.h" +#include <utility> + namespace content { GeolocationServiceContext::GeolocationServiceContext() : paused_(false) { @@ -16,7 +18,7 @@ void GeolocationServiceContext::CreateService( const base::Closure& update_callback, mojo::InterfaceRequest<GeolocationService> request) { GeolocationServiceImpl* service = - new GeolocationServiceImpl(request.Pass(), this, update_callback); + new GeolocationServiceImpl(std::move(request), this, update_callback); services_.push_back(service); if (geoposition_override_) service->SetOverride(*geoposition_override_.get()); diff --git a/content/browser/geolocation/geolocation_service_impl.cc b/content/browser/geolocation/geolocation_service_impl.cc index aae95ac..764ff10 100644 --- a/content/browser/geolocation/geolocation_service_impl.cc +++ b/content/browser/geolocation/geolocation_service_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/geolocation/geolocation_service_impl.h" +#include <utility> + #include "base/bind.h" #include "base/metrics/histogram.h" #include "content/browser/geolocation/geolocation_service_context.h" @@ -62,7 +64,7 @@ GeolocationServiceImpl::GeolocationServiceImpl( mojo::InterfaceRequest<GeolocationService> request, GeolocationServiceContext* context, const base::Closure& update_callback) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), context_(context), update_callback_(update_callback), high_accuracy_(false), diff --git a/content/browser/geolocation/wifi_data_provider_linux.cc b/content/browser/geolocation/wifi_data_provider_linux.cc index a8fad4a..7ec01b6 100644 --- a/content/browser/geolocation/wifi_data_provider_linux.cc +++ b/content/browser/geolocation/wifi_data_provider_linux.cc @@ -343,7 +343,7 @@ scoped_ptr<dbus::Response> NetworkManagerWlanApi::GetAccessPointProperty( if (!response) { LOG(WARNING) << "Failed to get property for " << property_name; } - return response.Pass(); + return response; } } // namespace diff --git a/content/browser/gpu/browser_gpu_channel_host_factory.cc b/content/browser/gpu/browser_gpu_channel_host_factory.cc index e8b084a..f432608 100644 --- a/content/browser/gpu/browser_gpu_channel_host_factory.cc +++ b/content/browser/gpu/browser_gpu_channel_host_factory.cc @@ -288,7 +288,7 @@ BrowserGpuChannelHostFactory::AllocateSharedMemory(size_t size) { scoped_ptr<base::SharedMemory> shm(new base::SharedMemory()); if (!shm->CreateAnonymous(size)) return scoped_ptr<base::SharedMemory>(); - return shm.Pass(); + return shm; } void BrowserGpuChannelHostFactory::CreateViewCommandBufferOnIO( diff --git a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc index fe62549..d9c25c9 100644 --- a/content/browser/gpu/browser_gpu_memory_buffer_manager.cc +++ b/content/browser/gpu/browser_gpu_memory_buffer_manager.cc @@ -4,6 +4,8 @@ #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/strings/stringprintf.h" @@ -286,7 +288,7 @@ BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle( "BrowserGpuMemoryBufferManager::CreateGpuMemoryBufferFromHandle"); base::ThreadRestrictions::ScopedAllowWait allow_wait; request.event.Wait(); - return request.result.Pass(); + return std::move(request.result); } scoped_ptr<gfx::GpuMemoryBuffer> @@ -460,7 +462,7 @@ BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForSurface( "BrowserGpuMemoryBufferManager::AllocateGpuMemoryBufferForSurface"); base::ThreadRestrictions::ScopedAllowWait allow_wait; request.event.Wait(); - return request.result.Pass(); + return std::move(request.result); } void BrowserGpuMemoryBufferManager::HandleCreateGpuMemoryBufferOnIO( diff --git a/content/browser/host_zoom_level_context.cc b/content/browser/host_zoom_level_context.cc index 02ddcf5..56f848db 100644 --- a/content/browser/host_zoom_level_context.cc +++ b/content/browser/host_zoom_level_context.cc @@ -4,6 +4,8 @@ #include "content/browser/host_zoom_level_context.h" +#include <utility> + #include "base/files/file_path.h" #include "content/browser/host_zoom_map_impl.h" #include "content/public/browser/browser_thread.h" @@ -13,7 +15,7 @@ namespace content { HostZoomLevelContext::HostZoomLevelContext( scoped_ptr<ZoomLevelDelegate> zoom_level_delegate) : host_zoom_map_impl_(new HostZoomMapImpl()), - zoom_level_delegate_(zoom_level_delegate.Pass()) { + zoom_level_delegate_(std::move(zoom_level_delegate)) { if (zoom_level_delegate_) zoom_level_delegate_->InitHostZoomMap(host_zoom_map_impl_.get()); } diff --git a/content/browser/indexed_db/indexed_db_backing_store.cc b/content/browser/indexed_db/indexed_db_backing_store.cc index 5897025..e3816d4 100644 --- a/content/browser/indexed_db/indexed_db_backing_store.cc +++ b/content/browser/indexed_db/indexed_db_backing_store.cc @@ -5,6 +5,7 @@ #include "content/browser/indexed_db/indexed_db_backing_store.h" #include <algorithm> +#include <utility> #include "base/files/file_path.h" #include "base/files/file_util.h" @@ -767,11 +768,10 @@ IndexedDBBackingStore::IndexedDBBackingStore( origin_identifier_(ComputeOriginIdentifier(origin_url)), request_context_(request_context), task_runner_(task_runner), - db_(db.Pass()), - comparator_(comparator.Pass()), + db_(std::move(db)), + comparator_(std::move(comparator)), active_blob_registry_(this), - committing_transaction_count_(0) { -} + committing_transaction_count_(0) {} IndexedDBBackingStore::~IndexedDBBackingStore() { if (!blob_path_.empty() && !child_process_ids_granted_.empty()) { @@ -1106,14 +1106,8 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Open( } scoped_refptr<IndexedDBBackingStore> backing_store = - Create(indexed_db_factory, - origin_url, - blob_path, - request_context, - db.Pass(), - comparator.Pass(), - task_runner, - status); + Create(indexed_db_factory, origin_url, blob_path, request_context, + std::move(db), std::move(comparator), task_runner, status); if (clean_journal && backing_store.get()) { *status = backing_store->CleanUpBlobJournal(LiveBlobJournalKey::Encode()); @@ -1156,14 +1150,9 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::OpenInMemory( } HistogramOpenStatus(INDEXED_DB_BACKING_STORE_OPEN_MEMORY_SUCCESS, origin_url); - return Create(NULL /* indexed_db_factory */, - origin_url, - base::FilePath(), - NULL /* request_context */, - db.Pass(), - comparator.Pass(), - task_runner, - status); + return Create(NULL /* indexed_db_factory */, origin_url, base::FilePath(), + NULL /* request_context */, std::move(db), + std::move(comparator), task_runner, status); } // static @@ -1177,14 +1166,9 @@ scoped_refptr<IndexedDBBackingStore> IndexedDBBackingStore::Create( base::SequencedTaskRunner* task_runner, leveldb::Status* status) { // TODO(jsbell): Handle comparator name changes. - scoped_refptr<IndexedDBBackingStore> backing_store( - new IndexedDBBackingStore(indexed_db_factory, - origin_url, - blob_path, - request_context, - db.Pass(), - comparator.Pass(), - task_runner)); + scoped_refptr<IndexedDBBackingStore> backing_store(new IndexedDBBackingStore( + indexed_db_factory, origin_url, blob_path, request_context, std::move(db), + std::move(comparator), task_runner)); *status = backing_store->SetUpMetadata(); if (!status->ok()) return scoped_refptr<IndexedDBBackingStore>(); @@ -2388,7 +2372,7 @@ class LocalWriteClosure : public FileWriterDelegate::DelegateWriteCallback, 0, storage::FileStreamWriter::CREATE_NEW_FILE)); scoped_ptr<FileWriterDelegate> delegate(new FileWriterDelegate( - writer.Pass(), storage::FlushPolicy::FLUSH_ON_COMPLETION)); + std::move(writer), storage::FlushPolicy::FLUSH_ON_COMPLETION)); DCHECK(blob_url.is_valid()); scoped_ptr<net::URLRequest> blob_request(request_context->CreateRequest( @@ -2397,9 +2381,9 @@ class LocalWriteClosure : public FileWriterDelegate::DelegateWriteCallback, this->file_path_ = file_path; this->last_modified_ = last_modified; - delegate->Start(blob_request.Pass(), + delegate->Start(std::move(blob_request), base::Bind(&LocalWriteClosure::Run, this)); - chained_blob_writer_->set_delegate(delegate.Pass()); + chained_blob_writer_->set_delegate(std::move(delegate)); } private: @@ -3965,7 +3949,7 @@ IndexedDBBackingStore::OpenObjectStoreCursor( if (!cursor->FirstSeek(s)) return scoped_ptr<IndexedDBBackingStore::Cursor>(); - return cursor.Pass(); + return std::move(cursor); } scoped_ptr<IndexedDBBackingStore::Cursor> @@ -3992,7 +3976,7 @@ IndexedDBBackingStore::OpenObjectStoreKeyCursor( if (!cursor->FirstSeek(s)) return scoped_ptr<IndexedDBBackingStore::Cursor>(); - return cursor.Pass(); + return std::move(cursor); } scoped_ptr<IndexedDBBackingStore::Cursor> @@ -4021,7 +4005,7 @@ IndexedDBBackingStore::OpenIndexKeyCursor( if (!cursor->FirstSeek(s)) return scoped_ptr<IndexedDBBackingStore::Cursor>(); - return cursor.Pass(); + return std::move(cursor); } scoped_ptr<IndexedDBBackingStore::Cursor> @@ -4049,7 +4033,7 @@ IndexedDBBackingStore::OpenIndexCursor( if (!cursor->FirstSeek(s)) return scoped_ptr<IndexedDBBackingStore::Cursor>(); - return cursor.Pass(); + return std::move(cursor); } IndexedDBBackingStore::Transaction::Transaction( @@ -4431,7 +4415,7 @@ IndexedDBBackingStore::BlobChangeRecord::Clone() const { for (const auto* handle : handles_) record->handles_.push_back(new storage::BlobDataHandle(*handle)); - return record.Pass(); + return record; } leveldb::Status IndexedDBBackingStore::Transaction::PutBlobInfoIfNeeded( diff --git a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc index ce04ded..93d281e 100644 --- a/content/browser/indexed_db/indexed_db_backing_store_unittest.cc +++ b/content/browser/indexed_db/indexed_db_backing_store_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/callback.h" #include "base/files/file_util.h" @@ -92,13 +93,9 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore { return scoped_refptr<TestableIndexedDBBackingStore>(); scoped_refptr<TestableIndexedDBBackingStore> backing_store( - new TestableIndexedDBBackingStore(indexed_db_factory, - origin_url, - blob_path, - request_context, - db.Pass(), - comparator.Pass(), - task_runner)); + new TestableIndexedDBBackingStore( + indexed_db_factory, origin_url, blob_path, request_context, + std::move(db), std::move(comparator), task_runner)); *status = backing_store->SetUpMetadata(); if (!status->ok()) @@ -165,8 +162,8 @@ class TestableIndexedDBBackingStore : public IndexedDBBackingStore { origin_url, blob_path, request_context, - db.Pass(), - comparator.Pass(), + std::move(db), + std::move(comparator), task_runner), database_id_(0) {} diff --git a/content/browser/indexed_db/indexed_db_browsertest.cc b/content/browser/indexed_db/indexed_db_browsertest.cc index 171753e..e659d96 100644 --- a/content/browser/indexed_db/indexed_db_browsertest.cc +++ b/content/browser/indexed_db/indexed_db_browsertest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -612,7 +613,7 @@ static scoped_ptr<net::test_server::HttpResponse> CorruptDBRequestHandler( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_OK); - return http_response.Pass(); + return std::move(http_response); } else if (request_path == "fail" && !request_query.empty()) { FailClass failure_class = FAIL_CLASS_NOTHING; FailMethod failure_method = FAIL_METHOD_NOTHING; @@ -676,7 +677,7 @@ static scoped_ptr<net::test_server::HttpResponse> CorruptDBRequestHandler( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_OK); - return http_response.Pass(); + return std::move(http_response); } // A request for a test resource @@ -689,7 +690,7 @@ static scoped_ptr<net::test_server::HttpResponse> CorruptDBRequestHandler( if (!base::ReadFileToString(resource_path, &file_contents)) return scoped_ptr<net::test_server::HttpResponse>(); http_response->set_content(file_contents); - return http_response.Pass(); + return std::move(http_response); } } // namespace diff --git a/content/browser/indexed_db/indexed_db_class_factory.cc b/content/browser/indexed_db/indexed_db_class_factory.cc index fa20e62..6a31469 100644 --- a/content/browser/indexed_db/indexed_db_class_factory.cc +++ b/content/browser/indexed_db/indexed_db_class_factory.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "content/browser/indexed_db/indexed_db_class_factory.h" + +#include <utility> + #include "content/browser/indexed_db/indexed_db_transaction.h" #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" @@ -50,7 +53,7 @@ LevelDBTransaction* IndexedDBClassFactory::CreateLevelDBTransaction( content::LevelDBIteratorImpl* IndexedDBClassFactory::CreateIteratorImpl( scoped_ptr<leveldb::Iterator> iterator) { - return new LevelDBIteratorImpl(iterator.Pass()); + return new LevelDBIteratorImpl(std::move(iterator)); } } // namespace content diff --git a/content/browser/indexed_db/indexed_db_cursor.cc b/content/browser/indexed_db/indexed_db_cursor.cc index 5e3a96a..05e788c 100644 --- a/content/browser/indexed_db/indexed_db_cursor.cc +++ b/content/browser/indexed_db/indexed_db_cursor.cc @@ -5,7 +5,7 @@ #include "content/browser/indexed_db/indexed_db_cursor.h" #include <stddef.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -26,7 +26,7 @@ IndexedDBCursor::IndexedDBCursor( : task_type_(task_type), cursor_type_(cursor_type), transaction_(transaction), - cursor_(cursor.Pass()), + cursor_(std::move(cursor)), closed_(false) { transaction_->RegisterOpenCursor(this); } diff --git a/content/browser/indexed_db/indexed_db_database.cc b/content/browser/indexed_db/indexed_db_database.cc index 60021d6..3196cd1 100644 --- a/content/browser/indexed_db/indexed_db_database.cc +++ b/content/browser/indexed_db/indexed_db_database.cc @@ -7,6 +7,7 @@ #include <math.h> #include <limits> #include <set> +#include <utility> #include "base/auto_reset.h" #include "base/logging.h" @@ -79,13 +80,13 @@ class IndexedDBDatabase::PendingUpgradeCall { int64_t transaction_id, int64_t version) : callbacks_(callbacks), - connection_(connection.Pass()), + connection_(std::move(connection)), version_(version), transaction_id_(transaction_id) {} scoped_refptr<IndexedDBCallbacks> callbacks() const { return callbacks_; } // Takes ownership of the connection object. scoped_ptr<IndexedDBConnection> ReleaseConnection() WARN_UNUSED_RESULT { - return connection_.Pass(); + return std::move(connection_); } int64_t version() const { return version_; } int64_t transaction_id() const { return transaction_id_; } @@ -240,7 +241,7 @@ scoped_ptr<IndexedDBConnection> IndexedDBDatabase::CreateConnection( new IndexedDBConnection(this, database_callbacks)); connections_.insert(connection.get()); backing_store_->GrantChildProcessPermissions(child_process_id); - return connection.Pass(); + return connection; } IndexedDBTransaction* IndexedDBDatabase::GetTransaction( @@ -951,7 +952,7 @@ void IndexedDBDatabase::Put(int64_t transaction_id, params->object_store_id = object_store_id; params->value.swap(*value); params->handles.swap(*handles); - params->key = key.Pass(); + params->key = std::move(key); params->put_mode = put_mode; params->callbacks = callbacks; params->index_keys = index_keys; @@ -983,9 +984,9 @@ void IndexedDBDatabase::PutOperation(scoped_ptr<PutOperationParams> params, "Maximum key generator value reached.")); return; } - key = auto_inc_key.Pass(); + key = std::move(auto_inc_key); } else { - key = params->key.Pass(); + key = std::move(params->key); } DCHECK(key->IsValid()); @@ -1233,7 +1234,7 @@ void IndexedDBDatabase::OpenCursor( scoped_ptr<OpenCursorOperationParams> params(new OpenCursorOperationParams()); params->object_store_id = object_store_id; params->index_id = index_id; - params->key_range = key_range.Pass(); + params->key_range = std::move(key_range); params->direction = direction; params->cursor_type = key_only ? indexed_db::CURSOR_KEY_ONLY : indexed_db::CURSOR_KEY_AND_VALUE; @@ -1317,10 +1318,8 @@ void IndexedDBDatabase::OpenCursorOperation( } scoped_refptr<IndexedDBCursor> cursor = - new IndexedDBCursor(backing_store_cursor.Pass(), - params->cursor_type, - params->task_type, - transaction); + new IndexedDBCursor(std::move(backing_store_cursor), params->cursor_type, + params->task_type, transaction); params->callbacks->OnSuccess( cursor, cursor->key(), cursor->primary_key(), cursor->Value()); } @@ -1548,7 +1547,7 @@ void IndexedDBDatabase::VersionChangeOperation( DCHECK(!pending_second_half_open_); pending_second_half_open_.reset( new PendingSuccessCall(callbacks, connection.get(), version)); - callbacks->OnUpgradeNeeded(old_version, connection.Pass(), metadata()); + callbacks->OnUpgradeNeeded(old_version, std::move(connection), metadata()); } void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, @@ -1566,7 +1565,7 @@ void IndexedDBDatabase::TransactionFinished(IndexedDBTransaction* transaction, // Connection was already minted for OnUpgradeNeeded callback. scoped_ptr<IndexedDBConnection> connection; - pending_second_half_open_->callbacks()->OnSuccess(connection.Pass(), + pending_second_half_open_->callbacks()->OnSuccess(std::move(connection), this->metadata()); } else { pending_second_half_open_->callbacks()->OnError( @@ -1619,7 +1618,7 @@ void IndexedDBDatabase::ProcessPendingCalls() { DCHECK(pending_run_version_change_transaction_call_->version() > metadata_.int_version); scoped_ptr<PendingUpgradeCall> pending_call = - pending_run_version_change_transaction_call_.Pass(); + std::move(pending_run_version_change_transaction_call_); RunVersionChangeTransactionFinal(pending_call->callbacks(), pending_call->ReleaseConnection(), pending_call->transaction_id(), @@ -1819,11 +1818,11 @@ void IndexedDBDatabase::RunVersionChangeTransaction( DCHECK(!pending_run_version_change_transaction_call_); pending_run_version_change_transaction_call_.reset(new PendingUpgradeCall( - callbacks, connection.Pass(), transaction_id, requested_version)); + callbacks, std::move(connection), transaction_id, requested_version)); return; } - RunVersionChangeTransactionFinal( - callbacks, connection.Pass(), transaction_id, requested_version); + RunVersionChangeTransactionFinal(callbacks, std::move(connection), + transaction_id, requested_version); } void IndexedDBDatabase::RunVersionChangeTransactionFinal( diff --git a/content/browser/indexed_db/indexed_db_database_unittest.cc b/content/browser/indexed_db/indexed_db_database_unittest.cc index 4987882..a837945 100644 --- a/content/browser/indexed_db/indexed_db_database_unittest.cc +++ b/content/browser/indexed_db/indexed_db_database_unittest.cc @@ -5,8 +5,8 @@ #include "content/browser/indexed_db/indexed_db_database.h" #include <stdint.h> - #include <set> +#include <utility> #include "base/auto_reset.h" #include "base/logging.h" @@ -396,14 +396,8 @@ TEST_F(IndexedDBDatabaseOperationTest, CreatePutDelete) { std::vector<IndexedDBDatabase::IndexKeys> index_keys; scoped_refptr<MockIndexedDBCallbacks> request( new MockIndexedDBCallbacks(false)); - db_->Put(transaction_->id(), - store_id, - &value, - &handles, - key.Pass(), - blink::WebIDBPutModeAddOnly, - request, - index_keys); + db_->Put(transaction_->id(), store_id, &value, &handles, std::move(key), + blink::WebIDBPutModeAddOnly, request, index_keys); // Deletion is asynchronous. db_->DeleteObjectStore(transaction_->id(), diff --git a/content/browser/indexed_db/indexed_db_factory_unittest.cc b/content/browser/indexed_db/indexed_db_factory_unittest.cc index c971431..1dcaecc 100644 --- a/content/browser/indexed_db/indexed_db_factory_unittest.cc +++ b/content/browser/indexed_db/indexed_db_factory_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -449,7 +450,7 @@ class UpgradeNeededCallbacks : public MockIndexedDBCallbacks { int64_t old_version, scoped_ptr<IndexedDBConnection> connection, const content::IndexedDBDatabaseMetadata& metadata) override { - connection_ = connection.Pass(); + connection_ = std::move(connection); } protected: diff --git a/content/browser/indexed_db/indexed_db_index_writer.cc b/content/browser/indexed_db/indexed_db_index_writer.cc index 6378c9b..79e0252 100644 --- a/content/browser/indexed_db/indexed_db_index_writer.cc +++ b/content/browser/indexed_db/indexed_db_index_writer.cc @@ -5,6 +5,7 @@ #include "content/browser/indexed_db/indexed_db_index_writer.h" #include <stddef.h> +#include <utility> #include "base/logging.h" #include "base/strings/utf_string_conversions.h" @@ -162,7 +163,7 @@ bool MakeIndexWriters( if (!can_add_keys) return true; - index_writers->push_back(index_writer.Pass()); + index_writers->push_back(std::move(index_writer)); } *completed = true; diff --git a/content/browser/indexed_db/indexed_db_internals_ui.cc b/content/browser/indexed_db/indexed_db_internals_ui.cc index 5b4d5d9..1e89260 100644 --- a/content/browser/indexed_db/indexed_db_internals_ui.cc +++ b/content/browser/indexed_db/indexed_db_internals_ui.cc @@ -5,6 +5,7 @@ #include "content/browser/indexed_db/indexed_db_internals_ui.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/files/scoped_temp_dir.h" @@ -312,7 +313,7 @@ void IndexedDBInternalsUI::OnDownloadDataReady( origin_url, temp_path, connection_count)); - dlm->DownloadUrl(dl_params.Pass()); + dlm->DownloadUrl(std::move(dl_params)); } // The entire purpose of this class is to delete the temp file after diff --git a/content/browser/indexed_db/indexed_db_leveldb_coding.cc b/content/browser/indexed_db/indexed_db_leveldb_coding.cc index fe46ea4..eb70537 100644 --- a/content/browser/indexed_db/indexed_db_leveldb_coding.cc +++ b/content/browser/indexed_db/indexed_db_leveldb_coding.cc @@ -1778,7 +1778,7 @@ scoped_ptr<IndexedDBKey> ObjectStoreDataKey::user_key() const { if (!DecodeIDBKey(&slice, &key)) { // TODO(jsbell): Return error. } - return key.Pass(); + return key; } const int64_t ObjectStoreDataKey::kSpecialIndexNumber = kObjectStoreDataIndexId; @@ -1822,7 +1822,7 @@ scoped_ptr<IndexedDBKey> ExistsEntryKey::user_key() const { if (!DecodeIDBKey(&slice, &key)) { // TODO(jsbell): Return error. } - return key.Pass(); + return key; } const int64_t ExistsEntryKey::kSpecialIndexNumber = kExistsEntryIndexId; @@ -2021,7 +2021,7 @@ scoped_ptr<IndexedDBKey> IndexDataKey::user_key() const { if (!DecodeIDBKey(&slice, &key)) { // TODO(jsbell): Return error. } - return key.Pass(); + return key; } scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { @@ -2030,7 +2030,7 @@ scoped_ptr<IndexedDBKey> IndexDataKey::primary_key() const { if (!DecodeIDBKey(&slice, &key)) { // TODO(jsbell): Return error. } - return key.Pass(); + return key; } } // namespace content diff --git a/content/browser/indexed_db/indexed_db_unittest.cc b/content/browser/indexed_db/indexed_db_unittest.cc index 8628a6b..f7ea478 100644 --- a/content/browser/indexed_db/indexed_db_unittest.cc +++ b/content/browser/indexed_db/indexed_db_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -137,7 +138,7 @@ class ForceCloseDBCallbacks : public IndexedDBCallbacks { void OnSuccess(const std::vector<base::string16>&) override {} void OnSuccess(scoped_ptr<IndexedDBConnection> connection, const IndexedDBDatabaseMetadata& metadata) override { - connection_ = connection.Pass(); + connection_ = std::move(connection); idb_context_->ConnectionOpened(origin_url_, connection_.get()); } diff --git a/content/browser/indexed_db/leveldb/leveldb_database.cc b/content/browser/indexed_db/leveldb/leveldb_database.cc index 3bce96c..8bd919e 100644 --- a/content/browser/indexed_db/leveldb/leveldb_database.cc +++ b/content/browser/indexed_db/leveldb/leveldb_database.cc @@ -5,8 +5,8 @@ #include "content/browser/indexed_db/leveldb/leveldb_database.h" #include <stdint.h> - #include <cerrno> +#include <utility> #include "base/files/file.h" #include "base/logging.h" @@ -308,9 +308,9 @@ leveldb::Status LevelDBDatabase::Open(const base::FilePath& file_name, (*result).reset(new LevelDBDatabase); (*result)->db_ = make_scoped_ptr(db); - (*result)->comparator_adapter_ = comparator_adapter.Pass(); + (*result)->comparator_adapter_ = std::move(comparator_adapter); (*result)->comparator_ = comparator; - (*result)->filter_policy_ = filter_policy.Pass(); + (*result)->filter_policy_ = std::move(filter_policy); return s; } @@ -335,13 +335,13 @@ scoped_ptr<LevelDBDatabase> LevelDBDatabase::OpenInMemory( } scoped_ptr<LevelDBDatabase> result(new LevelDBDatabase); - result->env_ = in_memory_env.Pass(); + result->env_ = std::move(in_memory_env); result->db_ = make_scoped_ptr(db); - result->comparator_adapter_ = comparator_adapter.Pass(); + result->comparator_adapter_ = std::move(comparator_adapter); result->comparator_ = comparator; - result->filter_policy_ = filter_policy.Pass(); + result->filter_policy_ = std::move(filter_policy); - return result.Pass(); + return result; } leveldb::Status LevelDBDatabase::Put(const StringPiece& key, @@ -419,7 +419,7 @@ scoped_ptr<LevelDBIterator> LevelDBDatabase::CreateIterator( scoped_ptr<leveldb::Iterator> i(db_->NewIterator(read_options)); return scoped_ptr<LevelDBIterator>( - IndexedDBClassFactory::Get()->CreateIteratorImpl(i.Pass())); + IndexedDBClassFactory::Get()->CreateIteratorImpl(std::move(i))); } const LevelDBComparator* LevelDBDatabase::Comparator() const { diff --git a/content/browser/indexed_db/leveldb/leveldb_iterator_impl.cc b/content/browser/indexed_db/leveldb/leveldb_iterator_impl.cc index 46c99f4..35d679e 100644 --- a/content/browser/indexed_db/leveldb/leveldb_iterator_impl.cc +++ b/content/browser/indexed_db/leveldb/leveldb_iterator_impl.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" + +#include <utility> + #include "base/logging.h" #include "base/memory/scoped_ptr.h" -#include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" static leveldb::Slice MakeSlice(const base::StringPiece& s) { return leveldb::Slice(s.begin(), s.size()); @@ -20,8 +23,7 @@ LevelDBIteratorImpl::~LevelDBIteratorImpl() { } LevelDBIteratorImpl::LevelDBIteratorImpl(scoped_ptr<leveldb::Iterator> it) - : iterator_(it.Pass()) { -} + : iterator_(std::move(it)) {} void LevelDBIteratorImpl::CheckStatus() { const leveldb::Status& s = iterator_->status(); diff --git a/content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.cc b/content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.cc index 1ece582..60202ae 100644 --- a/content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.cc +++ b/content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.cc @@ -2,15 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> +#include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h" +#include <stddef.h> #include <string> +#include <utility> #include "base/logging.h" #include "content/browser/indexed_db/indexed_db_transaction.h" #include "content/browser/indexed_db/leveldb/leveldb_iterator_impl.h" #include "content/browser/indexed_db/leveldb/leveldb_transaction.h" -#include "content/browser/indexed_db/mock_browsertest_indexed_db_class_factory.h" #include "third_party/leveldatabase/env_chromium.h" #include "third_party/leveldatabase/src/include/leveldb/status.h" @@ -166,7 +167,7 @@ const std::string LevelDBTraceTransaction::s_class_name = "LevelDBTransaction"; class LevelDBTraceIteratorImpl : public LevelDBIteratorImpl { public: LevelDBTraceIteratorImpl(scoped_ptr<leveldb::Iterator> iterator, int inst_num) - : LevelDBIteratorImpl(iterator.Pass()), + : LevelDBIteratorImpl(std::move(iterator)), is_valid_tracer_(s_class_name, "IsValid", inst_num), seek_to_last_tracer_(s_class_name, "SeekToLast", inst_num), seek_tracer_(s_class_name, "Seek", inst_num), @@ -224,7 +225,7 @@ class LevelDBTestIteratorImpl : public content::LevelDBIteratorImpl { LevelDBTestIteratorImpl(scoped_ptr<leveldb::Iterator> iterator, FailMethod fail_method, int fail_on_call_num) - : LevelDBIteratorImpl(iterator.Pass()), + : LevelDBIteratorImpl(std::move(iterator)), fail_method_(fail_method), fail_on_call_num_(fail_on_call_num), current_call_num_(0) {} @@ -302,17 +303,16 @@ LevelDBIteratorImpl* MockBrowserTestIndexedDBClassFactory::CreateIteratorImpl( instance_count_[FAIL_CLASS_LEVELDB_ITERATOR] + 1; if (only_trace_calls_) { return new LevelDBTraceIteratorImpl( - iterator.Pass(), instance_count_[FAIL_CLASS_LEVELDB_ITERATOR]); + std::move(iterator), instance_count_[FAIL_CLASS_LEVELDB_ITERATOR]); } else { if (failure_class_ == FAIL_CLASS_LEVELDB_ITERATOR && instance_count_[FAIL_CLASS_LEVELDB_ITERATOR] == fail_on_instance_num_[FAIL_CLASS_LEVELDB_ITERATOR]) { return new LevelDBTestIteratorImpl( - iterator.Pass(), - failure_method_, + std::move(iterator), failure_method_, fail_on_call_num_[FAIL_CLASS_LEVELDB_ITERATOR]); } else { - return new LevelDBIteratorImpl(iterator.Pass()); + return new LevelDBIteratorImpl(std::move(iterator)); } } } diff --git a/content/browser/indexed_db/mock_indexed_db_callbacks.cc b/content/browser/indexed_db/mock_indexed_db_callbacks.cc index 6d9e48d..79c1340 100644 --- a/content/browser/indexed_db/mock_indexed_db_callbacks.cc +++ b/content/browser/indexed_db/mock_indexed_db_callbacks.cc @@ -4,6 +4,8 @@ #include "content/browser/indexed_db/mock_indexed_db_callbacks.h" +#include <utility> + #include "testing/gtest/include/gtest/gtest.h" namespace content { @@ -28,7 +30,7 @@ void MockIndexedDBCallbacks::OnSuccess(const IndexedDBKey& key) {} void MockIndexedDBCallbacks::OnSuccess( scoped_ptr<IndexedDBConnection> connection, const IndexedDBDatabaseMetadata& metadata) { - connection_ = connection.Pass(); + connection_ = std::move(connection); } } // namespace content diff --git a/content/browser/loader/async_resource_handler_browsertest.cc b/content/browser/loader/async_resource_handler_browsertest.cc index 2a854c0..8cee365 100644 --- a/content/browser/loader/async_resource_handler_browsertest.cc +++ b/content/browser/loader/async_resource_handler_browsertest.cc @@ -5,8 +5,8 @@ #include "content/browser/loader/async_resource_handler.h" #include <stddef.h> - #include <string> +#include <utility> #include "base/format_macros.h" #include "base/strings/string_util.h" @@ -50,13 +50,13 @@ scoped_ptr<net::test_server::HttpResponse> HandlePostAndRedirectURLs( http_response->set_code(net::HTTP_TEMPORARY_REDIRECT); http_response->AddCustomHeader("Location", kPostPath); EXPECT_EQ(request.content.length(), kPayloadSize);; - return http_response.Pass(); + return std::move(http_response); } else if(base::StartsWith(request.relative_url, kPostPath, base::CompareCase::SENSITIVE)) { http_response->set_content("hello"); http_response->set_content_type("text/plain"); EXPECT_EQ(request.content.length(), kPayloadSize); - return http_response.Pass(); + return std::move(http_response); } else { return scoped_ptr<net::test_server::HttpResponse>(); } diff --git a/content/browser/loader/cross_site_resource_handler.cc b/content/browser/loader/cross_site_resource_handler.cc index 0b9e6a7..fad4024 100644 --- a/content/browser/loader/cross_site_resource_handler.cc +++ b/content/browser/loader/cross_site_resource_handler.cc @@ -5,6 +5,7 @@ #include "content/browser/loader/cross_site_resource_handler.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -76,9 +77,9 @@ void OnCrossSiteResponseHelper(const CrossSiteResponseParams& params) { CHECK(SiteIsolationPolicy::AreCrossProcessFramesPossible()); } rfh->OnCrossSiteResponse( - params.global_request_id, cross_site_transferring_request.Pass(), - params.transfer_url_chain, params.referrer, - params.page_transition, params.should_replace_current_entry); + params.global_request_id, std::move(cross_site_transferring_request), + params.transfer_url_chain, params.referrer, params.page_transition, + params.should_replace_current_entry); } else if (leak_requests_for_testing_ && cross_site_transferring_request) { // Some unit tests expect requests to be leaked in this case, so they can // pass them along manually. @@ -111,13 +112,12 @@ CheckNavigationPolicyOnUI(GURL real_url, int process_id, int render_frame_id) { CrossSiteResourceHandler::CrossSiteResourceHandler( scoped_ptr<ResourceHandler> next_handler, net::URLRequest* request) - : LayeredResourceHandler(request, next_handler.Pass()), + : LayeredResourceHandler(request, std::move(next_handler)), has_started_response_(false), in_cross_site_transition_(false), completed_during_transition_(false), did_defer_(false), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} CrossSiteResourceHandler::~CrossSiteResourceHandler() { // Cleanup back-pointer stored on the request info. diff --git a/content/browser/loader/detachable_resource_handler.cc b/content/browser/loader/detachable_resource_handler.cc index df9c357..786252f 100644 --- a/content/browser/loader/detachable_resource_handler.cc +++ b/content/browser/loader/detachable_resource_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/detachable_resource_handler.h" +#include <utility> + #include "base/logging.h" #include "base/time/time.h" #include "content/browser/loader/resource_request_info_impl.h" @@ -24,7 +26,7 @@ DetachableResourceHandler::DetachableResourceHandler( base::TimeDelta cancel_delay, scoped_ptr<ResourceHandler> next_handler) : ResourceHandler(request), - next_handler_(next_handler.Pass()), + next_handler_(std::move(next_handler)), cancel_delay_(cancel_delay), is_deferred_(false), is_finished_(false) { diff --git a/content/browser/loader/layered_resource_handler.cc b/content/browser/loader/layered_resource_handler.cc index 00048ae..9ff3d55 100644 --- a/content/browser/loader/layered_resource_handler.cc +++ b/content/browser/loader/layered_resource_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/layered_resource_handler.h" +#include <utility> + #include "base/logging.h" namespace content { @@ -11,9 +13,7 @@ namespace content { LayeredResourceHandler::LayeredResourceHandler( net::URLRequest* request, scoped_ptr<ResourceHandler> next_handler) - : ResourceHandler(request), - next_handler_(next_handler.Pass()) { -} + : ResourceHandler(request), next_handler_(std::move(next_handler)) {} LayeredResourceHandler::~LayeredResourceHandler() { } diff --git a/content/browser/loader/mime_type_resource_handler.cc b/content/browser/loader/mime_type_resource_handler.cc index 59c2b53..a954901 100644 --- a/content/browser/loader/mime_type_resource_handler.cc +++ b/content/browser/loader/mime_type_resource_handler.cc @@ -4,6 +4,7 @@ #include "content/browser/loader/mime_type_resource_handler.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -86,7 +87,7 @@ MimeTypeResourceHandler::MimeTypeResourceHandler( ResourceDispatcherHostImpl* host, PluginService* plugin_service, net::URLRequest* request) - : LayeredResourceHandler(request, next_handler.Pass()), + : LayeredResourceHandler(request, std::move(next_handler)), state_(STATE_STARTING), host_(host), plugin_service_(plugin_service), @@ -94,8 +95,7 @@ MimeTypeResourceHandler::MimeTypeResourceHandler( bytes_read_(0), must_download_(false), must_download_is_set_(false), - weak_ptr_factory_(this) { -} + weak_ptr_factory_(this) {} MimeTypeResourceHandler::~MimeTypeResourceHandler() { } @@ -329,7 +329,7 @@ bool MimeTypeResourceHandler::SelectPluginHandler(bool* defer, plugin_path, request(), response_.get(), &payload)); if (handler) { *handled_by_plugin = true; - return UseAlternateNextHandler(handler.Pass(), payload); + return UseAlternateNextHandler(std::move(handler), payload); } #endif return true; @@ -346,7 +346,7 @@ bool MimeTypeResourceHandler::SelectNextHandler(bool* defer) { info->set_is_download(true); scoped_ptr<ResourceHandler> handler( new CertificateResourceHandler(request())); - return UseAlternateNextHandler(handler.Pass(), std::string()); + return UseAlternateNextHandler(std::move(handler), std::string()); } // Allow requests for object/embed tags to be intercepted as streams. @@ -391,7 +391,7 @@ bool MimeTypeResourceHandler::SelectNextHandler(bool* defer) { DownloadItem::kInvalidId, scoped_ptr<DownloadSaveInfo>(new DownloadSaveInfo()), DownloadUrlParameters::OnStartedCallback())); - return UseAlternateNextHandler(handler.Pass(), std::string()); + return UseAlternateNextHandler(std::move(handler), std::string()); } bool MimeTypeResourceHandler::UseAlternateNextHandler( @@ -443,7 +443,7 @@ bool MimeTypeResourceHandler::UseAlternateNextHandler( // This is handled entirely within the new ResourceHandler, so just reset the // original ResourceHandler. - next_handler_ = new_handler.Pass(); + next_handler_ = std::move(new_handler); next_handler_->SetController(this); return CopyReadBufferToNextHandler(); diff --git a/content/browser/loader/mime_type_resource_handler_unittest.cc b/content/browser/loader/mime_type_resource_handler_unittest.cc index a496749..1b3ddcd 100644 --- a/content/browser/loader/mime_type_resource_handler_unittest.cc +++ b/content/browser/loader/mime_type_resource_handler_unittest.cc @@ -95,7 +95,7 @@ class TestResourceDispatcherHost : public ResourceDispatcherHostImpl { uint32_t id, scoped_ptr<DownloadSaveInfo> save_info, const DownloadUrlParameters::OnStartedCallback& started_cb) override { - return scoped_ptr<ResourceHandler>(new TestResourceHandler).Pass(); + return scoped_ptr<ResourceHandler>(new TestResourceHandler); } scoped_ptr<ResourceHandler> MaybeInterceptAsStream( @@ -106,7 +106,7 @@ class TestResourceDispatcherHost : public ResourceDispatcherHostImpl { intercepted_as_stream_count_++; if (stream_has_handler_) { intercepted_as_stream_ = true; - return scoped_ptr<ResourceHandler>(new TestResourceHandler).Pass(); + return scoped_ptr<ResourceHandler>(new TestResourceHandler); } else { return scoped_ptr<ResourceHandler>(); } @@ -258,10 +258,9 @@ bool MimeTypeResourceHandlerTest::TestStreamIsIntercepted( host.SetDelegate(&host_delegate); TestFakePluginService plugin_service(plugin_available_, plugin_stale_); - scoped_ptr<ResourceHandler> mime_sniffing_handler( - new MimeTypeResourceHandler( - scoped_ptr<ResourceHandler>(new TestResourceHandler()).Pass(), &host, - &plugin_service, request.get())); + scoped_ptr<ResourceHandler> mime_sniffing_handler(new MimeTypeResourceHandler( + scoped_ptr<ResourceHandler>(new TestResourceHandler()), &host, + &plugin_service, request.get())); TestResourceController resource_controller; mime_sniffing_handler->SetController(&resource_controller); diff --git a/content/browser/loader/navigation_url_loader.cc b/content/browser/loader/navigation_url_loader.cc index 0da9a25..e250765 100644 --- a/content/browser/loader/navigation_url_loader.cc +++ b/content/browser/loader/navigation_url_loader.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/navigation_url_loader.h" +#include <utility> + #include "content/browser/frame_host/navigation_request_info.h" #include "content/browser/loader/navigation_url_loader_factory.h" #include "content/browser/loader/navigation_url_loader_impl.h" @@ -18,11 +20,12 @@ scoped_ptr<NavigationURLLoader> NavigationURLLoader::Create( ServiceWorkerNavigationHandle* service_worker_handle, NavigationURLLoaderDelegate* delegate) { if (g_factory) { - return g_factory->CreateLoader(browser_context, request_info.Pass(), + return g_factory->CreateLoader(browser_context, std::move(request_info), service_worker_handle, delegate); } - return scoped_ptr<NavigationURLLoader>(new NavigationURLLoaderImpl( - browser_context, request_info.Pass(), service_worker_handle, delegate)); + return scoped_ptr<NavigationURLLoader>( + new NavigationURLLoaderImpl(browser_context, std::move(request_info), + service_worker_handle, delegate)); } void NavigationURLLoader::SetFactoryForTesting( diff --git a/content/browser/loader/navigation_url_loader_impl.cc b/content/browser/loader/navigation_url_loader_impl.cc index 2cae9a6..d529818 100644 --- a/content/browser/loader/navigation_url_loader_impl.cc +++ b/content/browser/loader/navigation_url_loader_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/navigation_url_loader_impl.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "content/browser/frame_host/navigation_request_info.h" @@ -63,7 +65,7 @@ void NavigationURLLoaderImpl::NotifyResponseStarted( scoped_ptr<StreamHandle> body) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - delegate_->OnResponseStarted(response, body.Pass()); + delegate_->OnResponseStarted(response, std::move(body)); } void NavigationURLLoaderImpl::NotifyRequestFailed(bool in_cache, diff --git a/content/browser/loader/navigation_url_loader_unittest.cc b/content/browser/loader/navigation_url_loader_unittest.cc index 418046e..b9302f8 100644 --- a/content/browser/loader/navigation_url_loader_unittest.cc +++ b/content/browser/loader/navigation_url_loader_unittest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/command_line.h" #include "base/macros.h" #include "base/memory/ref_counted.h" @@ -109,7 +111,7 @@ class TestNavigationURLLoaderDelegate : public NavigationURLLoaderDelegate { void OnResponseStarted(const scoped_refptr<ResourceResponse>& response, scoped_ptr<StreamHandle> body) override { response_ = response; - body_ = body.Pass(); + body_ = std::move(body); ASSERT_TRUE(response_started_); response_started_->Quit(); } @@ -187,8 +189,8 @@ class NavigationURLLoaderTest : public testing::Test { new NavigationRequestInfo(common_params, begin_params, url, true, false, -1, scoped_refptr<ResourceRequestBody>())); - return NavigationURLLoader::Create(browser_context_.get(), - request_info.Pass(), nullptr, delegate); + return NavigationURLLoader::Create( + browser_context_.get(), std::move(request_info), nullptr, delegate); } // Helper function for fetching the body of a URL to a string. diff --git a/content/browser/loader/redirect_to_file_resource_handler.cc b/content/browser/loader/redirect_to_file_resource_handler.cc index 57f0df6..670b334 100644 --- a/content/browser/loader/redirect_to_file_resource_handler.cc +++ b/content/browser/loader/redirect_to_file_resource_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/redirect_to_file_resource_handler.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -62,7 +64,7 @@ class RedirectToFileResourceHandler::Writer { scoped_ptr<net::FileStream> file_stream, ShareableFileReference* deletable_file) : handler_(handler), - file_stream_(file_stream.Pass()), + file_stream_(std::move(file_stream)), is_writing_(false), deletable_file_(deletable_file) { DCHECK(!deletable_file_->path().empty()); @@ -130,7 +132,7 @@ class RedirectToFileResourceHandler::Writer { RedirectToFileResourceHandler::RedirectToFileResourceHandler( scoped_ptr<ResourceHandler> next_handler, net::URLRequest* request) - : LayeredResourceHandler(request, next_handler.Pass()), + : LayeredResourceHandler(request, std::move(next_handler)), buf_(new net::GrowableIOBuffer()), buf_write_pending_(false), write_cursor_(0), @@ -138,8 +140,7 @@ RedirectToFileResourceHandler::RedirectToFileResourceHandler( next_buffer_size_(kInitialReadBufSize), did_defer_(false), completed_during_write_(false), - weak_factory_(this) { -} + weak_factory_(this) {} RedirectToFileResourceHandler::~RedirectToFileResourceHandler() { // Orphan the writer to asynchronously close and release the temporary file. @@ -250,7 +251,7 @@ void RedirectToFileResourceHandler::DidCreateTemporaryFile( return; } - writer_ = new Writer(this, file_stream.Pass(), deletable_file); + writer_ = new Writer(this, std::move(file_stream), deletable_file); // Resume the request. DCHECK(did_defer_); diff --git a/content/browser/loader/resource_dispatcher_host_browsertest.cc b/content/browser/loader/resource_dispatcher_host_browsertest.cc index c6f0d1f..bad9b86 100644 --- a/content/browser/loader/resource_dispatcher_host_browsertest.cc +++ b/content/browser/loader/resource_dispatcher_host_browsertest.cc @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/public/browser/resource_dispatcher_host.h" + +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/macros.h" @@ -15,7 +19,6 @@ #include "content/browser/web_contents/web_contents_impl.h" #include "content/public/browser/browser_context.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/resource_dispatcher_host.h" #include "content/public/browser/resource_dispatcher_host_delegate.h" #include "content/public/browser/resource_request_info.h" #include "content/public/browser/web_contents.h" @@ -287,7 +290,7 @@ scoped_ptr<net::test_server::HttpResponse> NoContentResponseHandler( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_NO_CONTENT); - return http_response.Pass(); + return std::move(http_response); } } // namespace @@ -474,7 +477,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleRedirectRequest( http_response->set_code(net::HTTP_FOUND); http_response->AddCustomHeader( "Location", request.relative_url.substr(request_path.length())); - return http_response.Pass(); + return std::move(http_response); } } // namespace diff --git a/content/browser/loader/resource_dispatcher_host_impl.cc b/content/browser/loader/resource_dispatcher_host_impl.cc index d132f9b..f1d97ab 100644 --- a/content/browser/loader/resource_dispatcher_host_impl.cc +++ b/content/browser/loader/resource_dispatcher_host_impl.cc @@ -7,9 +7,9 @@ #include "content/browser/loader/resource_dispatcher_host_impl.h" #include <stddef.h> - #include <algorithm> #include <set> +#include <utility> #include <vector> #include "base/bind.h" @@ -725,12 +725,11 @@ DownloadInterruptReason ResourceDispatcherHostImpl::BeginDownload( // From this point forward, the |DownloadResourceHandler| is responsible for // |started_callback|. - scoped_ptr<ResourceHandler> handler( - CreateResourceHandlerForDownload(request.get(), is_content_initiated, - true, download_id, save_info.Pass(), - started_callback)); + scoped_ptr<ResourceHandler> handler(CreateResourceHandlerForDownload( + request.get(), is_content_initiated, true, download_id, + std::move(save_info), started_callback)); - BeginRequestInternal(request.Pass(), handler.Pass()); + BeginRequestInternal(std::move(request), std::move(handler)); return DOWNLOAD_INTERRUPT_REASON_NONE; } @@ -761,8 +760,8 @@ ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( uint32_t id, scoped_ptr<DownloadSaveInfo> save_info, const DownloadUrlParameters::OnStartedCallback& started_cb) { - scoped_ptr<ResourceHandler> handler( - new DownloadResourceHandler(id, request, started_cb, save_info.Pass())); + scoped_ptr<ResourceHandler> handler(new DownloadResourceHandler( + id, request, started_cb, std::move(save_info))); if (delegate_) { const ResourceRequestInfoImpl* request_info( ResourceRequestInfoImpl::ForRequest(request)); @@ -773,12 +772,11 @@ ResourceDispatcherHostImpl::CreateResourceHandlerForDownload( request_info->GetRouteID(), request_info->GetRequestID(), is_content_initiated, must_download, &throttles); if (!throttles.empty()) { - handler.reset( - new ThrottlingResourceHandler( - handler.Pass(), request, throttles.Pass())); + handler.reset(new ThrottlingResourceHandler(std::move(handler), request, + std::move(throttles))); } } - return handler.Pass(); + return handler; } scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::MaybeInterceptAsStream( @@ -817,8 +815,8 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::MaybeInterceptAsStream( stream_info->response_headers = new net::HttpResponseHeaders(response->head.headers->raw_headers()); } - delegate_->OnStreamCreated(request, stream_info.Pass()); - return handler.Pass(); + delegate_->OnStreamCreated(request, std::move(stream_info)); + return std::move(handler); } ResourceDispatcherHostLoginDelegate* @@ -1483,7 +1481,7 @@ void ResourceDispatcherHostImpl::BeginRequest( resource_context)); if (handler) - BeginRequestInternal(new_request.Pass(), handler.Pass()); + BeginRequestInternal(std::move(new_request), std::move(handler)); } scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( @@ -1514,7 +1512,7 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( // The RedirectToFileResourceHandler depends on being next in the chain. if (request_data.download_to_file) { handler.reset( - new RedirectToFileResourceHandler(handler.Pass(), request)); + new RedirectToFileResourceHandler(std::move(handler), request)); } } @@ -1523,7 +1521,7 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( handler.reset(new DetachableResourceHandler( request, base::TimeDelta::FromMilliseconds(kDefaultDetachableCancelDelayMs), - handler.Pass())); + std::move(handler))); } // PlzNavigate: If using --enable-browser-side-navigation, the @@ -1545,12 +1543,12 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::CreateResourceHandler( request_data.resource_type == RESOURCE_TYPE_SUB_FRAME; } if (is_swappable_navigation && process_type == PROCESS_TYPE_RENDERER) - handler.reset(new CrossSiteResourceHandler(handler.Pass(), request)); + handler.reset(new CrossSiteResourceHandler(std::move(handler), request)); } return AddStandardHandlers(request, request_data.resource_type, resource_context, filter_->appcache_service(), - child_id, route_id, handler.Pass()); + child_id, route_id, std::move(handler)); } scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers( @@ -1567,7 +1565,7 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers( if (IsBrowserSideNavigationEnabled() && IsResourceTypeFrame(resource_type) && child_id != -1) { DCHECK(request->url().SchemeIs(url::kBlobScheme)); - return handler.Pass(); + return handler; } PluginService* plugin_service = nullptr; @@ -1575,7 +1573,7 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers( plugin_service = PluginService::GetInstance(); #endif // Insert a buffered event handler before the actual one. - handler.reset(new MimeTypeResourceHandler(handler.Pass(), this, + handler.reset(new MimeTypeResourceHandler(std::move(handler), this, plugin_service, request)); ScopedVector<ResourceThrottle> throttles; @@ -1604,10 +1602,10 @@ scoped_ptr<ResourceHandler> ResourceDispatcherHostImpl::AddStandardHandlers( throttles.push_back(scheduler_->ScheduleRequest(child_id, route_id, info->IsAsync(), request)); - handler.reset( - new ThrottlingResourceHandler(handler.Pass(), request, throttles.Pass())); + handler.reset(new ThrottlingResourceHandler(std::move(handler), request, + std::move(throttles))); - return handler.Pass(); + return handler; } void ResourceDispatcherHostImpl::OnReleaseDownloadedFile(int request_id) { @@ -1825,7 +1823,7 @@ void ResourceDispatcherHostImpl::BeginSaveFile(const GURL& url, request.get(), save_item_id, save_package_id, child_id, render_frame_route_id, url, save_file_manager_.get())); - BeginRequestInternal(request.Pass(), handler.Pass()); + BeginRequestInternal(std::move(request), std::move(handler)); } void ResourceDispatcherHostImpl::MarkAsTransferredNavigation( @@ -2205,14 +2203,14 @@ void ResourceDispatcherHostImpl::BeginNavigationRequest( // TODO(davidben): Pass in the appropriate appcache_service. Also fix the // dependency on child_id/route_id. Those are used by the ResourceScheduler; // currently it's a no-op. - handler = AddStandardHandlers(new_request.get(), resource_type, - resource_context, - nullptr, // appcache_service - -1, // child_id - -1, // route_id - handler.Pass()); + handler = + AddStandardHandlers(new_request.get(), resource_type, resource_context, + nullptr, // appcache_service + -1, // child_id + -1, // route_id + std::move(handler)); - BeginRequestInternal(new_request.Pass(), handler.Pass()); + BeginRequestInternal(std::move(new_request), std::move(handler)); } void ResourceDispatcherHostImpl::EnableStaleWhileRevalidateForTesting() { @@ -2275,7 +2273,7 @@ void ResourceDispatcherHostImpl::BeginRequestInternal( } linked_ptr<ResourceLoader> loader( - new ResourceLoader(request.Pass(), handler.Pass(), this)); + new ResourceLoader(std::move(request), std::move(handler), this)); GlobalRoutingID id(info->GetGlobalRoutingID()); BlockedLoadersMap::const_iterator iter = blocked_loaders_map_.find(id); @@ -2378,7 +2376,7 @@ ResourceDispatcherHostImpl::GetLoadInfoForAllRoutes() { (*info_map)[id] = load_info; } } - return info_map.Pass(); + return info_map; } void ResourceDispatcherHostImpl::UpdateLoadInfo() { diff --git a/content/browser/loader/resource_dispatcher_host_unittest.cc b/content/browser/loader/resource_dispatcher_host_unittest.cc index e158abc..f5a97aa 100644 --- a/content/browser/loader/resource_dispatcher_host_unittest.cc +++ b/content/browser/loader/resource_dispatcher_host_unittest.cc @@ -3,7 +3,7 @@ // found in the LICENSE file. #include <stddef.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -1114,19 +1114,14 @@ void ResourceDispatcherHostTest::MakeWebContentsAssociatedDownloadRequest( browser_context_->GetResourceContext()->GetRequestContext(); scoped_ptr<net::URLRequest> request( request_context->CreateRequest(url, net::DEFAULT_PRIORITY, NULL)); - host_.BeginDownload( - request.Pass(), - Referrer(), - false, // is_content_initiated - browser_context_->GetResourceContext(), - web_contents_->GetRenderProcessHost()->GetID(), - web_contents_->GetRoutingID(), - web_contents_->GetMainFrame()->GetRoutingID(), - false, - false, - save_info.Pass(), - DownloadItem::kInvalidId, - ResourceDispatcherHostImpl::DownloadStartedCallback()); + host_.BeginDownload(std::move(request), Referrer(), + false, // is_content_initiated + browser_context_->GetResourceContext(), + web_contents_->GetRenderProcessHost()->GetID(), + web_contents_->GetRoutingID(), + web_contents_->GetMainFrame()->GetRoutingID(), false, + false, std::move(save_info), DownloadItem::kInvalidId, + ResourceDispatcherHostImpl::DownloadStartedCallback()); } void ResourceDispatcherHostTest::CancelRequest(int request_id) { @@ -2049,7 +2044,7 @@ TEST_F(ResourceDispatcherHostTest, CalculateApproximateMemoryCost) { scoped_ptr<net::UploadElementReader> reader(new net::UploadBytesElementReader( upload_content.data(), upload_content.size())); req->set_upload( - net::ElementsUploadDataStream::CreateWithReader(reader.Pass(), 0)); + net::ElementsUploadDataStream::CreateWithReader(std::move(reader), 0)); // Since the upload throttling is disabled, this has no effect on the cost. EXPECT_EQ( @@ -3497,7 +3492,7 @@ net::URLRequestJob* TestURLRequestJobFactory::MaybeCreateJobWithProtocolHandler( if (test_fixture_->loader_test_request_info_) { DCHECK_EQ(test_fixture_->loader_test_request_info_->url, request->url()); scoped_ptr<LoadInfoTestRequestInfo> info = - test_fixture_->loader_test_request_info_.Pass(); + std::move(test_fixture_->loader_test_request_info_); return new URLRequestLoadInfoJob(request, network_delegate, info->load_state, info->upload_progress); } diff --git a/content/browser/loader/resource_loader.cc b/content/browser/loader/resource_loader.cc index e8a404f..eee044c 100644 --- a/content/browser/loader/resource_loader.cc +++ b/content/browser/loader/resource_loader.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/resource_loader.h" +#include <utility> + #include "base/command_line.h" #include "base/location.h" #include "base/metrics/histogram.h" @@ -133,8 +135,8 @@ ResourceLoader::ResourceLoader(scoped_ptr<net::URLRequest> request, scoped_ptr<ResourceHandler> handler, ResourceLoaderDelegate* delegate) : deferred_stage_(DEFERRED_NONE), - request_(request.Pass()), - handler_(handler.Pass()), + request_(std::move(request)), + handler_(std::move(handler)), delegate_(delegate), is_transferring_(false), times_cancelled_before_request_start_(0), diff --git a/content/browser/loader/resource_loader_unittest.cc b/content/browser/loader/resource_loader_unittest.cc index 2ff4738..05ed7fc 100644 --- a/content/browser/loader/resource_loader_unittest.cc +++ b/content/browser/loader/resource_loader_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/files/file.h" #include "base/files/file_util.h" @@ -450,7 +451,7 @@ class SelectCertificateBrowserClient : public TestContentBrowserClient { ++call_count_; passed_certs_ = cert_request_info->client_certs; - delegate_ = delegate.Pass(); + delegate_ = std::move(delegate); select_certificate_run_loop_.Quit(); } @@ -480,11 +481,11 @@ class ResourceContextStub : public MockResourceContext { : MockResourceContext(test_request_context) {} scoped_ptr<net::ClientCertStore> CreateClientCertStore() override { - return dummy_cert_store_.Pass(); + return std::move(dummy_cert_store_); } void SetClientCertStore(scoped_ptr<net::ClientCertStore> store) { - dummy_cert_store_ = store.Pass(); + dummy_cert_store_ = std::move(store); } private: @@ -561,7 +562,7 @@ class ResourceLoaderTest : public testing::Test, virtual scoped_ptr<ResourceHandler> WrapResourceHandler( scoped_ptr<ResourceHandlerStub> leaf_handler, net::URLRequest* request) { - return leaf_handler.Pass(); + return std::move(leaf_handler); } // Replaces loader_ with a new one for |request|. @@ -579,8 +580,8 @@ class ResourceLoaderTest : public testing::Test, new ResourceHandlerStub(request.get())); raw_ptr_resource_handler_ = resource_handler.get(); loader_.reset(new ResourceLoader( - request.Pass(), - WrapResourceHandler(resource_handler.Pass(), raw_ptr_to_request_), + std::move(request), + WrapResourceHandler(std::move(resource_handler), raw_ptr_to_request_), this)); } @@ -598,7 +599,7 @@ class ResourceLoaderTest : public testing::Test, test_url(), net::DEFAULT_PRIORITY, nullptr /* delegate */)); - SetUpResourceLoader(request.Pass()); + SetUpResourceLoader(std::move(request)); } void TearDown() override { @@ -693,7 +694,7 @@ TEST_F(ClientCertResourceLoaderTest, WithStoreLookup) { new net::X509Certificate("test", "test", base::Time(), base::Time()))); scoped_ptr<ClientCertStoreStub> test_store(new ClientCertStoreStub( dummy_certs, &store_request_count, &store_requested_authorities)); - resource_context_.SetClientCertStore(test_store.Pass()); + resource_context_.SetClientCertStore(std::move(test_store)); // Plug in test content browser client. SelectCertificateBrowserClient test_client; @@ -893,7 +894,7 @@ class ResourceLoaderRedirectToFileTest : public ResourceLoaderTest { // Create mock file streams and a ShareableFileReference. scoped_ptr<net::testing::MockFileStream> file_stream( - new net::testing::MockFileStream(file.Pass(), + new net::testing::MockFileStream(std::move(file), base::ThreadTaskRunnerHandle::Get())); file_stream_ = file_stream.get(); deletable_file_ = ShareableFileReference::GetOrCreate( @@ -904,13 +905,13 @@ class ResourceLoaderRedirectToFileTest : public ResourceLoaderTest { // Inject them into the handler. scoped_ptr<RedirectToFileResourceHandler> handler( - new RedirectToFileResourceHandler(leaf_handler.Pass(), request)); + new RedirectToFileResourceHandler(std::move(leaf_handler), request)); redirect_to_file_resource_handler_ = handler.get(); handler->SetCreateTemporaryFileStreamFunctionForTesting( base::Bind(&ResourceLoaderRedirectToFileTest::PostCallback, base::Unretained(this), base::Passed(&file_stream))); - return handler.Pass(); + return std::move(handler); } private: @@ -1081,7 +1082,7 @@ TEST_F(HTTPSSecurityInfoResourceLoaderTest, SecurityInfoOnHTTPSResource) { scoped_ptr<net::URLRequest> request( resource_context_.GetRequestContext()->CreateRequest( test_https_url(), net::DEFAULT_PRIORITY, nullptr /* delegate */)); - SetUpResourceLoader(request.Pass()); + SetUpResourceLoader(std::move(request)); // Send the request and wait until it completes. loader_->StartRequest(); @@ -1120,7 +1121,7 @@ TEST_F(HTTPSSecurityInfoResourceLoaderTest, resource_context_.GetRequestContext()->CreateRequest( test_https_redirect_url(), net::DEFAULT_PRIORITY, nullptr /* delegate */)); - SetUpResourceLoader(request.Pass()); + SetUpResourceLoader(std::move(request)); // Send the request and wait until it completes. loader_->StartRequest(); diff --git a/content/browser/loader/resource_scheduler.cc b/content/browser/loader/resource_scheduler.cc index 370f2f0..690f20f 100644 --- a/content/browser/loader/resource_scheduler.cc +++ b/content/browser/loader/resource_scheduler.cc @@ -5,9 +5,9 @@ #include "content/browser/loader/resource_scheduler.h" #include <stdint.h> - #include <set> #include <string> +#include <utility> #include <vector> #include "base/macros.h" @@ -1084,12 +1084,12 @@ scoped_ptr<ResourceThrottle> ResourceScheduler::ScheduleRequest( // 3. The tab is closed while a RequestResource IPC is in flight. unowned_requests_.insert(request.get()); request->Start(START_SYNC); - return request.Pass(); + return std::move(request); } Client* client = it->second; client->ScheduleRequest(url_request, request.get()); - return request.Pass(); + return std::move(request); } void ResourceScheduler::RemoveRequest(ScheduledResourceRequest* request) { diff --git a/content/browser/loader/resource_scheduler_unittest.cc b/content/browser/loader/resource_scheduler_unittest.cc index 509d692..1399b52 100644 --- a/content/browser/loader/resource_scheduler_unittest.cc +++ b/content/browser/loader/resource_scheduler_unittest.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/resource_scheduler.h" +#include <utility> + #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" #include "base/metrics/field_trial.h" @@ -53,8 +55,8 @@ class TestRequest : public ResourceController { scoped_ptr<ResourceThrottle> throttle, ResourceScheduler* scheduler) : started_(false), - url_request_(url_request.Pass()), - throttle_(throttle.Pass()), + url_request_(std::move(url_request)), + throttle_(std::move(throttle)), scheduler_(scheduler) { throttle_->set_controller_for_testing(this); } @@ -102,10 +104,10 @@ class CancelingTestRequest : public TestRequest { CancelingTestRequest(scoped_ptr<net::URLRequest> url_request, scoped_ptr<ResourceThrottle> throttle, ResourceScheduler* scheduler) - : TestRequest(url_request.Pass(), throttle.Pass(), scheduler) {} + : TestRequest(std::move(url_request), std::move(throttle), scheduler) {} void set_request_to_cancel(scoped_ptr<TestRequest> request_to_cancel) { - request_to_cancel_ = request_to_cancel.Pass(); + request_to_cancel_ = std::move(request_to_cancel); } private: @@ -181,7 +183,7 @@ class ResourceSchedulerTest : public testing::Test { int route_id) { scoped_ptr<net::URLRequest> url_request( context_.CreateRequest(GURL(url), priority, NULL)); - return url_request.Pass(); + return url_request; } scoped_ptr<net::URLRequest> NewURLRequest(const char* url, @@ -238,8 +240,8 @@ class ResourceSchedulerTest : public testing::Test { NewURLRequestWithChildAndRoute(url, priority, child_id, route_id)); scoped_ptr<ResourceThrottle> throttle(scheduler_->ScheduleRequest( child_id, route_id, is_async, url_request.get())); - TestRequest* request = - new TestRequest(url_request.Pass(), throttle.Pass(), scheduler()); + TestRequest* request = new TestRequest(std::move(url_request), + std::move(throttle), scheduler()); request->Start(); return request; } @@ -403,11 +405,11 @@ TEST_F(ResourceSchedulerTest, CancelOtherRequestsWhileResuming) { scoped_ptr<ResourceThrottle> throttle(scheduler()->ScheduleRequest( kChildId, kRouteId, true, url_request.get())); scoped_ptr<CancelingTestRequest> low2(new CancelingTestRequest( - url_request.Pass(), throttle.Pass(), scheduler())); + std::move(url_request), std::move(throttle), scheduler())); low2->Start(); scoped_ptr<TestRequest> low3(NewRequest("http://host/low3", net::LOWEST)); - low2->set_request_to_cancel(low3.Pass()); + low2->set_request_to_cancel(std::move(low3)); scoped_ptr<TestRequest> low4(NewRequest("http://host/low4", net::LOWEST)); EXPECT_TRUE(high->started()); diff --git a/content/browser/loader/temporary_file_stream.cc b/content/browser/loader/temporary_file_stream.cc index fc57c8a..c8bb333 100644 --- a/content/browser/loader/temporary_file_stream.cc +++ b/content/browser/loader/temporary_file_stream.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/temporary_file_stream.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/files/file_proxy.h" @@ -43,7 +45,7 @@ void DidCreateTemporaryFile( scoped_ptr<net::FileStream> file_stream( new net::FileStream(file_proxy->TakeFile(), task_runner)); - callback.Run(error_code, file_stream.Pass(), deletable_file.get()); + callback.Run(error_code, std::move(file_stream), deletable_file.get()); } } // namespace diff --git a/content/browser/loader/temporary_file_stream_unittest.cc b/content/browser/loader/temporary_file_stream_unittest.cc index f3035b7..a5fe145 100644 --- a/content/browser/loader/temporary_file_stream_unittest.cc +++ b/content/browser/loader/temporary_file_stream_unittest.cc @@ -5,8 +5,8 @@ #include "content/browser/loader/temporary_file_stream.h" #include <string.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -42,7 +42,7 @@ class WaitForFileStream { scoped_ptr<net::FileStream> file_stream, ShareableFileReference* deletable_file) { error_ = error; - file_stream_ = file_stream.Pass(); + file_stream_ = std::move(file_stream); deletable_file_ = deletable_file; loop_.Quit(); } diff --git a/content/browser/loader/throttling_resource_handler.cc b/content/browser/loader/throttling_resource_handler.cc index 0378423..93b9ad7 100644 --- a/content/browser/loader/throttling_resource_handler.cc +++ b/content/browser/loader/throttling_resource_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/loader/throttling_resource_handler.h" +#include <utility> + #include "content/browser/loader/resource_request_info_impl.h" #include "content/public/browser/resource_throttle.h" #include "content/public/common/resource_response.h" @@ -15,9 +17,9 @@ ThrottlingResourceHandler::ThrottlingResourceHandler( scoped_ptr<ResourceHandler> next_handler, net::URLRequest* request, ScopedVector<ResourceThrottle> throttles) - : LayeredResourceHandler(request, next_handler.Pass()), + : LayeredResourceHandler(request, std::move(next_handler)), deferred_stage_(DEFERRED_NONE), - throttles_(throttles.Pass()), + throttles_(std::move(throttles)), next_index_(0), cancelled_by_resource_throttle_(false) { for (size_t i = 0; i < throttles_.size(); ++i) { diff --git a/content/browser/manifest/manifest_browsertest.cc b/content/browser/manifest/manifest_browsertest.cc index f340f17..8dab469 100644 --- a/content/browser/manifest/manifest_browsertest.cc +++ b/content/browser/manifest/manifest_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -497,7 +498,7 @@ scoped_ptr<net::test_server::HttpResponse> CustomHandleRequestForCookies( "<html><head>" "<link rel=manifest crossorigin='use-credentials' href=/manifest.json>" "</head></html>"); - return http_response.Pass(); + return std::move(http_response); } const auto& iter = request.headers.find("Cookie"); @@ -511,7 +512,7 @@ scoped_ptr<net::test_server::HttpResponse> CustomHandleRequestForCookies( http_response->set_content( base::StringPrintf("{\"name\": \"%s\"}", iter->second.c_str())); - return http_response.Pass(); + return std::move(http_response); } } // anonymous namespace @@ -557,7 +558,7 @@ scoped_ptr<net::test_server::HttpResponse> CustomHandleRequestForNoCookies( http_response->set_content_type("text/html"); http_response->set_content( "<html><head><link rel=manifest href=/manifest.json></head></html>"); - return http_response.Pass(); + return std::move(http_response); } const auto& iter = request.headers.find("Cookie"); @@ -570,7 +571,7 @@ scoped_ptr<net::test_server::HttpResponse> CustomHandleRequestForNoCookies( http_response->set_content_type("application/json"); http_response->set_content("{\"name\": \"no cookies\"}"); - return http_response.Pass(); + return std::move(http_response); } } // anonymous namespace diff --git a/content/browser/media/capture/aura_window_capture_machine.cc b/content/browser/media/capture/aura_window_capture_machine.cc index 6cb3e77..c340599 100644 --- a/content/browser/media/capture/aura_window_capture_machine.cc +++ b/content/browser/media/capture/aura_window_capture_machine.cc @@ -5,6 +5,7 @@ #include "content/browser/media/capture/aura_window_capture_machine.h" #include <algorithm> +#include <utility> #include "base/logging.h" #include "base/metrics/histogram.h" @@ -189,7 +190,7 @@ void AuraWindowCaptureMachine::Capture(bool dirty) { gfx::Rect window_rect = gfx::Rect(desktop_window_->bounds().width(), desktop_window_->bounds().height()); request->set_area(window_rect); - desktop_window_->layer()->RequestCopyOfOutput(request.Pass()); + desktop_window_->layer()->RequestCopyOfOutput(std::move(request)); } } @@ -203,7 +204,7 @@ void AuraWindowCaptureMachine::DidCopyOutput( static bool first_call = true; bool succeeded = ProcessCopyOutputResponse( - video_frame, start_time, capture_frame_cb, result.Pass()); + video_frame, start_time, capture_frame_cb, std::move(result)); base::TimeDelta capture_time = base::TimeTicks::Now() - start_time; diff --git a/content/browser/media/capture/desktop_capture_device.cc b/content/browser/media/capture/desktop_capture_device.cc index 4676357..9359b7c 100644 --- a/content/browser/media/capture/desktop_capture_device.cc +++ b/content/browser/media/capture/desktop_capture_device.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -140,11 +141,10 @@ DesktopCaptureDevice::Core::Core( scoped_ptr<webrtc::DesktopCapturer> capturer, DesktopMediaID::Type type) : task_runner_(task_runner), - desktop_capturer_(capturer.Pass()), + desktop_capturer_(std::move(capturer)), capture_in_progress_(false), first_capture_returned_(false), - capturer_type_(type) { -} + capturer_type_(type) {} DesktopCaptureDevice::Core::~Core() { DCHECK(task_runner_->BelongsToCurrentThread()); @@ -164,7 +164,7 @@ void DesktopCaptureDevice::Core::AllocateAndStart( DCHECK(client.get()); DCHECK(!client_.get()); - client_ = client.Pass(); + client_ = std::move(client); requested_frame_rate_ = params.requested_format.frame_rate; resolution_chooser_.reset(new media::CaptureResolutionChooser( params.requested_format.frame_size, @@ -408,9 +408,9 @@ scoped_ptr<media::VideoCaptureDevice> DesktopCaptureDevice::Create( scoped_ptr<media::VideoCaptureDevice> result; if (capturer) - result.reset(new DesktopCaptureDevice(capturer.Pass(), source.type)); + result.reset(new DesktopCaptureDevice(std::move(capturer), source.type)); - return result.Pass(); + return result; } DesktopCaptureDevice::~DesktopCaptureDevice() { @@ -458,7 +458,7 @@ DesktopCaptureDevice::DesktopCaptureDevice( thread_.StartWithOptions(base::Thread::Options(thread_type, 0)); - core_.reset(new Core(thread_.task_runner(), capturer.Pass(), type)); + core_.reset(new Core(thread_.task_runner(), std::move(capturer), type)); } } // namespace content diff --git a/content/browser/media/capture/desktop_capture_device_aura.cc b/content/browser/media/capture/desktop_capture_device_aura.cc index 097a5b7..39f7a07 100644 --- a/content/browser/media/capture/desktop_capture_device_aura.cc +++ b/content/browser/media/capture/desktop_capture_device_aura.cc @@ -4,6 +4,8 @@ #include "content/browser/media/capture/desktop_capture_device_aura.h" +#include <utility> + #include "base/logging.h" #include "base/timer/timer.h" #include "content/browser/media/capture/aura_window_capture_machine.h" @@ -52,7 +54,7 @@ void DesktopCaptureDeviceAura::AllocateAndStart( const media::VideoCaptureParams& params, scoped_ptr<Client> client) { DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); - core_->AllocateAndStart(params, client.Pass()); + core_->AllocateAndStart(params, std::move(client)); } void DesktopCaptureDeviceAura::StopAndDeAllocate() { diff --git a/content/browser/media/capture/desktop_capture_device_unittest.cc b/content/browser/media/capture/desktop_capture_device_unittest.cc index 93d210b..8a51a80 100644 --- a/content/browser/media/capture/desktop_capture_device_unittest.cc +++ b/content/browser/media/capture/desktop_capture_device_unittest.cc @@ -7,9 +7,9 @@ #include <stddef.h> #include <stdint.h> #include <string.h> - #include <algorithm> #include <string> +#include <utility> #include "base/macros.h" #include "base/synchronization/waitable_event.h" @@ -254,8 +254,8 @@ class FormatChecker { class DesktopCaptureDeviceTest : public testing::Test { public: void CreateScreenCaptureDevice(scoped_ptr<webrtc::DesktopCapturer> capturer) { - capture_device_.reset( - new DesktopCaptureDevice(capturer.Pass(), DesktopMediaID::TYPE_SCREEN)); + capture_device_.reset(new DesktopCaptureDevice( + std::move(capturer), DesktopMediaID::TYPE_SCREEN)); } void CopyFrame(const uint8_t* frame, int size, @@ -282,7 +282,7 @@ TEST_F(DesktopCaptureDeviceTest, MAYBE_Capture) { scoped_ptr<webrtc::DesktopCapturer> capturer( webrtc::ScreenCapturer::Create( webrtc::DesktopCaptureOptions::CreateDefault())); - CreateScreenCaptureDevice(capturer.Pass()); + CreateScreenCaptureDevice(std::move(capturer)); media::VideoCaptureFormat format; base::WaitableEvent done_event(false, false); @@ -299,7 +299,7 @@ TEST_F(DesktopCaptureDeviceTest, MAYBE_Capture) { capture_params.requested_format.frame_size.SetSize(640, 480); capture_params.requested_format.frame_rate = kFrameRate; capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - capture_device_->AllocateAndStart(capture_params, client.Pass()); + capture_device_->AllocateAndStart(capture_params, std::move(client)); EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); capture_device_->StopAndDeAllocate(); @@ -337,7 +337,7 @@ TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeConstantResolution) { capture_params.resolution_change_policy = media::RESOLUTION_POLICY_FIXED_RESOLUTION; - capture_device_->AllocateAndStart(capture_params, client.Pass()); + capture_device_->AllocateAndStart(capture_params, std::move(client)); // Capture at least two frames, to ensure that the source frame size has // changed to two different sizes while capturing. The mock for @@ -381,8 +381,7 @@ TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeFixedAspectRatio) { capture_params.resolution_change_policy = media::RESOLUTION_POLICY_FIXED_ASPECT_RATIO; - capture_device_->AllocateAndStart( - capture_params, client.Pass()); + capture_device_->AllocateAndStart(capture_params, std::move(client)); // Capture at least three frames, to ensure that the source frame size has // changed to two different sizes while capturing. The mock for @@ -426,8 +425,7 @@ TEST_F(DesktopCaptureDeviceTest, ScreenResolutionChangeVariableResolution) { capture_params.resolution_change_policy = media::RESOLUTION_POLICY_ANY_WITHIN_LIMIT; - capture_device_->AllocateAndStart( - capture_params, client.Pass()); + capture_device_->AllocateAndStart(capture_params, std::move(client)); // Capture at least three frames, to ensure that the source frame size has // changed to two different sizes while capturing. The mock for @@ -468,7 +466,7 @@ TEST_F(DesktopCaptureDeviceTest, UnpackedFrame) { capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - capture_device_->AllocateAndStart(capture_params, client.Pass()); + capture_device_->AllocateAndStart(capture_params, std::move(client)); EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); done_event.Reset(); @@ -510,7 +508,7 @@ TEST_F(DesktopCaptureDeviceTest, InvertedFrame) { capture_params.requested_format.frame_rate = kFrameRate; capture_params.requested_format.pixel_format = media::PIXEL_FORMAT_I420; - capture_device_->AllocateAndStart(capture_params, client.Pass()); + capture_device_->AllocateAndStart(capture_params, std::move(client)); EXPECT_TRUE(done_event.TimedWait(TestTimeouts::action_max_timeout())); done_event.Reset(); diff --git a/content/browser/media/capture/web_contents_video_capture_device.cc b/content/browser/media/capture/web_contents_video_capture_device.cc index 0f5de4e..311669f 100644 --- a/content/browser/media/capture/web_contents_video_capture_device.cc +++ b/content/browser/media/capture/web_contents_video_capture_device.cc @@ -50,9 +50,9 @@ #include "content/browser/media/capture/web_contents_video_capture_device.h" -#include <algorithm> - #include <stdint.h> +#include <algorithm> +#include <utility> #include "base/bind.h" #include "base/callback_helpers.h" @@ -466,7 +466,7 @@ ContentCaptureSubscription::ContentCaptureSubscription( : base::WeakPtr<CursorRenderer>(), window_activity_tracker_ ? window_activity_tracker_->GetWeakPtr() : base::WeakPtr<WindowActivityTracker>())); - view->BeginFrameSubscription(subscriber.Pass()); + view->BeginFrameSubscription(std::move(subscriber)); } // Subscribe to timer events. This instance will service these as well. @@ -966,7 +966,7 @@ void WebContentsVideoCaptureDevice::AllocateAndStart( const media::VideoCaptureParams& params, scoped_ptr<Client> client) { DVLOG(1) << "Allocating " << params.requested_format.frame_size.ToString(); - core_->AllocateAndStart(params, client.Pass()); + core_->AllocateAndStart(params, std::move(client)); } void WebContentsVideoCaptureDevice::StopAndDeAllocate() { diff --git a/content/browser/media/capture/web_contents_video_capture_device_unittest.cc b/content/browser/media/capture/web_contents_video_capture_device_unittest.cc index 553eb72..3e3ff06 100644 --- a/content/browser/media/capture/web_contents_video_capture_device_unittest.cc +++ b/content/browser/media/capture/web_contents_video_capture_device_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind_helpers.h" #include "base/debug/debugger.h" @@ -428,7 +429,7 @@ class StubClient : public media::VideoCaptureDevice::Client { int buffer_id) : id_(buffer_id), pool_(pool), - buffer_handle_(buffer_handle.Pass()) { + buffer_handle_(std::move(buffer_handle)) { DCHECK(pool_.get()); } int id() const override { return id_; } @@ -474,7 +475,7 @@ class StubClientObserver { virtual ~StubClientObserver() {} scoped_ptr<media::VideoCaptureDevice::Client> PassClient() { - return client_.Pass(); + return std::move(client_); } void QuitIfConditionsMet(SkColor color, const gfx::Size& size) { diff --git a/content/browser/media/media_internals.cc b/content/browser/media/media_internals.cc index dc08926..c645576 100644 --- a/content/browser/media/media_internals.cc +++ b/content/browser/media/media_internals.cc @@ -5,6 +5,7 @@ #include "content/browser/media/media_internals.h" #include <stddef.h> +#include <utility> #include "base/macros.h" #include "base/metrics/histogram.h" @@ -209,7 +210,7 @@ void AudioLogImpl::SendWebContentsTitle(int component_id, int render_frame_id) { scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue()); StoreComponentMetadata(component_id, dict.get()); - SendWebContentsTitleHelper(FormatCacheKey(component_id), dict.Pass(), + SendWebContentsTitleHelper(FormatCacheKey(component_id), std::move(dict), render_process_id, render_frame_id); } diff --git a/content/browser/media/webrtc_internals.cc b/content/browser/media/webrtc_internals.cc index 0528f0f..40aa91b 100644 --- a/content/browser/media/webrtc_internals.cc +++ b/content/browser/media/webrtc_internals.cc @@ -481,11 +481,9 @@ void WebRTCInternals::CreateOrReleasePowerSaveBlocker() { } else if (!peer_connection_data_.empty() && !power_save_blocker_) { DVLOG(1) << ("Preventing the application from being suspended while one or " "more PeerConnections are active."); - power_save_blocker_ = - content::PowerSaveBlocker::Create( - PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, - PowerSaveBlocker::kReasonOther, - "WebRTC has active PeerConnections").Pass(); + power_save_blocker_ = content::PowerSaveBlocker::Create( + PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, + PowerSaveBlocker::kReasonOther, "WebRTC has active PeerConnections"); } } diff --git a/content/browser/mojo/mojo_app_connection_impl.cc b/content/browser/mojo/mojo_app_connection_impl.cc index 4fe8584..2f55450 100644 --- a/content/browser/mojo/mojo_app_connection_impl.cc +++ b/content/browser/mojo/mojo_app_connection_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/mojo/mojo_app_connection_impl.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "content/browser/mojo/mojo_shell_context.h" @@ -40,7 +41,7 @@ MojoAppConnectionImpl::~MojoAppConnectionImpl() { void MojoAppConnectionImpl::ConnectToService( const std::string& service_name, mojo::ScopedMessagePipeHandle handle) { - services_->ConnectToService(service_name, handle.Pass()); + services_->ConnectToService(service_name, std::move(handle)); } } // namespace content diff --git a/content/browser/mojo/mojo_application_host.cc b/content/browser/mojo/mojo_application_host.cc index 38aa8584..12895d5 100644 --- a/content/browser/mojo/mojo_application_host.cc +++ b/content/browser/mojo/mojo_application_host.cc @@ -4,6 +4,8 @@ #include "content/browser/mojo/mojo_application_host.h" +#include <utility> + #include "build/build_config.h" #include "content/common/mojo/mojo_messages.h" #include "content/public/browser/browser_thread.h" @@ -26,9 +28,8 @@ class ApplicationSetupImpl : public ApplicationSetup { public: ApplicationSetupImpl(ServiceRegistryImpl* service_registry, mojo::InterfaceRequest<ApplicationSetup> request) - : binding_(this, request.Pass()), - service_registry_(service_registry) { - } + : binding_(this, std::move(request)), + service_registry_(service_registry) {} ~ApplicationSetupImpl() override { } @@ -38,8 +39,8 @@ class ApplicationSetupImpl : public ApplicationSetup { void ExchangeServiceProviders( mojo::InterfaceRequest<mojo::ServiceProvider> services, mojo::ServiceProviderPtr exposed_services) override { - service_registry_->Bind(services.Pass()); - service_registry_->BindRemoteServiceProvider(exposed_services.Pass()); + service_registry_->Bind(std::move(services)); + service_registry_->BindRemoteServiceProvider(std::move(exposed_services)); } mojo::Binding<ApplicationSetup> binding_; @@ -84,7 +85,7 @@ bool MojoApplicationHost::Init() { application_setup_.reset(new ApplicationSetupImpl( &service_registry_, - mojo::MakeRequest<ApplicationSetup>(message_pipe.Pass()))); + mojo::MakeRequest<ApplicationSetup>(std::move(message_pipe)))); return true; } @@ -94,7 +95,7 @@ void MojoApplicationHost::Activate(IPC::Sender* sender, DCHECK(client_handle_.is_valid()); base::PlatformFile client_file = - PlatformFileFromScopedPlatformHandle(client_handle_.Pass()); + PlatformFileFromScopedPlatformHandle(std::move(client_handle_)); did_activate_ = sender->Send(new MojoMsg_Activate( IPC::GetFileHandleForProcess(client_file, process_handle, true))); } diff --git a/content/browser/mojo/mojo_shell_client_host.cc b/content/browser/mojo/mojo_shell_client_host.cc index 6e4cfbf..6725e6f 100644 --- a/content/browser/mojo/mojo_shell_client_host.cc +++ b/content/browser/mojo/mojo_shell_client_host.cc @@ -2,13 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/mojo/mojo_shell_client_host.h" + #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/strings/stringprintf.h" #include "base/thread_task_runner_handle.h" #include "build/build_config.h" -#include "content/browser/mojo/mojo_shell_client_host.h" #include "content/common/mojo/mojo_messages.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/render_process_host.h" @@ -103,7 +105,7 @@ void RegisterChildWithExternalShell(int child_process_id, mojo::embedder::ScopedPlatformHandle platform_channel = platform_channel_pair.PassServerHandle(); mojo::ScopedMessagePipeHandle handle(mojo::embedder::CreateChannel( - platform_channel.Pass(), base::Bind(&DidCreateChannel), + std::move(platform_channel), base::Bind(&DidCreateChannel), base::ThreadTaskRunnerHandle::Get())); mojo::shell::mojom::ApplicationManagerPtr application_manager; MojoShellConnection::Get()->GetApplication()->ConnectToService( diff --git a/content/browser/mojo/mojo_shell_context.cc b/content/browser/mojo/mojo_shell_context.cc index 36ec546..7fff88e 100644 --- a/content/browser/mojo/mojo_shell_context.cc +++ b/content/browser/mojo/mojo_shell_context.cc @@ -4,6 +4,8 @@ #include "content/browser/mojo/mojo_shell_context.h" +#include <utility> + #include "base/lazy_instance.h" #include "base/macros.h" #include "base/path_service.h" @@ -52,7 +54,7 @@ void StartUtilityProcessOnIOThread( process_host->StartMojoMode(); ServiceRegistry* services = process_host->GetServiceRegistry(); - services->ConnectToRemoteService(request.Pass()); + services->ConnectToRemoteService(std::move(request)); } void OnApplicationLoaded(const GURL& url, bool success) { @@ -96,7 +98,7 @@ class UtilityProcessLoader : public mojo::shell::ApplicationLoader { base::Bind(&StartUtilityProcessOnIOThread, base::Passed(&process_request), process_name_, use_sandbox_)); - process_control->LoadApplication(url.spec(), application_request.Pass(), + process_control->LoadApplication(url.spec(), std::move(application_request), base::Bind(&OnApplicationLoaded, url)); } @@ -120,7 +122,8 @@ void RequestGpuProcessControl(mojo::InterfaceRequest<ProcessControl> request) { // process is dead. In that case, |request| will be dropped and application // load requests through ProcessControl will also fail. Make sure we handle // these cases correctly. - process_host->GetServiceRegistry()->ConnectToRemoteService(request.Pass()); + process_host->GetServiceRegistry()->ConnectToRemoteService( + std::move(request)); } // Forwards the load request to the GPU process. @@ -139,7 +142,7 @@ class GpuProcessLoader : public mojo::shell::ApplicationLoader { BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&RequestGpuProcessControl, base::Passed(&process_request))); - process_control->LoadApplication(url.spec(), application_request.Pass(), + process_control->LoadApplication(url.spec(), std::move(application_request), base::Bind(&OnApplicationLoaded, url)); } @@ -167,8 +170,8 @@ class MojoShellContext::Proxy { if (task_runner_ == base::ThreadTaskRunnerHandle::Get()) { if (shell_context_) { shell_context_->ConnectToApplicationOnOwnThread( - url, requestor_url, request.Pass(), exposed_services.Pass(), filter, - callback); + url, requestor_url, std::move(request), std::move(exposed_services), + filter, callback); } } else { // |shell_context_| outlives the main MessageLoop, so it's safe for it to @@ -206,7 +209,7 @@ MojoShellContext::MojoShellContext() { scoped_ptr<mojo::package_manager::PackageManagerImpl> package_manager( new mojo::package_manager::PackageManagerImpl(base::FilePath(), nullptr)); application_manager_.reset( - new mojo::shell::ApplicationManager(package_manager.Pass())); + new mojo::shell::ApplicationManager(std::move(package_manager))); application_manager_->set_default_loader( scoped_ptr<mojo::shell::ApplicationLoader>(new DefaultApplicationLoader)); @@ -272,9 +275,9 @@ void MojoShellContext::ConnectToApplication( mojo::ServiceProviderPtr exposed_services, const mojo::shell::CapabilityFilter& filter, const mojo::Shell::ConnectToApplicationCallback& callback) { - proxy_.Get()->ConnectToApplication(url, requestor_url, - request.Pass(), exposed_services.Pass(), - filter, callback); + proxy_.Get()->ConnectToApplication(url, requestor_url, std::move(request), + std::move(exposed_services), filter, + callback); } void MojoShellContext::ConnectToApplicationOnOwnThread( @@ -290,11 +293,11 @@ void MojoShellContext::ConnectToApplicationOnOwnThread( mojo::shell::Identity(requestor_url, std::string(), mojo::shell::GetPermissiveCapabilityFilter())); params->SetTarget(mojo::shell::Identity(url, std::string(), filter)); - params->set_services(request.Pass()); - params->set_exposed_services(exposed_services.Pass()); + params->set_services(std::move(request)); + params->set_exposed_services(std::move(exposed_services)); params->set_on_application_end(base::Bind(&base::DoNothing)); params->set_connect_callback(callback); - application_manager_->ConnectToApplication(params.Pass()); + application_manager_->ConnectToApplication(std::move(params)); } } // namespace content diff --git a/content/browser/mojo/renderer_capability_filter.cc b/content/browser/mojo/renderer_capability_filter.cc index 871e692..01a8e62 100644 --- a/content/browser/mojo/renderer_capability_filter.cc +++ b/content/browser/mojo/renderer_capability_filter.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "components/mus/public/interfaces/gpu.mojom.h" #include "content/browser/mojo/mojo_shell_client_host.h" @@ -13,7 +15,7 @@ mojo::CapabilityFilterPtr CreateCapabilityFilterForRenderer() { mojo::CapabilityFilterPtr filter(mojo::CapabilityFilter::New()); mojo::Array<mojo::String> window_manager_interfaces; window_manager_interfaces.push_back(mus::mojom::Gpu::Name_); - filter->filter.insert("mojo:mus", window_manager_interfaces.Pass()); + filter->filter.insert("mojo:mus", std::move(window_manager_interfaces)); return filter; } diff --git a/content/browser/navigator_connect/service_port_service_impl.cc b/content/browser/navigator_connect/service_port_service_impl.cc index 6b57df5..310c304 100644 --- a/content/browser/navigator_connect/service_port_service_impl.cc +++ b/content/browser/navigator_connect/service_port_service_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/navigator_connect/service_port_service_impl.h" +#include <utility> + #include "content/browser/message_port_message_filter.h" #include "content/browser/message_port_service.h" #include "content/browser/navigator_connect/navigator_connect_context_impl.h" @@ -65,14 +67,14 @@ void ServicePortServiceImpl::CreateOnIOThread( mojo::InterfaceRequest<ServicePortService> request) { DCHECK_CURRENTLY_ON(BrowserThread::IO); new ServicePortServiceImpl(navigator_connect_context, - message_port_message_filter, request.Pass()); + message_port_message_filter, std::move(request)); } ServicePortServiceImpl::ServicePortServiceImpl( const scoped_refptr<NavigatorConnectContextImpl>& navigator_connect_context, const scoped_refptr<MessagePortMessageFilter>& message_port_message_filter, mojo::InterfaceRequest<ServicePortService> request) - : binding_(this, request.Pass()), + : binding_(this, std::move(request)), navigator_connect_context_(navigator_connect_context), message_port_message_filter_(message_port_message_filter), weak_ptr_factory_(this) { @@ -82,7 +84,7 @@ ServicePortServiceImpl::ServicePortServiceImpl( void ServicePortServiceImpl::SetClient(ServicePortServiceClientPtr client) { DCHECK(!client_.get()); // TODO(mek): Set ErrorHandler to listen for errors. - client_ = client.Pass(); + client_ = std::move(client); } void ServicePortServiceImpl::Connect(const mojo::String& target_url, diff --git a/content/browser/permissions/permission_service_context.cc b/content/browser/permissions/permission_service_context.cc index ec8c386..91bd4d0 100644 --- a/content/browser/permissions/permission_service_context.cc +++ b/content/browser/permissions/permission_service_context.cc @@ -4,6 +4,8 @@ #include "content/browser/permissions/permission_service_context.h" +#include <utility> + #include "content/browser/permissions/permission_service_impl.h" #include "content/public/browser/navigation_details.h" #include "content/public/browser/render_frame_host.h" @@ -31,7 +33,7 @@ PermissionServiceContext::~PermissionServiceContext() { void PermissionServiceContext::CreateService( mojo::InterfaceRequest<PermissionService> request) { - services_.push_back(new PermissionServiceImpl(this, request.Pass())); + services_.push_back(new PermissionServiceImpl(this, std::move(request))); } void PermissionServiceContext::ServiceHadConnectionError( diff --git a/content/browser/permissions/permission_service_impl.cc b/content/browser/permissions/permission_service_impl.cc index dcda4ad..ce1f25f 100644 --- a/content/browser/permissions/permission_service_impl.cc +++ b/content/browser/permissions/permission_service_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/permissions/permission_service_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "content/public/browser/browser_context.h" @@ -67,7 +68,7 @@ PermissionServiceImpl::PendingRequest::~PendingRequest() { mojo::Array<PermissionStatus>::New(request_count); for (int i = 0; i < request_count; ++i) result[i] = PERMISSION_STATUS_DENIED; - callback.Run(result.Pass()); + callback.Run(std::move(result)); } PermissionServiceImpl::PendingSubscription::PendingSubscription( @@ -89,7 +90,7 @@ PermissionServiceImpl::PermissionServiceImpl( PermissionServiceContext* context, mojo::InterfaceRequest<PermissionService> request) : context_(context), - binding_(this, request.Pass()), + binding_(this, std::move(request)), weak_factory_(this) { binding_.set_connection_error_handler( base::Bind(&PermissionServiceImpl::OnConnectionError, @@ -176,7 +177,7 @@ void PermissionServiceImpl::RequestPermissions( mojo::Array<PermissionStatus> result(permissions.size()); for (size_t i = 0; i < permissions.size(); ++i) result[i] = GetPermissionStatusFromName(permissions[i], GURL(origin)); - callback.Run(result.Pass()); + callback.Run(std::move(result)); return; } diff --git a/content/browser/power_usage_monitor_impl.cc b/content/browser/power_usage_monitor_impl.cc index 92d835a..65d4d9d 100644 --- a/content/browser/power_usage_monitor_impl.cc +++ b/content/browser/power_usage_monitor_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/power_usage_monitor_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -249,7 +250,7 @@ void PowerUsageMonitor::OnRenderProcessNotification(int type, int rph_id) { void PowerUsageMonitor::SetSystemInterfaceForTest( scoped_ptr<SystemInterface> interface) { - system_interface_ = interface.Pass(); + system_interface_ = std::move(interface); } void PowerUsageMonitor::OnPowerStateChange(bool on_battery_power) { diff --git a/content/browser/power_usage_monitor_impl_unittest.cc b/content/browser/power_usage_monitor_impl_unittest.cc index efa46f2..2aac585 100644 --- a/content/browser/power_usage_monitor_impl_unittest.cc +++ b/content/browser/power_usage_monitor_impl_unittest.cc @@ -4,6 +4,8 @@ #include "content/browser/power_usage_monitor_impl.h" +#include <utility> + #include "content/public/browser/notification_types.h" #include "content/public/test/test_browser_thread_bundle.h" #include "device/battery/battery_monitor.mojom.h" @@ -66,7 +68,7 @@ class PowerUsageMonitorTest : public testing::Test { scoped_ptr<SystemInterfaceForTest> test_interface( new SystemInterfaceForTest()); system_interface_ = test_interface.get(); - monitor_->SetSystemInterfaceForTest(test_interface.Pass()); + monitor_->SetSystemInterfaceForTest(std::move(test_interface)); // Without live renderers, the monitor won't do anything. monitor_->OnRenderProcessNotification(NOTIFICATION_RENDERER_PROCESS_CREATED, diff --git a/content/browser/presentation/presentation_service_impl.cc b/content/browser/presentation/presentation_service_impl.cc index 569c9e6..0764458 100644 --- a/content/browser/presentation/presentation_service_impl.cc +++ b/content/browser/presentation/presentation_service_impl.cc @@ -6,9 +6,9 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <string> +#include <utility> #include <vector> #include "base/logging.h" @@ -64,7 +64,7 @@ presentation::SessionMessagePtr ToMojoSessionMessage( output->message = input->message; } } - return output.Pass(); + return output; } scoped_ptr<PresentationSessionMessage> GetPresentationSessionMessage( @@ -77,41 +77,41 @@ scoped_ptr<PresentationSessionMessage> GetPresentationSessionMessage( DCHECK(input->data.is_null()); // Return null PresentationSessionMessage if size exceeds. if (input->message.size() > content::kMaxPresentationSessionMessageSize) - return output.Pass(); + return output; output.reset( new PresentationSessionMessage(PresentationMessageType::TEXT)); input->message.Swap(&output->message); - return output.Pass(); + return output; } case presentation::PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER: { DCHECK(!input->data.is_null()); DCHECK(input->message.is_null()); if (input->data.size() > content::kMaxPresentationSessionMessageSize) - return output.Pass(); + return output; output.reset(new PresentationSessionMessage( PresentationMessageType::ARRAY_BUFFER)); output->data.reset(new std::vector<uint8_t>); input->data.Swap(output->data.get()); - return output.Pass(); + return output; } case presentation::PRESENTATION_MESSAGE_TYPE_BLOB: { DCHECK(!input->data.is_null()); DCHECK(input->message.is_null()); if (input->data.size() > content::kMaxPresentationSessionMessageSize) - return output.Pass(); + return output; output.reset( new PresentationSessionMessage(PresentationMessageType::BLOB)); output->data.reset(new std::vector<uint8_t>); input->data.Swap(output->data.get()); - return output.Pass(); + return output; } } NOTREACHED() << "Invalid presentation message type " << input->type; - return output.Pass(); + return output; } void InvokeNewSessionMojoCallbackWithError( @@ -165,13 +165,13 @@ void PresentationServiceImpl::CreateMojoService( web_contents, GetContentClient()->browser()->GetPresentationServiceDelegate( web_contents)); - impl->Bind(request.Pass()); + impl->Bind(std::move(request)); } void PresentationServiceImpl::Bind( mojo::InterfaceRequest<presentation::PresentationService> request) { binding_.reset(new mojo::Binding<presentation::PresentationService>( - this, request.Pass())); + this, std::move(request))); binding_->set_connection_error_handler([this]() { DVLOG(1) << "Connection error"; delete this; @@ -182,7 +182,7 @@ void PresentationServiceImpl::SetClient( presentation::PresentationServiceClientPtr client) { DCHECK(!client_.get()); // TODO(imcheng): Set ErrorHandler to listen for errors. - client_ = client.Pass(); + client_ = std::move(client); } void PresentationServiceImpl::ListenForScreenAvailability( @@ -203,7 +203,7 @@ void PresentationServiceImpl::ListenForScreenAvailability( render_process_id_, render_frame_id_, listener.get())) { - screen_availability_listeners_[availability_url] = listener.Pass(); + screen_availability_listeners_[availability_url] = std::move(listener); } else { DVLOG(1) << "AddScreenAvailabilityListener failed. Ignoring request."; } @@ -363,7 +363,7 @@ bool PresentationServiceImpl::RunAndEraseJoinSessionMojoCallback( return false; DCHECK(it->second.get()); - it->second->Run(session.Pass(), error.Pass()); + it->second->Run(std::move(session), std::move(error)); pending_join_session_cbs_.erase(it); return true; } @@ -402,7 +402,7 @@ void PresentationServiceImpl::SendSessionMessage( delegate_->SendMessage( render_process_id_, render_frame_id_, session.To<PresentationSessionInfo>(), - GetPresentationSessionMessage(session_message.Pass()), + GetPresentationSessionMessage(std::move(session_message)), base::Bind(&PresentationServiceImpl::OnSendMessageCallback, weak_factory_.GetWeakPtr())); } @@ -476,7 +476,7 @@ void PresentationServiceImpl::OnSessionMessages( client_->OnSessionMessagesReceived( presentation::PresentationSessionInfo::From(session), - mojoMessages.Pass()); + std::move(mojoMessages)); } void PresentationServiceImpl::DidNavigateAnyFrame( @@ -600,7 +600,7 @@ void PresentationServiceImpl::NewSessionMojoCallbackWrapper::Run( presentation::PresentationSessionInfoPtr session, presentation::PresentationErrorPtr error) { DCHECK(!callback_.is_null()); - callback_.Run(session.Pass(), error.Pass()); + callback_.Run(std::move(session), std::move(error)); callback_.reset(); } diff --git a/content/browser/presentation/presentation_service_impl_unittest.cc b/content/browser/presentation/presentation_service_impl_unittest.cc index 657350c..cc98878 100644 --- a/content/browser/presentation/presentation_service_impl_unittest.cc +++ b/content/browser/presentation/presentation_service_impl_unittest.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/presentation/presentation_service_impl.h" + #include <stddef.h> #include <stdint.h> - #include <string> +#include <utility> #include <vector> #include "base/location.h" @@ -14,7 +16,6 @@ #include "base/single_thread_task_runner.h" #include "base/test/test_timeouts.h" #include "base/thread_task_runner_handle.h" -#include "content/browser/presentation/presentation_service_impl.h" #include "content/public/browser/presentation_service_delegate.h" #include "content/public/browser/presentation_session.h" #include "content/public/common/presentation_constants.h" @@ -167,7 +168,7 @@ class MockPresentationServiceClient : void OnSessionMessagesReceived( presentation::PresentationSessionInfoPtr session_info, mojo::Array<presentation::SessionMessagePtr> messages) override { - messages_received_ = messages.Pass(); + messages_received_ = std::move(messages); MessagesReceived(); } MOCK_METHOD0(MessagesReceived, void()); @@ -193,13 +194,13 @@ class PresentationServiceImplTest : public RenderViewHostImplTestHarness { EXPECT_CALL(mock_delegate_, AddObserver(_, _, _)).Times(1); service_impl_.reset(new PresentationServiceImpl( contents()->GetMainFrame(), contents(), &mock_delegate_)); - service_impl_->Bind(request.Pass()); + service_impl_->Bind(std::move(request)); presentation::PresentationServiceClientPtr client_ptr; client_binding_.reset( new mojo::Binding<presentation::PresentationServiceClient>( &mock_client_, mojo::GetProxy(&client_ptr))); - service_impl_->SetClient(client_ptr.Pass()); + service_impl_->SetClient(std::move(client_ptr)); } void TearDown() override { @@ -335,18 +336,18 @@ class PresentationServiceImplTest : public RenderViewHostImplTestHarness { message.reset( new content::PresentationSessionMessage(PresentationMessageType::TEXT)); message->message = text_msg; - messages.push_back(message.Pass()); + messages.push_back(std::move(message)); message.reset(new content::PresentationSessionMessage( PresentationMessageType::ARRAY_BUFFER)); message->data.reset(new std::vector<uint8_t>(binary_data)); - messages.push_back(message.Pass()); + messages.push_back(std::move(message)); std::vector<presentation::SessionMessagePtr> actual_msgs; { base::RunLoop run_loop; EXPECT_CALL(mock_client_, MessagesReceived()) .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); - message_cb.Run(messages.Pass(), pass_ownership); + message_cb.Run(std::move(messages), pass_ownership); run_loop.Run(); } ExpectSessionMessages(expected_msgs, mock_client_.messages_received_); @@ -639,7 +640,7 @@ TEST_F(PresentationServiceImplTest, SendStringMessage) { PRESENTATION_MESSAGE_TYPE_TEXT; message_request->message = message; service_ptr_->SendSessionMessage( - session.Pass(), message_request.Pass(), + std::move(session), std::move(message_request), base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, base::Unretained(this))); @@ -678,7 +679,7 @@ TEST_F(PresentationServiceImplTest, SendArrayBuffer) { PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER; message_request->data = mojo::Array<uint8_t>::From(data); service_ptr_->SendSessionMessage( - session.Pass(), message_request.Pass(), + std::move(session), std::move(message_request), base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, base::Unretained(this))); @@ -723,7 +724,7 @@ TEST_F(PresentationServiceImplTest, SendArrayBufferWithExceedingLimit) { PRESENTATION_MESSAGE_TYPE_ARRAY_BUFFER; message_request->data = mojo::Array<uint8_t>::From(data); service_ptr_->SendSessionMessage( - session.Pass(), message_request.Pass(), + std::move(session), std::move(message_request), base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, base::Unretained(this))); @@ -755,7 +756,7 @@ TEST_F(PresentationServiceImplTest, SendBlobData) { presentation::PresentationMessageType::PRESENTATION_MESSAGE_TYPE_BLOB; message_request->data = mojo::Array<uint8_t>::From(data); service_ptr_->SendSessionMessage( - session.Pass(), message_request.Pass(), + std::move(session), std::move(message_request), base::Bind(&PresentationServiceImplTest::ExpectSendMessageMojoCallback, base::Unretained(this))); diff --git a/content/browser/presentation/presentation_type_converters.h b/content/browser/presentation/presentation_type_converters.h index 807368a..c707f4f 100644 --- a/content/browser/presentation/presentation_type_converters.h +++ b/content/browser/presentation/presentation_type_converters.h @@ -30,7 +30,7 @@ struct TypeConverter<presentation::PresentationSessionInfoPtr, presentation::PresentationSessionInfo::New()); output->url = input.presentation_url; output->id = input.presentation_id; - return output.Pass(); + return output; } }; @@ -52,7 +52,7 @@ struct TypeConverter<presentation::PresentationErrorPtr, presentation::PresentationError::New()); output->error_type = PresentationErrorTypeToMojo(input.error_type); output->message = input.message; - return output.Pass(); + return output; } }; diff --git a/content/browser/quota/quota_reservation_manager_unittest.cc b/content/browser/quota/quota_reservation_manager_unittest.cc index 7aca253..d2588e1 100644 --- a/content/browser/quota/quota_reservation_manager_unittest.cc +++ b/content/browser/quota/quota_reservation_manager_unittest.cc @@ -2,9 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include "storage/browser/fileapi/quota/quota_reservation_manager.h" - #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -18,6 +17,7 @@ #include "base/thread_task_runner_handle.h" #include "storage/browser/fileapi/quota/open_file_handle.h" #include "storage/browser/fileapi/quota/quota_reservation.h" +#include "storage/browser/fileapi/quota/quota_reservation_manager.h" #include "testing/gtest/include/gtest/gtest.h" using storage::kFileSystemTypeTemporary; @@ -102,12 +102,11 @@ class FakeBackend : public QuotaReservationManager::QuotaBackend { class FakeWriter { public: explicit FakeWriter(scoped_ptr<OpenFileHandle> handle) - : handle_(handle.Pass()), + : handle_(std::move(handle)), path_(handle_->platform_path()), max_written_offset_(handle_->GetEstimatedFileSize()), append_mode_write_amount_(0), - dirty_(false) { - } + dirty_(false) {} ~FakeWriter() { if (handle_) @@ -193,7 +192,7 @@ class QuotaReservationManagerTest : public testing::Test { SetFileSize(file_path_, kInitialFileSize); scoped_ptr<QuotaReservationManager::QuotaBackend> backend(new FakeBackend); - reservation_manager_.reset(new QuotaReservationManager(backend.Pass())); + reservation_manager_.reset(new QuotaReservationManager(std::move(backend))); } void TearDown() override { reservation_manager_.reset(); } diff --git a/content/browser/renderer_host/database_message_filter.cc b/content/browser/renderer_host/database_message_filter.cc index 15d1a2a..9c9f16e 100644 --- a/content/browser/renderer_host/database_message_filter.cc +++ b/content/browser/renderer_host/database_message_filter.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/database_message_filter.h" #include <string> +#include <utility> #include "base/bind.h" #include "base/metrics/histogram.h" @@ -147,8 +148,8 @@ void DatabaseMessageFilter::OnDatabaseOpenFile( VfsBackend::OpenFile(db_file, desired_flags | SQLITE_OPEN_DELETEONCLOSE); if (!(desired_flags & SQLITE_OPEN_DELETEONCLOSE)) { - tracked_file = db_tracker_->SaveIncognitoFile(vfs_file_name, - file.Pass()); + tracked_file = + db_tracker_->SaveIncognitoFile(vfs_file_name, std::move(file)); } } } else { @@ -162,7 +163,7 @@ void DatabaseMessageFilter::OnDatabaseOpenFile( // database tracker. *handle = IPC::InvalidPlatformFileForTransit(); if (file.IsValid()) { - *handle = IPC::TakeFileHandleForProcess(file.Pass(), PeerHandle()); + *handle = IPC::TakeFileHandleForProcess(std::move(file), PeerHandle()); } else if (tracked_file) { DCHECK(tracked_file->IsValid()); *handle = diff --git a/content/browser/renderer_host/input/composited_scrolling_browsertest.cc b/content/browser/renderer_host/input/composited_scrolling_browsertest.cc index a23e509..cbf48e8 100644 --- a/content/browser/renderer_host/input/composited_scrolling_browsertest.cc +++ b/content/browser/renderer_host/input/composited_scrolling_browsertest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/macros.h" @@ -130,7 +132,7 @@ class CompositedScrollingBrowserTest : public ContentBrowserTest { scoped_ptr<SyntheticSmoothScrollGesture> gesture( new SyntheticSmoothScrollGesture(params)); GetWidgetHost()->QueueSyntheticGesture( - gesture.Pass(), + std::move(gesture), base::Bind(&CompositedScrollingBrowserTest::OnSyntheticGestureCompleted, base::Unretained(this))); diff --git a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc index 7e7c6e7..4408727 100644 --- a/content/browser/renderer_host/input/gesture_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/gesture_event_queue_unittest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> +#include "content/browser/renderer_host/input/gesture_event_queue.h" +#include <stddef.h> +#include <utility> #include <vector> #include "base/location.h" @@ -13,7 +15,6 @@ #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "base/time/time.h" -#include "content/browser/renderer_host/input/gesture_event_queue.h" #include "content/browser/renderer_host/input/touchpad_tap_suppression_controller.h" #include "content/common/input/input_event_ack_state.h" #include "content/common/input/synthetic_web_input_event_builders.h" @@ -53,7 +54,7 @@ class GestureEventQueueTest : public testing::Test, const GestureEventWithLatencyInfo& event) override { ++sent_gesture_event_count_; if (sync_ack_result_) { - scoped_ptr<InputEventAckState> ack_result = sync_ack_result_.Pass(); + scoped_ptr<InputEventAckState> ack_result = std::move(sync_ack_result_); SendInputEventACK(event.event.type, *ack_result); } } @@ -63,7 +64,7 @@ class GestureEventQueueTest : public testing::Test, ++acked_gesture_event_count_; last_acked_event_ = event.event; if (sync_followup_event_) { - auto sync_followup_event = sync_followup_event_.Pass(); + auto sync_followup_event = std::move(sync_followup_event_); SimulateGestureEvent(*sync_followup_event); } } diff --git a/content/browser/renderer_host/input/input_router_impl.cc b/content/browser/renderer_host/input/input_router_impl.cc index d88634d..dcae714 100644 --- a/content/browser/renderer_host/input/input_router_impl.cc +++ b/content/browser/renderer_host/input/input_router_impl.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/input/input_router_impl.h" #include <math.h> +#include <utility> #include "base/auto_reset.h" #include "base/command_line.h" @@ -96,9 +97,9 @@ bool InputRouterImpl::SendInput(scoped_ptr<IPC::Message> message) { // Check for types that require an ACK. case InputMsg_SelectRange::ID: case InputMsg_MoveRangeSelectionExtent::ID: - return SendSelectMessage(message.Pass()); + return SendSelectMessage(std::move(message)); case InputMsg_MoveCaret::ID: - return SendMoveCaret(message.Pass()); + return SendMoveCaret(std::move(message)); case InputMsg_HandleInputEvent::ID: NOTREACHED() << "WebInputEvents should never be sent via SendInput."; return false; @@ -328,7 +329,7 @@ bool InputRouterImpl::SendSelectMessage( bool InputRouterImpl::SendMoveCaret(scoped_ptr<IPC::Message> message) { DCHECK(message->type() == InputMsg_MoveCaret::ID); if (move_caret_pending_) { - next_move_caret_ = message.Pass(); + next_move_caret_ = std::move(message); return true; } @@ -460,7 +461,7 @@ void InputRouterImpl::OnDidOverscroll(const DidOverscrollParams& params) { void InputRouterImpl::OnMsgMoveCaretAck() { move_caret_pending_ = false; if (next_move_caret_) - SendMoveCaret(next_move_caret_.Pass()); + SendMoveCaret(std::move(next_move_caret_)); } void InputRouterImpl::OnSelectMessageAck() { @@ -470,7 +471,7 @@ void InputRouterImpl::OnSelectMessageAck() { make_scoped_ptr(pending_select_messages_.front()); pending_select_messages_.pop_front(); - SendSelectMessage(next_message.Pass()); + SendSelectMessage(std::move(next_message)); } } @@ -585,8 +586,8 @@ void InputRouterImpl::ProcessMouseAck(blink::WebInputEvent::Type type, if (next_mouse_move_) { DCHECK(next_mouse_move_->event.type == WebInputEvent::MouseMove); - scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move - = next_mouse_move_.Pass(); + scoped_ptr<MouseEventWithLatencyInfo> next_mouse_move = + std::move(next_mouse_move_); SendMouseEvent(*next_mouse_move); } } diff --git a/content/browser/renderer_host/input/mock_input_ack_handler.h b/content/browser/renderer_host/input/mock_input_ack_handler.h index a0e1aa9..4753a15 100644 --- a/content/browser/renderer_host/input/mock_input_ack_handler.h +++ b/content/browser/renderer_host/input/mock_input_ack_handler.h @@ -6,6 +6,7 @@ #define CONTENT_BROWSER_RENDERER_HOST_INPUT_MOCK_INPUT_ACK_HANDLER_H_ #include <stddef.h> +#include <utility> #include "base/memory/scoped_ptr.h" #include "content/browser/renderer_host/input/input_ack_handler.h" @@ -39,11 +40,11 @@ class MockInputAckHandler : public InputAckHandler { } void set_followup_touch_event(scoped_ptr<GestureEventWithLatencyInfo> event) { - gesture_followup_event_ = event.Pass(); + gesture_followup_event_ = std::move(event); } void set_followup_touch_event(scoped_ptr<TouchEventWithLatencyInfo> event) { - touch_followup_event_ = event.Pass(); + touch_followup_event_ = std::move(event); } bool unexpected_event_ack_called() const { diff --git a/content/browser/renderer_host/input/stylus_text_selector.cc b/content/browser/renderer_host/input/stylus_text_selector.cc index 11cace7..20eee82 100644 --- a/content/browser/renderer_host/input/stylus_text_selector.cc +++ b/content/browser/renderer_host/input/stylus_text_selector.cc @@ -30,7 +30,7 @@ scoped_ptr<GestureDetector> CreateGestureDetector( detector->set_longpress_enabled(false); detector->set_showpress_enabled(false); - return detector.Pass(); + return detector; } } // namespace diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller.cc b/content/browser/renderer_host/input/synthetic_gesture_controller.cc index 536426b..109ce34 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_controller.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/input/synthetic_gesture_controller.h" +#include <utility> + #include "base/trace_event/trace_event.h" #include "content/browser/renderer_host/input/synthetic_gesture_target.h" #include "content/common/input/synthetic_smooth_scroll_gesture_params.h" @@ -14,7 +16,7 @@ namespace content { SyntheticGestureController::SyntheticGestureController( scoped_ptr<SyntheticGestureTarget> gesture_target) - : gesture_target_(gesture_target.Pass()) {} + : gesture_target_(std::move(gesture_target)) {} SyntheticGestureController::~SyntheticGestureController() {} @@ -25,7 +27,8 @@ void SyntheticGestureController::QueueSyntheticGesture( bool was_empty = pending_gesture_queue_.IsEmpty(); - pending_gesture_queue_.Push(synthetic_gesture.Pass(), completion_callback); + pending_gesture_queue_.Push(std::move(synthetic_gesture), + completion_callback); if (was_empty) StartGesture(*pending_gesture_queue_.FrontGesture()); @@ -61,7 +64,7 @@ void SyntheticGestureController::OnDidFlushInput() { return; DCHECK(!pending_gesture_queue_.IsEmpty()); - auto pending_gesture_result = pending_gesture_result_.Pass(); + auto pending_gesture_result = std::move(pending_gesture_result_); StopGesture(*pending_gesture_queue_.FrontGesture(), pending_gesture_queue_.FrontCallback(), *pending_gesture_result); diff --git a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc index dccbbc3..9369bfd 100644 --- a/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc +++ b/content/browser/renderer_host/input/synthetic_gesture_controller_unittest.cc @@ -2,14 +2,16 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/renderer_host/input/synthetic_gesture_controller.h" + #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/memory/scoped_ptr.h" #include "base/time/time.h" #include "content/browser/renderer_host/input/synthetic_gesture.h" -#include "content/browser/renderer_host/input/synthetic_gesture_controller.h" #include "content/browser/renderer_host/input/synthetic_gesture_target.h" #include "content/browser/renderer_host/input/synthetic_pinch_gesture.h" #include "content/browser/renderer_host/input/synthetic_pointer_action.h" @@ -523,7 +525,7 @@ class SyntheticGestureControllerTestBase { void QueueSyntheticGesture(scoped_ptr<SyntheticGesture> gesture) { controller_->QueueSyntheticGesture( - gesture.Pass(), + std::move(gesture), base::Bind( &SyntheticGestureControllerTestBase::OnSyntheticGestureCompleted, base::Unretained(this))); @@ -600,7 +602,7 @@ TEST_F(SyntheticGestureControllerTest, SingleGesture) { bool finished = false; scoped_ptr<MockSyntheticGesture> gesture( new MockSyntheticGesture(&finished, 3)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); EXPECT_TRUE(finished); @@ -614,7 +616,7 @@ TEST_F(SyntheticGestureControllerTest, GestureFailed) { bool finished = false; scoped_ptr<MockSyntheticGesture> gesture( new MockSyntheticGesture(&finished, 0)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); EXPECT_TRUE(finished); @@ -633,7 +635,7 @@ TEST_F(SyntheticGestureControllerTest, SuccessiveGestures) { new MockSyntheticGesture(&finished_2, 4)); // Queue first gesture and wait for it to finish - QueueSyntheticGesture(gesture_1.Pass()); + QueueSyntheticGesture(std::move(gesture_1)); FlushInputUntilComplete(); EXPECT_TRUE(finished_1); @@ -641,7 +643,7 @@ TEST_F(SyntheticGestureControllerTest, SuccessiveGestures) { EXPECT_EQ(0, num_failure_); // Queue second gesture. - QueueSyntheticGesture(gesture_2.Pass()); + QueueSyntheticGesture(std::move(gesture_2)); FlushInputUntilComplete(); EXPECT_TRUE(finished_2); @@ -659,8 +661,8 @@ TEST_F(SyntheticGestureControllerTest, TwoGesturesInFlight) { scoped_ptr<MockSyntheticGesture> gesture_2( new MockSyntheticGesture(&finished_2, 4)); - QueueSyntheticGesture(gesture_1.Pass()); - QueueSyntheticGesture(gesture_2.Pass()); + QueueSyntheticGesture(std::move(gesture_1)); + QueueSyntheticGesture(std::move(gesture_2)); FlushInputUntilComplete(); EXPECT_TRUE(finished_1); @@ -679,8 +681,8 @@ TEST_F(SyntheticGestureControllerTest, GestureCompletedOnDidFlushInput) { scoped_ptr<MockSyntheticGesture> gesture_2( new MockSyntheticGesture(&finished_2, 4)); - QueueSyntheticGesture(gesture_1.Pass()); - QueueSyntheticGesture(gesture_2.Pass()); + QueueSyntheticGesture(std::move(gesture_1)); + QueueSyntheticGesture(std::move(gesture_2)); while (target_->flush_requested()) { target_->ClearFlushRequest(); @@ -734,7 +736,7 @@ TEST_P(SyntheticGestureControllerTestWithParam, scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -763,7 +765,7 @@ TEST_P(SyntheticGestureControllerTestWithParam, scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -808,7 +810,7 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureTouchDiagonal) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -834,7 +836,7 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureTouchLongStop) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -862,7 +864,7 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureTouchFling) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -888,7 +890,7 @@ TEST_P(SyntheticGestureControllerTestWithParam, scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -908,7 +910,7 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureMouseVertical) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -928,7 +930,7 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureMouseHorizontal) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -948,7 +950,7 @@ TEST_F(SyntheticGestureControllerTest, SingleScrollGestureMouseDiagonal) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -969,7 +971,7 @@ TEST_F(SyntheticGestureControllerTest, MultiScrollGestureMouse) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -991,7 +993,7 @@ TEST_F(SyntheticGestureControllerTest, MultiScrollGestureMouseHorizontal) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -1037,7 +1039,7 @@ TEST_F(SyntheticGestureControllerTest, MultiScrollGestureTouch) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -1065,7 +1067,7 @@ TEST_P(SyntheticGestureControllerTestWithParam, scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* scroll_target = @@ -1102,7 +1104,7 @@ TEST_F(SyntheticGestureControllerTest, SingleDragGestureMouseDiagonal) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* drag_target = @@ -1122,7 +1124,7 @@ TEST_F(SyntheticGestureControllerTest, SingleDragGestureMouseZeroDistance) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* drag_target = @@ -1143,7 +1145,7 @@ TEST_F(SyntheticGestureControllerTest, MultiDragGestureMouse) { scoped_ptr<SyntheticSmoothMoveGesture> gesture( new SyntheticSmoothMoveGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockMoveGestureTarget* drag_target = @@ -1225,7 +1227,7 @@ TEST_F(SyntheticGestureControllerTest, scoped_ptr<SyntheticTouchscreenPinchGesture> gesture( new SyntheticTouchscreenPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTouchscreenPinchTouchTarget* pinch_target = @@ -1248,7 +1250,7 @@ TEST_F(SyntheticGestureControllerTest, scoped_ptr<SyntheticTouchscreenPinchGesture> gesture( new SyntheticTouchscreenPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTouchscreenPinchTouchTarget* pinch_target = @@ -1270,7 +1272,7 @@ TEST_F(SyntheticGestureControllerTest, scoped_ptr<SyntheticTouchscreenPinchGesture> gesture( new SyntheticTouchscreenPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTouchscreenPinchTouchTarget* pinch_target = @@ -1292,7 +1294,7 @@ TEST_F(SyntheticGestureControllerTest, TouchpadPinchGestureTouchZoomIn) { scoped_ptr<SyntheticTouchpadPinchGesture> gesture( new SyntheticTouchpadPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTouchpadPinchTouchTarget* pinch_target = @@ -1314,7 +1316,7 @@ TEST_F(SyntheticGestureControllerTest, TouchpadPinchGestureTouchZoomOut) { scoped_ptr<SyntheticTouchpadPinchGesture> gesture( new SyntheticTouchpadPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTouchpadPinchTouchTarget* pinch_target = @@ -1335,7 +1337,7 @@ TEST_F(SyntheticGestureControllerTest, TouchpadPinchGestureTouchNoScaling) { scoped_ptr<SyntheticTouchpadPinchGesture> gesture( new SyntheticTouchpadPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTouchpadPinchTouchTarget* pinch_target = @@ -1358,7 +1360,7 @@ TEST_F(SyntheticGestureControllerTest, PinchGestureExplicitTouch) { params.anchor.SetPoint(54, 89); scoped_ptr<SyntheticPinchGesture> gesture(new SyntheticPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); // Gesture target will fail expectations if the wrong underlying @@ -1376,7 +1378,7 @@ TEST_F(SyntheticGestureControllerTest, PinchGestureExplicitMouse) { params.anchor.SetPoint(54, 89); scoped_ptr<SyntheticPinchGesture> gesture(new SyntheticPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); // Gesture target will fail expectations if the wrong underlying @@ -1394,7 +1396,7 @@ TEST_F(SyntheticGestureControllerTest, PinchGestureDefaultTouch) { params.anchor.SetPoint(54, 89); scoped_ptr<SyntheticPinchGesture> gesture(new SyntheticPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); // Gesture target will fail expectations if the wrong underlying @@ -1412,7 +1414,7 @@ TEST_F(SyntheticGestureControllerTest, PinchGestureDefaultMouse) { params.anchor.SetPoint(54, 89); scoped_ptr<SyntheticPinchGesture> gesture(new SyntheticPinchGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); // Gesture target will fail expectations if the wrong underlying @@ -1428,7 +1430,7 @@ TEST_F(SyntheticGestureControllerTest, TapGestureTouch) { params.position.SetPoint(87, -124); scoped_ptr<SyntheticTapGesture> gesture(new SyntheticTapGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTapTouchTarget* tap_target = @@ -1451,7 +1453,7 @@ TEST_F(SyntheticGestureControllerTest, TapGestureMouse) { params.position.SetPoint(98, 123); scoped_ptr<SyntheticTapGesture> gesture(new SyntheticTapGesture(params)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticTapMouseTarget* tap_target = @@ -1474,7 +1476,7 @@ TEST_F(SyntheticGestureControllerTest, PointerTouchAction) { scoped_ptr<SyntheticPointerAction> gesture(new SyntheticPointerAction( SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::PRESS, &synthetic_pointer, position)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); MockSyntheticPointerTouchActionTarget* pointer_touch_target = @@ -1488,7 +1490,7 @@ TEST_F(SyntheticGestureControllerTest, PointerTouchAction) { gesture.reset(new SyntheticPointerAction(SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::PRESS, &synthetic_pointer, position)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); pointer_touch_target = @@ -1504,7 +1506,7 @@ TEST_F(SyntheticGestureControllerTest, PointerTouchAction) { gesture.reset(new SyntheticPointerAction( SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::MOVE, &synthetic_pointer, position, index)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); pointer_touch_target = @@ -1517,7 +1519,7 @@ TEST_F(SyntheticGestureControllerTest, PointerTouchAction) { gesture.reset(new SyntheticPointerAction( SyntheticGestureParams::TOUCH_INPUT, SyntheticGesture::RELEASE, &synthetic_pointer, position, index)); - QueueSyntheticGesture(gesture.Pass()); + QueueSyntheticGesture(std::move(gesture)); FlushInputUntilComplete(); pointer_touch_target = diff --git a/content/browser/renderer_host/input/touch_action_browsertest.cc b/content/browser/renderer_host/input/touch_action_browsertest.cc index f8fc11a..72c8bc9 100644 --- a/content/browser/renderer_host/input/touch_action_browsertest.cc +++ b/content/browser/renderer_host/input/touch_action_browsertest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/auto_reset.h" #include "base/bind.h" #include "base/command_line.h" @@ -148,7 +150,7 @@ class TouchActionBrowserTest : public ContentBrowserTest { scoped_ptr<SyntheticSmoothScrollGesture> gesture( new SyntheticSmoothScrollGesture(params)); GetWidgetHost()->QueueSyntheticGesture( - gesture.Pass(), + std::move(gesture), base::Bind(&TouchActionBrowserTest::OnSyntheticGestureCompleted, base::Unretained(this))); diff --git a/content/browser/renderer_host/input/touch_event_queue.cc b/content/browser/renderer_host/input/touch_event_queue.cc index 9397cf7..550b46b 100644 --- a/content/browser/renderer_host/input/touch_event_queue.cc +++ b/content/browser/renderer_host/input/touch_event_queue.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/input/touch_event_queue.h" +#include <utility> + #include "base/auto_reset.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" @@ -619,7 +621,8 @@ void TouchEventQueue::ForwardNextEventToRenderer() { void TouchEventQueue::FlushPendingAsyncTouchmove() { DCHECK(!dispatching_touch_); - scoped_ptr<TouchEventWithLatencyInfo> touch = pending_async_touchmove_.Pass(); + scoped_ptr<TouchEventWithLatencyInfo> touch = + std::move(pending_async_touchmove_); touch->event.cancelable = false; touch_queue_.push_front(new CoalescedWebTouchEvent(*touch, true)); SendTouchEventImmediately(touch.get()); @@ -741,7 +744,7 @@ scoped_ptr<CoalescedWebTouchEvent> TouchEventQueue::PopTouchEvent() { DCHECK(!touch_queue_.empty()); scoped_ptr<CoalescedWebTouchEvent> event(touch_queue_.front()); touch_queue_.pop_front(); - return event.Pass(); + return event; } void TouchEventQueue::SendTouchEventImmediately( diff --git a/content/browser/renderer_host/input/touch_event_queue_unittest.cc b/content/browser/renderer_host/input/touch_event_queue_unittest.cc index 392d822..f1091d4 100644 --- a/content/browser/renderer_host/input/touch_event_queue_unittest.cc +++ b/content/browser/renderer_host/input/touch_event_queue_unittest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/renderer_host/input/touch_event_queue.h" + #include <stddef.h> +#include <utility> #include "base/location.h" #include "base/logging.h" @@ -11,7 +14,6 @@ #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "content/browser/renderer_host/input/timeout_monitor.h" -#include "content/browser/renderer_host/input/touch_event_queue.h" #include "content/common/input/synthetic_web_input_event_builders.h" #include "content/common/input/web_touch_event_traits.h" #include "testing/gtest/include/gtest/gtest.h" @@ -58,7 +60,7 @@ class TouchEventQueueTest : public testing::Test, sent_events_.push_back(event.event); sent_events_ids_.push_back(event.event.uniqueTouchEventId); if (sync_ack_result_) { - auto sync_ack_result = sync_ack_result_.Pass(); + auto sync_ack_result = std::move(sync_ack_result_); SendTouchEventAck(*sync_ack_result); } } @@ -70,12 +72,12 @@ class TouchEventQueueTest : public testing::Test, last_acked_event_state_ = ack_result; if (followup_touch_event_) { scoped_ptr<WebTouchEvent> followup_touch_event = - followup_touch_event_.Pass(); + std::move(followup_touch_event_); SendTouchEvent(*followup_touch_event); } if (followup_gesture_event_) { scoped_ptr<WebGestureEvent> followup_gesture_event = - followup_gesture_event_.Pass(); + std::move(followup_gesture_event_); queue_->OnGestureScrollEvent( GestureEventWithLatencyInfo(*followup_gesture_event, ui::LatencyInfo())); diff --git a/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc b/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc index 872cfb0..791422d3 100644 --- a/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc +++ b/content/browser/renderer_host/input/touchscreen_tap_suppression_controller.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/input/touchscreen_tap_suppression_controller.h" +#include <utility> + #include "content/browser/renderer_host/input/gesture_event_queue.h" using blink::WebInputEvent; @@ -63,8 +65,8 @@ void TouchscreenTapSuppressionController::DropStashedTapDown() { void TouchscreenTapSuppressionController::ForwardStashedTapDown() { DCHECK(stashed_tap_down_); - ScopedGestureEvent tap_down = stashed_tap_down_.Pass(); - ScopedGestureEvent show_press = stashed_show_press_.Pass(); + ScopedGestureEvent tap_down = std::move(stashed_tap_down_); + ScopedGestureEvent show_press = std::move(stashed_show_press_); gesture_event_queue_->ForwardGestureEvent(*tap_down); if (show_press) gesture_event_queue_->ForwardGestureEvent(*show_press); diff --git a/content/browser/renderer_host/media/audio_input_debug_writer.cc b/content/browser/renderer_host/media/audio_input_debug_writer.cc index 39ba40d..5a500b4 100644 --- a/content/browser/renderer_host/media/audio_input_debug_writer.cc +++ b/content/browser/renderer_host/media/audio_input_debug_writer.cc @@ -4,16 +4,15 @@ #include "content/browser/renderer_host/media/audio_input_debug_writer.h" +#include <utility> + #include "content/public/browser/browser_thread.h" #include "media/base/audio_bus.h" namespace content { AudioInputDebugWriter::AudioInputDebugWriter(base::File file) - : file_(file.Pass()), - interleaved_data_size_(0), - weak_factory_(this) { -} + : file_(std::move(file)), interleaved_data_size_(0), weak_factory_(this) {} AudioInputDebugWriter::~AudioInputDebugWriter() { DCHECK_CURRENTLY_ON(BrowserThread::FILE); diff --git a/content/browser/renderer_host/media/audio_input_renderer_host.cc b/content/browser/renderer_host/media/audio_input_renderer_host.cc index bfbb182..e338f0b 100644 --- a/content/browser/renderer_host/media/audio_input_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_input_renderer_host.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/media/audio_input_renderer_host.h" +#include <utility> + #include "base/bind.h" #include "base/files/file.h" #include "base/memory/ref_counted.h" @@ -54,7 +56,7 @@ base::File CreateDebugRecordingFile(base::FilePath file_path) { PLOG_IF(ERROR, !recording_file.IsValid()) << "Could not open debug recording file, error=" << recording_file.error_details(); - return recording_file.Pass(); + return recording_file; } void CloseFile(base::File file) { @@ -585,10 +587,9 @@ void AudioInputRendererHost::DeleteEntry(AudioEntry* entry) { #if defined(ENABLE_WEBRTC) if (entry->input_debug_writer.get()) { BrowserThread::PostTask( - BrowserThread::FILE, - FROM_HERE, + BrowserThread::FILE, FROM_HERE, base::Bind(&DeleteInputDebugWriterOnFileThread, - base::Passed(entry->input_debug_writer.Pass()))); + base::Passed(std::move(entry->input_debug_writer)))); } #endif @@ -700,15 +701,11 @@ void AudioInputRendererHost::DoEnableDebugRecording( return; AudioEntry* entry = LookupById(stream_id); if (!entry) { - BrowserThread::PostTask( - BrowserThread::FILE, - FROM_HERE, - base::Bind( - &CloseFile, - Passed(file.Pass()))); + BrowserThread::PostTask(BrowserThread::FILE, FROM_HERE, + base::Bind(&CloseFile, Passed(std::move(file)))); return; } - entry->input_debug_writer.reset(new AudioInputDebugWriter(file.Pass())); + entry->input_debug_writer.reset(new AudioInputDebugWriter(std::move(file))); entry->controller->EnableDebugRecording(entry->input_debug_writer.get()); } @@ -723,10 +720,9 @@ void AudioInputRendererHost::DeleteDebugWriter(int stream_id) { if (entry->input_debug_writer.get()) { BrowserThread::PostTask( - BrowserThread::FILE, - FROM_HERE, + BrowserThread::FILE, FROM_HERE, base::Bind(&DeleteInputDebugWriterOnFileThread, - base::Passed(entry->input_debug_writer.Pass()))); + base::Passed(std::move(entry->input_debug_writer)))); } } #endif // defined(ENABLE_WEBRTC) diff --git a/content/browser/renderer_host/media/audio_renderer_host.cc b/content/browser/renderer_host/media/audio_renderer_host.cc index 3acc345..279d6fc 100644 --- a/content/browser/renderer_host/media/audio_renderer_host.cc +++ b/content/browser/renderer_host/media/audio_renderer_host.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/media/audio_renderer_host.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -204,8 +205,8 @@ AudioRendererHost::AudioEntry::AudioEntry( : host_(host), stream_id_(stream_id), render_frame_id_(render_frame_id), - shared_memory_(shared_memory.Pass()), - reader_(reader.Pass()), + shared_memory_(std::move(shared_memory)), + reader_(std::move(reader)), controller_(media::AudioOutputController::Create(host->audio_manager_, this, params, @@ -593,7 +594,7 @@ void AudioRendererHost::DoCreateStream(int stream_id, scoped_ptr<AudioEntry> entry( new AudioEntry(this, stream_id, render_frame_id, params, device_unique_id, - shared_memory.Pass(), reader.Pass())); + std::move(shared_memory), std::move(reader))); if (mirroring_manager_) { mirroring_manager_->AddDiverter( render_process_id_, entry->render_frame_id(), entry->controller()); diff --git a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc index c262606..9fee099 100644 --- a/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_dispatcher_host_unittest.cc @@ -2,10 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stddef.h> +#include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" +#include <stddef.h> #include <queue> #include <string> +#include <utility> #include "base/bind.h" #include "base/callback_helpers.h" @@ -17,7 +19,6 @@ #include "build/build_config.h" #include "content/browser/browser_thread_impl.h" #include "content/browser/renderer_host/media/audio_input_device_manager.h" -#include "content/browser/renderer_host/media/media_stream_dispatcher_host.h" #include "content/browser/renderer_host/media/media_stream_manager.h" #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" #include "content/browser/renderer_host/media/video_capture_manager.h" @@ -848,7 +849,7 @@ TEST_F(MediaStreamDispatcherHostTest, CloseFromUI) { scoped_ptr<MockMediaStreamUIProxy> stream_ui(new MockMediaStreamUIProxy()); EXPECT_CALL(*stream_ui, OnStarted(_, _)) .WillOnce(SaveArg<0>(&close_callback)); - media_stream_manager_->UseFakeUIForTests(stream_ui.Pass()); + media_stream_manager_->UseFakeUIForTests(std::move(stream_ui)); GenerateStreamAndWaitForResult(kRenderId, kPageRequestId, controls); diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc index b018c53..0d36cd0 100644 --- a/content/browser/renderer_host/media/media_stream_manager.cc +++ b/content/browser/renderer_host/media/media_stream_manager.cc @@ -7,9 +7,9 @@ #include <stddef.h> #include <stdint.h> #include <string.h> - #include <cctype> #include <list> +#include <utility> #include <vector> #include "base/bind.h" @@ -279,7 +279,7 @@ class MediaStreamManager::DeviceRequest { bool HasUIRequest() const { return ui_request_.get() != nullptr; } scoped_ptr<MediaStreamRequest> DetachUIRequest() { - return ui_request_.Pass(); + return std::move(ui_request_); } // Update the request state and notify observers. @@ -1146,7 +1146,7 @@ void MediaStreamManager::PostRequestToUI(const std::string& label, fake_ui_->SetAvailableDevices(devices); - request->ui_proxy = fake_ui_.Pass(); + request->ui_proxy = std::move(fake_ui_); } else { request->ui_proxy = MediaStreamUIProxy::Create(); } @@ -1395,7 +1395,7 @@ void MediaStreamManager::FinalizeRequestFailed( if (request->request_type == MEDIA_DEVICE_ACCESS && !request->callback.is_null()) { - request->callback.Run(MediaStreamDevices(), request->ui_proxy.Pass()); + request->callback.Run(MediaStreamDevices(), std::move(request->ui_proxy)); } DeleteRequest(label); @@ -1429,7 +1429,7 @@ void MediaStreamManager::FinalizeEnumerateDevices(const std::string& label, if (use_fake_ui_) { if (!fake_ui_) fake_ui_.reset(new FakeMediaStreamUIProxy()); - request->ui_proxy = fake_ui_.Pass(); + request->ui_proxy = std::move(fake_ui_); } else { request->ui_proxy = MediaStreamUIProxy::Create(); } @@ -1507,7 +1507,7 @@ void MediaStreamManager::FinalizeMediaAccessRequest( DeviceRequest* request, const MediaStreamDevices& devices) { if (!request->callback.is_null()) - request->callback.Run(devices, request->ui_proxy.Pass()); + request->callback.Run(devices, std::move(request->ui_proxy)); // Delete the request since it is done. DeleteRequest(label); @@ -1759,7 +1759,7 @@ void MediaStreamManager::UseFakeUIForTests( scoped_ptr<FakeMediaStreamUIProxy> fake_ui) { DCHECK_CURRENTLY_ON(BrowserThread::IO); use_fake_ui_ = true; - fake_ui_ = fake_ui.Pass(); + fake_ui_ = std::move(fake_ui); } void MediaStreamManager::RegisterNativeLogCallback( diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy.cc b/content/browser/renderer_host/media/media_stream_ui_proxy.cc index 4e4f442..6cecbec 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" +#include <utility> + #include "base/command_line.h" #include "base/macros.h" #include "content/browser/frame_host/frame_tree_node.h" @@ -130,7 +132,7 @@ void MediaStreamUIProxy::Core::ProcessAccessRequestResponse( scoped_ptr<MediaStreamUI> stream_ui) { DCHECK_CURRENTLY_ON(BrowserThread::UI); - ui_ = stream_ui.Pass(); + ui_ = std::move(stream_ui); BrowserThread::PostTask( BrowserThread::IO, FROM_HERE, base::Bind(&MediaStreamUIProxy::ProcessAccessRequestResponse, diff --git a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc index 373de9d..eae9607 100644 --- a/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc +++ b/content/browser/renderer_host/media/media_stream_ui_proxy_unittest.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/media/media_stream_ui_proxy.h" +#include <utility> + #include "base/message_loop/message_loop.h" #include "content/browser/frame_host/render_frame_host_delegate.h" #include "content/public/test/test_browser_thread.h" @@ -95,8 +97,9 @@ TEST_F(MediaStreamUIProxyTest, Deny) { MEDIA_DEVICE_VIDEO_CAPTURE)); MediaStreamRequest* request_ptr = request.get(); proxy_->RequestAccess( - request.Pass(), base::Bind(&MockResponseCallback::OnAccessRequestResponse, - base::Unretained(&response_callback_))); + std::move(request), + base::Bind(&MockResponseCallback::OnAccessRequestResponse, + base::Unretained(&response_callback_))); MediaResponseCallback callback; EXPECT_CALL(delegate_, RequestMediaAccessPermission(SameRequest(request_ptr), _)) @@ -125,8 +128,9 @@ TEST_F(MediaStreamUIProxyTest, AcceptAndStart) { MEDIA_DEVICE_VIDEO_CAPTURE)); MediaStreamRequest* request_ptr = request.get(); proxy_->RequestAccess( - request.Pass(), base::Bind(&MockResponseCallback::OnAccessRequestResponse, - base::Unretained(&response_callback_))); + std::move(request), + base::Bind(&MockResponseCallback::OnAccessRequestResponse, + base::Unretained(&response_callback_))); MediaResponseCallback callback; EXPECT_CALL(delegate_, RequestMediaAccessPermission(SameRequest(request_ptr), _)) @@ -139,7 +143,7 @@ TEST_F(MediaStreamUIProxyTest, AcceptAndStart) { MediaStreamDevice(MEDIA_DEVICE_AUDIO_CAPTURE, "Mic", "Mic")); scoped_ptr<MockMediaStreamUI> ui(new MockMediaStreamUI()); EXPECT_CALL(*ui, OnStarted(_)).WillOnce(Return(0)); - callback.Run(devices, MEDIA_DEVICE_OK, ui.Pass()); + callback.Run(devices, MEDIA_DEVICE_OK, std::move(ui)); MediaStreamDevices response; EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)) @@ -163,8 +167,9 @@ TEST_F(MediaStreamUIProxyTest, DeleteBeforeAccepted) { MEDIA_DEVICE_VIDEO_CAPTURE)); MediaStreamRequest* request_ptr = request.get(); proxy_->RequestAccess( - request.Pass(), base::Bind(&MockResponseCallback::OnAccessRequestResponse, - base::Unretained(&response_callback_))); + std::move(request), + base::Bind(&MockResponseCallback::OnAccessRequestResponse, + base::Unretained(&response_callback_))); MediaResponseCallback callback; EXPECT_CALL(delegate_, RequestMediaAccessPermission(SameRequest(request_ptr) , _)) @@ -176,7 +181,7 @@ TEST_F(MediaStreamUIProxyTest, DeleteBeforeAccepted) { MediaStreamDevices devices; scoped_ptr<MediaStreamUI> ui; - callback.Run(devices, MEDIA_DEVICE_OK, ui.Pass()); + callback.Run(devices, MEDIA_DEVICE_OK, std::move(ui)); } TEST_F(MediaStreamUIProxyTest, StopFromUI) { @@ -189,8 +194,9 @@ TEST_F(MediaStreamUIProxyTest, StopFromUI) { MEDIA_DEVICE_VIDEO_CAPTURE)); MediaStreamRequest* request_ptr = request.get(); proxy_->RequestAccess( - request.Pass(), base::Bind(&MockResponseCallback::OnAccessRequestResponse, - base::Unretained(&response_callback_))); + std::move(request), + base::Bind(&MockResponseCallback::OnAccessRequestResponse, + base::Unretained(&response_callback_))); MediaResponseCallback callback; EXPECT_CALL(delegate_, RequestMediaAccessPermission(SameRequest(request_ptr) , _)) @@ -206,7 +212,7 @@ TEST_F(MediaStreamUIProxyTest, StopFromUI) { scoped_ptr<MockMediaStreamUI> ui(new MockMediaStreamUI()); EXPECT_CALL(*ui, OnStarted(_)) .WillOnce(testing::DoAll(SaveArg<0>(&stop_callback), Return(0))); - callback.Run(devices, MEDIA_DEVICE_OK, ui.Pass()); + callback.Run(devices, MEDIA_DEVICE_OK, std::move(ui)); MediaStreamDevices response; EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)) @@ -238,7 +244,7 @@ TEST_F(MediaStreamUIProxyTest, WindowIdCallbackCalled) { MediaStreamRequest* request_ptr = request.get(); proxy_->RequestAccess( - request.Pass(), + std::move(request), base::Bind(&MockResponseCallback::OnAccessRequestResponse, base::Unretained(&response_callback_))); MediaResponseCallback callback; @@ -251,7 +257,7 @@ TEST_F(MediaStreamUIProxyTest, WindowIdCallbackCalled) { scoped_ptr<MockMediaStreamUI> ui(new MockMediaStreamUI()); EXPECT_CALL(*ui, OnStarted(_)).WillOnce(Return(kWindowId)); - callback.Run(MediaStreamDevices(), MEDIA_DEVICE_OK, ui.Pass()); + callback.Run(MediaStreamDevices(), MEDIA_DEVICE_OK, std::move(ui)); EXPECT_CALL(response_callback_, OnAccessRequestResponse(_, _)); MockStopStreamHandler handler; diff --git a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc index df29ff0..21c6132 100644 --- a/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc @@ -9,6 +9,7 @@ #include <stddef.h> #include <stdint.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -131,7 +132,7 @@ class VideoCaptureBufferPoolTest Buffer(const scoped_refptr<VideoCaptureBufferPool> pool, scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle, int id) - : id_(id), pool_(pool), buffer_handle_(buffer_handle.Pass()) {} + : id_(id), pool_(pool), buffer_handle_(std::move(buffer_handle)) {} ~Buffer() { pool_->RelinquishProducerReservation(id()); } int id() const { return id_; } size_t mapped_size() { return buffer_handle_->mapped_size(); } @@ -183,7 +184,7 @@ class VideoCaptureBufferPoolTest scoped_ptr<VideoCaptureBufferPool::BufferHandle> buffer_handle = pool_->GetBufferHandle(buffer_id); return scoped_ptr<Buffer>( - new Buffer(pool_, buffer_handle.Pass(), buffer_id)); + new Buffer(pool_, std::move(buffer_handle), buffer_id)); } base::MessageLoop loop_; diff --git a/content/browser/renderer_host/media/video_capture_controller_unittest.cc b/content/browser/renderer_host/media/video_capture_controller_unittest.cc index ac5cf64..d1400bc 100644 --- a/content/browser/renderer_host/media/video_capture_controller_unittest.cc +++ b/content/browser/renderer_host/media/video_capture_controller_unittest.cc @@ -4,10 +4,12 @@ // Unit test for VideoCaptureController. +#include "content/browser/renderer_host/media/video_capture_controller.h" + #include <stdint.h> #include <string.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -19,7 +21,6 @@ #include "base/single_thread_task_runner.h" #include "base/thread_task_runner_handle.h" #include "content/browser/renderer_host/media/media_stream_provider.h" -#include "content/browser/renderer_host/media/video_capture_controller.h" #include "content/browser/renderer_host/media/video_capture_controller_event_handler.h" #include "content/browser/renderer_host/media/video_capture_manager.h" #include "content/common/media/media_stream_options.h" @@ -320,7 +321,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { media::VideoFrameMetadata::RESOURCE_UTILIZATION)); client_a_->resource_utilization_ = 0.5; client_b_->resource_utilization_ = -1.0; - device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer), video_frame, base::TimeTicks()); base::RunLoop().RunUntilIdle(); @@ -349,7 +350,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { media::VideoFrameMetadata::RESOURCE_UTILIZATION)); client_a_->resource_utilization_ = 0.5; client_b_->resource_utilization_ = 3.14; - device_->OnIncomingCapturedVideoFrame(buffer2.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer2), video_frame, base::TimeTicks()); // The buffer should be delivered to the clients in any order. @@ -391,7 +392,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { memset(buffer->data(), buffer_no++, buffer->mapped_size()); video_frame = WrapI420Buffer(capture_resolution, static_cast<uint8_t*>(buffer->data())); - device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer), video_frame, base::TimeTicks()); } // ReserveOutputBuffer ought to fail now, because the pool is depleted. @@ -439,7 +440,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { memset(buffer3->data(), buffer_no++, buffer3->mapped_size()); video_frame = WrapI420Buffer(capture_resolution, static_cast<uint8_t*>(buffer3->data())); - device_->OnIncomingCapturedVideoFrame(buffer3.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer3), video_frame, base::TimeTicks()); scoped_ptr<media::VideoCaptureDevice::Client::Buffer> buffer4 = @@ -456,7 +457,7 @@ TEST_F(VideoCaptureControllerTest, NormalCaptureMultipleClients) { memset(buffer4->data(), buffer_no++, buffer4->mapped_size()); video_frame = WrapI420Buffer(capture_resolution, static_cast<uint8_t*>(buffer4->data())); - device_->OnIncomingCapturedVideoFrame(buffer4.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer4), video_frame, base::TimeTicks()); // B2 is the only client left, and is the only one that should // get the buffer. @@ -504,7 +505,7 @@ TEST_F(VideoCaptureControllerTest, ErrorBeforeDeviceCreation) { ASSERT_TRUE(buffer.get()); scoped_refptr<media::VideoFrame> video_frame = WrapI420Buffer(capture_resolution, static_cast<uint8_t*>(buffer->data())); - device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer), video_frame, base::TimeTicks()); base::RunLoop().RunUntilIdle(); @@ -542,7 +543,7 @@ TEST_F(VideoCaptureControllerTest, ErrorAfterDeviceCreation) { scoped_refptr<media::VideoFrame> video_frame = WrapI420Buffer(dims, static_cast<uint8_t*>(buffer->data())); device_->OnError(FROM_HERE, "Test Error"); - device_->OnIncomingCapturedVideoFrame(buffer.Pass(), video_frame, + device_->OnIncomingCapturedVideoFrame(std::move(buffer), video_frame, base::TimeTicks()); EXPECT_CALL(*client_a_, DoError(route_id)).Times(1); diff --git a/content/browser/renderer_host/media/video_capture_device_client.cc b/content/browser/renderer_host/media/video_capture_device_client.cc index 2bb27e8..28a5f67 100644 --- a/content/browser/renderer_host/media/video_capture_device_client.cc +++ b/content/browser/renderer_host/media/video_capture_device_client.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/media/video_capture_device_client.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -36,7 +37,7 @@ class AutoReleaseBuffer : public media::VideoCaptureDevice::Client::Buffer { int buffer_id) : id_(buffer_id), pool_(pool), - buffer_handle_(pool_->GetBufferHandle(buffer_id).Pass()) { + buffer_handle_(pool_->GetBufferHandle(buffer_id)) { DCHECK(pool_.get()); } int id() const override { return id_; } @@ -223,7 +224,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData( frame_format.pixel_format == media::PIXEL_FORMAT_MJPEG && rotation == 0 && !flip) { external_jpeg_decoder_->DecodeCapturedData(data, length, frame_format, - timestamp, buffer.Pass()); + timestamp, std::move(buffer)); return; } } @@ -252,7 +253,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedData( const VideoCaptureFormat output_format = VideoCaptureFormat( dimensions, frame_format.frame_rate, media::PIXEL_FORMAT_I420, output_pixel_storage); - OnIncomingCapturedBuffer(buffer.Pass(), output_format, timestamp); + OnIncomingCapturedBuffer(std::move(buffer), output_format, timestamp); } void VideoCaptureDeviceClient::OnIncomingCapturedYuvData( @@ -302,7 +303,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedYuvData( return; } - OnIncomingCapturedBuffer(buffer.Pass(), frame_format, timestamp); + OnIncomingCapturedBuffer(std::move(buffer), frame_format, timestamp); }; scoped_ptr<media::VideoCaptureDevice::Client::Buffer> @@ -333,7 +334,7 @@ VideoCaptureDeviceClient::ReserveOutputBuffer( controller_, buffer_id_to_drop)); } - return output_buffer.Pass(); + return output_buffer; } void VideoCaptureDeviceClient::OnIncomingCapturedBuffer( @@ -370,7 +371,7 @@ void VideoCaptureDeviceClient::OnIncomingCapturedBuffer( DCHECK(frame.get()); frame->metadata()->SetDouble(media::VideoFrameMetadata::FRAME_RATE, frame_format.frame_rate); - OnIncomingCapturedVideoFrame(buffer.Pass(), frame, timestamp); + OnIncomingCapturedVideoFrame(std::move(buffer), frame, timestamp); } void VideoCaptureDeviceClient::OnIncomingCapturedVideoFrame( @@ -446,7 +447,7 @@ VideoCaptureDeviceClient::ReserveI420OutputBuffer( *u_plane_data + VideoFrame::PlaneSize(format, VideoFrame::kUPlane, dimensions) .GetArea(); - return buffer.Pass(); + return buffer; case media::PIXEL_STORAGE_GPUMEMORYBUFFER: *y_plane_data = reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kYPlane)); @@ -454,7 +455,7 @@ VideoCaptureDeviceClient::ReserveI420OutputBuffer( reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kUPlane)); *v_plane_data = reinterpret_cast<uint8_t*>(buffer->data(VideoFrame::kVPlane)); - return buffer.Pass(); + return buffer; } NOTREACHED(); return scoped_ptr<Buffer>(); diff --git a/content/browser/renderer_host/media/video_capture_manager.cc b/content/browser/renderer_host/media/video_capture_manager.cc index 7c1da94..dcee567 100644 --- a/content/browser/renderer_host/media/video_capture_manager.cc +++ b/content/browser/renderer_host/media/video_capture_manager.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <set> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -120,7 +121,7 @@ VideoCaptureManager::DeviceEntry::DeviceEntry( : serial_id(g_device_start_id++), stream_type(stream_type), id(id), - video_capture_controller_(controller.Pass()) {} + video_capture_controller_(std::move(controller)) {} VideoCaptureManager::DeviceEntry::~DeviceEntry() { DCHECK(thread_checker_.CalledOnValidThread()); @@ -139,7 +140,7 @@ void VideoCaptureManager::DeviceEntry::SetVideoCaptureDevice( scoped_ptr<media::VideoCaptureDevice> VideoCaptureManager::DeviceEntry::ReleaseVideoCaptureDevice() { DCHECK(thread_checker_.CalledOnValidThread()); - return video_capture_device_.Pass(); + return std::move(video_capture_device_); } VideoCaptureController* @@ -168,8 +169,7 @@ VideoCaptureManager::VideoCaptureManager( scoped_ptr<media::VideoCaptureDeviceFactory> factory) : listener_(NULL), new_capture_session_id_(1), - video_capture_device_factory_(factory.Pass()) { -} + video_capture_device_factory_(std::move(factory)) {} VideoCaptureManager::~VideoCaptureManager() { DCHECK(devices_.empty()); @@ -445,7 +445,7 @@ void VideoCaptureManager::OnDeviceStarted( DCHECK(entry_it != devices_.end()); DeviceEntry* entry = *entry_it; DCHECK(!entry->video_capture_device()); - entry->SetVideoCaptureDevice(device.Pass()); + entry->SetVideoCaptureDevice(std::move(device)); if (entry->stream_type == MEDIA_DESKTOP_VIDEO_CAPTURE) { const media::VideoCaptureSessionId session_id = @@ -474,8 +474,8 @@ VideoCaptureManager::DoStartDeviceCaptureOnDeviceThread( return nullptr; } - video_capture_device->AllocateAndStart(params, device_client.Pass()); - return video_capture_device.Pass(); + video_capture_device->AllocateAndStart(params, std::move(device_client)); + return video_capture_device; } scoped_ptr<media::VideoCaptureDevice> @@ -494,8 +494,8 @@ VideoCaptureManager::DoStartTabCaptureOnDeviceThread( return nullptr; } - video_capture_device->AllocateAndStart(params, device_client.Pass()); - return video_capture_device.Pass(); + video_capture_device->AllocateAndStart(params, std::move(device_client)); + return video_capture_device; } scoped_ptr<media::VideoCaptureDevice> @@ -523,8 +523,8 @@ VideoCaptureManager::DoStartDesktopCaptureOnDeviceThread( return nullptr; } - video_capture_device->AllocateAndStart(params, device_client.Pass()); - return video_capture_device.Pass(); + video_capture_device->AllocateAndStart(params, std::move(device_client)); + return video_capture_device; } void VideoCaptureManager::StartCaptureForClient( @@ -924,9 +924,8 @@ VideoCaptureManager::DeviceEntry* VideoCaptureManager::GetOrCreateDeviceEntry( kMaxNumberOfBuffersForTabCapture : kMaxNumberOfBuffers; scoped_ptr<VideoCaptureController> video_capture_controller( new VideoCaptureController(max_buffers)); - DeviceEntry* new_device = new DeviceEntry(device_info.type, - device_info.id, - video_capture_controller.Pass()); + DeviceEntry* new_device = new DeviceEntry( + device_info.type, device_info.id, std::move(video_capture_controller)); devices_.push_back(new_device); return new_device; } diff --git a/content/browser/renderer_host/p2p/socket_host_tcp.cc b/content/browser/renderer_host/p2p/socket_host_tcp.cc index 3570847..cd93a12 100644 --- a/content/browser/renderer_host/p2p/socket_host_tcp.cc +++ b/content/browser/renderer_host/p2p/socket_host_tcp.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/p2p/socket_host_tcp.h" #include <stddef.h> +#include <utility> #include "base/location.h" #include "base/single_thread_task_runner.h" @@ -156,9 +157,9 @@ void P2PSocketHostTcpBase::OnConnected(int result) { state_ = STATE_TLS_CONNECTING; StartTls(); } else if (IsPseudoTlsClientSocket(type_)) { - scoped_ptr<net::StreamSocket> transport_socket = socket_.Pass(); + scoped_ptr<net::StreamSocket> transport_socket = std::move(socket_); socket_.reset( - new jingle_glue::FakeSSLClientSocket(transport_socket.Pass())); + new jingle_glue::FakeSSLClientSocket(std::move(transport_socket))); state_ = STATE_TLS_CONNECTING; int status = socket_->Connect( base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, @@ -181,7 +182,7 @@ void P2PSocketHostTcpBase::StartTls() { scoped_ptr<net::ClientSocketHandle> socket_handle( new net::ClientSocketHandle()); - socket_handle->SetSocket(socket_.Pass()); + socket_handle->SetSocket(std::move(socket_)); net::SSLClientSocketContext context; context.cert_verifier = url_context_->GetURLRequestContext()->cert_verifier(); @@ -208,7 +209,7 @@ void P2PSocketHostTcpBase::StartTls() { DCHECK(socket_factory); socket_ = socket_factory->CreateSSLClientSocket( - socket_handle.Pass(), dest_host_port_pair, ssl_config, context); + std::move(socket_handle), dest_host_port_pair, ssl_config, context); int status = socket_->Connect( base::Bind(&P2PSocketHostTcpBase::ProcessTlsSslConnectDone, base::Unretained(this))); diff --git a/content/browser/renderer_host/p2p/socket_host_throttler.cc b/content/browser/renderer_host/p2p/socket_host_throttler.cc index 0ef92eb..daefbcc7 100644 --- a/content/browser/renderer_host/p2p/socket_host_throttler.cc +++ b/content/browser/renderer_host/p2p/socket_host_throttler.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "content/browser/renderer_host/p2p/socket_host_throttler.h" + +#include <utility> + #include "third_party/webrtc/base/ratelimiter.h" #include "third_party/webrtc/base/timing.h" @@ -24,7 +27,7 @@ P2PMessageThrottler::~P2PMessageThrottler() { } void P2PMessageThrottler::SetTiming(scoped_ptr<rtc::Timing> timing) { - timing_ = timing.Pass(); + timing_ = std::move(timing); } void P2PMessageThrottler::SetSendIceBandwidth(int bandwidth_kbps) { diff --git a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc index 7258eaf..7bf0944 100644 --- a/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc +++ b/content/browser/renderer_host/p2p/socket_host_udp_unittest.cc @@ -5,8 +5,8 @@ #include "content/browser/renderer_host/p2p/socket_host_udp.h" #include <stdint.h> - #include <deque> +#include <utility> #include <vector> #include "base/logging.h" @@ -188,7 +188,7 @@ class P2PSocketHostUdpTest : public testing::Test { dest2_ = ParseAddress(kTestIpAddress2, kTestPort2); scoped_ptr<rtc::Timing> timing(new FakeTiming()); - throttler_.SetTiming(timing.Pass()); + throttler_.SetTiming(std::move(timing)); } P2PMessageThrottler throttler_; diff --git a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h index dd112390..ca8c6ce 100644 --- a/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h +++ b/content/browser/renderer_host/pepper/browser_ppapi_host_impl.h @@ -7,6 +7,7 @@ #include <map> #include <string> +#include <utility> #include "base/compiler_specific.h" #include "base/containers/scoped_ptr_hash_map.h" @@ -78,7 +79,7 @@ class CONTENT_EXPORT BrowserPpapiHostImpl : public BrowserPpapiHost { bool IsPotentiallySecurePluginContext(PP_Instance instance); void set_plugin_process(base::Process process) { - plugin_process_ = process.Pass(); + plugin_process_ = std::move(process); } bool external_plugin() const { return external_plugin_; } diff --git a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc index 79f7f56..9ad8d5b 100644 --- a/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc +++ b/content/browser/renderer_host/pepper/content_browser_pepper_host_factory.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/pepper/content_browser_pepper_host_factory.h" #include <stddef.h> +#include <utility> #include "content/browser/renderer_host/pepper/browser_ppapi_host_impl.h" #include "content/browser/renderer_host/pepper/pepper_browser_font_singleton_host.h" @@ -136,7 +137,7 @@ scoped_ptr<ResourceHost> ContentBrowserPepperHostFactory::CreateResourceHost( scoped_ptr<PepperPrintSettingsManager> manager( new PepperPrintSettingsManagerImpl()); return scoped_ptr<ResourceHost>(new PepperPrintingHost( - host_->GetPpapiHost(), instance, resource, manager.Pass())); + host_->GetPpapiHost(), instance, resource, std::move(manager))); } case PpapiHostMsg_TrueTypeFont_Create::ID: { SerializedTrueTypeFontDesc desc; @@ -232,8 +233,8 @@ ContentBrowserPepperHostFactory::CreateAcceptedTCPSocket( if (!CanCreateSocket()) return scoped_ptr<ResourceHost>(); scoped_refptr<ResourceMessageFilter> tcp_socket( - new PepperTCPSocketMessageFilter( - host_, instance, version, socket.Pass())); + new PepperTCPSocketMessageFilter(host_, instance, version, + std::move(socket))); return scoped_ptr<ResourceHost>( new MessageFilterHost(host_->GetPpapiHost(), instance, 0, tcp_socket)); } diff --git a/content/browser/renderer_host/pepper/pepper_file_io_host.cc b/content/browser/renderer_host/pepper/pepper_file_io_host.cc index 7822891..faead26 100644 --- a/content/browser/renderer_host/pepper/pepper_file_io_host.cc +++ b/content/browser/renderer_host/pepper/pepper_file_io_host.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/pepper/pepper_file_io_host.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" @@ -91,7 +93,7 @@ void DidOpenFile(base::WeakPtr<PepperFileIOHost> file_host, base::File file, const base::Closure& on_close_callback) { if (file_host) { - callback.Run(file.Pass(), on_close_callback); + callback.Run(std::move(file), on_close_callback); } else { BrowserThread::PostTaskAndReply( BrowserThread::FILE, @@ -284,7 +286,7 @@ void PepperFileIOHost::DidOpenInternalFile( DCHECK(!file_.IsValid()); base::File::Error error = file.IsValid() ? base::File::FILE_OK : file.error_details(); - file_.SetFile(file.Pass()); + file_.SetFile(std::move(file)); OnOpenProxyCallback(reply_context, error); } @@ -390,7 +392,7 @@ void PepperFileIOHost::DidOpenQuotaFile( DCHECK(!file_.IsValid()); DCHECK(file.IsValid()); max_written_offset_ = max_written_offset; - file_.SetFile(file.Pass()); + file_.SetFile(std::move(file)); OnOpenProxyCallback(reply_context, base::File::FILE_OK); } diff --git a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc index 48da55d..3059dd7 100644 --- a/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_flash_file_message_filter.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/pepper/pepper_flash_file_message_filter.h" +#include <utility> + #include "base/bind.h" #include "base/files/file.h" #include "base/files/file_enumerator.h" @@ -134,7 +136,7 @@ int32_t PepperFlashFileMessageFilter::OnOpenFile( } IPC::PlatformFileForTransit transit_file = - IPC::TakeFileHandleForProcess(file.Pass(), plugin_process_.Handle()); + IPC::TakeFileHandleForProcess(std::move(file), plugin_process_.Handle()); ppapi::host::ReplyMessageContext reply_context = context->MakeReplyMessageContext(); reply_context.params.AppendHandle(ppapi::proxy::SerializedHandle( @@ -256,7 +258,7 @@ int32_t PepperFlashFileMessageFilter::OnCreateTemporaryFile( return ppapi::FileErrorToPepperError(file.error_details()); IPC::PlatformFileForTransit transit_file = - IPC::TakeFileHandleForProcess(file.Pass(), plugin_process_.Handle()); + IPC::TakeFileHandleForProcess(std::move(file), plugin_process_.Handle()); ppapi::host::ReplyMessageContext reply_context = context->MakeReplyMessageContext(); reply_context.params.AppendHandle(ppapi::proxy::SerializedHandle( diff --git a/content/browser/renderer_host/pepper/pepper_network_monitor_host.cc b/content/browser/renderer_host/pepper/pepper_network_monitor_host.cc index d14603a..2d07e2a 100644 --- a/content/browser/renderer_host/pepper/pepper_network_monitor_host.cc +++ b/content/browser/renderer_host/pepper/pepper_network_monitor_host.cc @@ -36,7 +36,7 @@ bool CanUseNetworkMonitor(bool external_plugin, scoped_ptr<net::NetworkInterfaceList> GetNetworkList() { scoped_ptr<net::NetworkInterfaceList> list(new net::NetworkInterfaceList()); net::GetNetworkList(list.get(), net::INCLUDE_HOST_SCOPE_VIRTUAL_INTERFACES); - return list.Pass(); + return list; } } // namespace diff --git a/content/browser/renderer_host/pepper/pepper_printing_host.cc b/content/browser/renderer_host/pepper/pepper_printing_host.cc index 047f120..5f9fcaa 100644 --- a/content/browser/renderer_host/pepper/pepper_printing_host.cc +++ b/content/browser/renderer_host/pepper/pepper_printing_host.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/pepper/pepper_printing_host.h" +#include <utility> + #include "ppapi/c/dev/pp_print_settings_dev.h" #include "ppapi/c/pp_errors.h" #include "ppapi/host/dispatch_host_message.h" @@ -19,7 +21,7 @@ PepperPrintingHost::PepperPrintingHost( PP_Resource resource, scoped_ptr<PepperPrintSettingsManager> print_settings_manager) : ResourceHost(host, instance, resource), - print_settings_manager_(print_settings_manager.Pass()), + print_settings_manager_(std::move(print_settings_manager)), weak_factory_(this) {} PepperPrintingHost::~PepperPrintingHost() {} diff --git a/content/browser/renderer_host/pepper/pepper_printing_host_unittest.cc b/content/browser/renderer_host/pepper/pepper_printing_host_unittest.cc index 7bc8af9..b54ec04 100644 --- a/content/browser/renderer_host/pepper/pepper_printing_host_unittest.cc +++ b/content/browser/renderer_host/pepper/pepper_printing_host_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/renderer_host/pepper/pepper_printing_host.h" + #include <stdint.h> +#include <utility> #include "base/macros.h" #include "content/browser/renderer_host/pepper/browser_ppapi_host_test.h" #include "content/browser/renderer_host/pepper/pepper_print_settings_manager.h" -#include "content/browser/renderer_host/pepper/pepper_printing_host.h" #include "ppapi/c/pp_errors.h" #include "ppapi/host/host_message_context.h" #include "ppapi/host/ppapi_host.h" @@ -82,9 +84,7 @@ TEST_F(PepperPrintingHostTest, GetDefaultPrintSettings) { scoped_ptr<PepperPrintSettingsManager> manager( new MockPepperPrintSettingsManager(expected_settings)); PepperPrintingHost printing(GetBrowserPpapiHost()->GetPpapiHost(), - pp_instance, - pp_resource, - manager.Pass()); + pp_instance, pp_resource, std::move(manager)); // Simulate a message being received. ppapi::proxy::ResourceMessageCallParams call_params(pp_resource, 1); diff --git a/content/browser/renderer_host/pepper/pepper_renderer_connection.cc b/content/browser/renderer_host/pepper/pepper_renderer_connection.cc index bbce590..da171c2 100644 --- a/content/browser/renderer_host/pepper/pepper_renderer_connection.cc +++ b/content/browser/renderer_host/pepper/pepper_renderer_connection.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -82,7 +83,7 @@ void PendingHostCreator::AddPendingResourceHost( size_t index, scoped_ptr<ppapi::host::ResourceHost> resource_host) { pending_resource_host_ids_[index] = - host_->GetPpapiHost()->AddPendingResourceHost(resource_host.Pass()); + host_->GetPpapiHost()->AddPendingResourceHost(std::move(resource_host)); } PendingHostCreator::~PendingHostCreator() { @@ -218,7 +219,7 @@ void PepperRendererConnection::OnMsgCreateResourceHostsFromHost( } if (resource_host.get()) - creator->AddPendingResourceHost(i, resource_host.Pass()); + creator->AddPendingResourceHost(i, std::move(resource_host)); } // Note: All of the pending host IDs that were added as part of this diff --git a/content/browser/renderer_host/pepper/pepper_tcp_server_socket_message_filter.cc b/content/browser/renderer_host/pepper/pepper_tcp_server_socket_message_filter.cc index 34db559..e342c23 100644 --- a/content/browser/renderer_host/pepper/pepper_tcp_server_socket_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_tcp_server_socket_message_filter.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/pepper/pepper_tcp_server_socket_message_filter.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/logging.h" @@ -313,12 +315,13 @@ void PepperTCPServerSocketMessageFilter::OnAcceptCompleted( scoped_ptr<ppapi::host::ResourceHost> host = factory_->CreateAcceptedTCPSocket(instance_, ppapi::TCP_SOCKET_VERSION_PRIVATE, - accepted_socket_.Pass()); + std::move(accepted_socket_)); if (!host) { SendAcceptError(context, PP_ERROR_NOSPACE); return; } - int pending_resource_id = ppapi_host_->AddPendingResourceHost(host.Pass()); + int pending_resource_id = + ppapi_host_->AddPendingResourceHost(std::move(host)); if (pending_resource_id) { SendAcceptReply( context, PP_OK, pending_resource_id, local_addr, remote_addr); diff --git a/content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.cc b/content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.cc index 0fcbc10..91a8512 100644 --- a/content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/pepper/pepper_tcp_socket_message_filter.h" #include <cstring> +#include <utility> #include "base/bind.h" #include "base/location.h" @@ -108,7 +109,7 @@ PepperTCPSocketMessageFilter::PepperTCPSocketMessageFilter( rcvbuf_size_(0), sndbuf_size_(0), address_index_(0), - socket_(socket.Pass()), + socket_(std::move(socket)), ssl_context_helper_(host->ssl_context_helper()), pending_accept_(false), pending_read_on_unthrottle_(false), @@ -321,7 +322,7 @@ int32_t PepperTCPSocketMessageFilter::OnMsgSSLHandshake( scoped_ptr<net::ClientSocketHandle> handle(new net::ClientSocketHandle()); handle->SetSocket(make_scoped_ptr<net::StreamSocket>( - new net::TCPClientSocket(socket_.Pass(), peer_address))); + new net::TCPClientSocket(std::move(socket_), peer_address))); net::ClientSocketFactory* factory = net::ClientSocketFactory::GetDefaultFactory(); net::HostPortPair host_port_pair(server_name, server_port); @@ -329,11 +330,9 @@ int32_t PepperTCPSocketMessageFilter::OnMsgSSLHandshake( ssl_context.cert_verifier = ssl_context_helper_->GetCertVerifier(); ssl_context.transport_security_state = ssl_context_helper_->GetTransportSecurityState(); - ssl_socket_ = - factory->CreateSSLClientSocket(handle.Pass(), - host_port_pair, - ssl_context_helper_->ssl_config(), - ssl_context); + ssl_socket_ = factory->CreateSSLClientSocket( + std::move(handle), host_port_pair, ssl_context_helper_->ssl_config(), + ssl_context); if (!ssl_socket_) { LOG(WARNING) << "Failed to create an SSL client socket."; state_.CompletePendingTransition(false); @@ -1023,14 +1022,14 @@ void PepperTCPSocketMessageFilter::OnAcceptCompleted( // in CONNECTED state have a NULL |factory_|, while getting here requires // LISTENING state. scoped_ptr<ppapi::host::ResourceHost> host = - factory_->CreateAcceptedTCPSocket( - instance_, version_, accepted_socket_.Pass()); + factory_->CreateAcceptedTCPSocket(instance_, version_, + std::move(accepted_socket_)); if (!host) { SendAcceptError(context, PP_ERROR_NOSPACE); return; } int pending_host_id = - host_->GetPpapiHost()->AddPendingResourceHost(host.Pass()); + host_->GetPpapiHost()->AddPendingResourceHost(std::move(host)); if (pending_host_id) SendAcceptReply(context, PP_OK, pending_host_id, local_addr, remote_addr); else diff --git a/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc b/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc index 278ed63..d99b25b 100644 --- a/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc +++ b/content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.cc @@ -5,6 +5,7 @@ #include "content/browser/renderer_host/pepper/pepper_udp_socket_message_filter.h" #include <cstring> +#include <utility> #include "base/compiler_specific.h" #include "base/logging.h" @@ -503,7 +504,7 @@ void PepperUDPSocketMessageFilter::DoBind( base::Bind(&PepperUDPSocketMessageFilter::OnBindComplete, this, base::Passed(&socket), context, net_address)); #else - OnBindComplete(socket.Pass(), context, net_address); + OnBindComplete(std::move(socket), context, net_address); #endif } diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc index 215c09d..d422083 100644 --- a/content/browser/renderer_host/render_message_filter.cc +++ b/content/browser/renderer_host/render_message_filter.cc @@ -6,8 +6,8 @@ #include <errno.h> #include <string.h> - #include <map> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -391,17 +391,10 @@ void RenderMessageFilter::DownloadUrl(int render_view_id, url, net::DEFAULT_PRIORITY, NULL)); RecordDownloadSource(INITIATED_BY_RENDERER); resource_dispatcher_host_->BeginDownload( - request.Pass(), - referrer, + std::move(request), referrer, true, // is_content_initiated - resource_context_, - render_process_id_, - render_view_id, - render_frame_id, - false, - false, - save_info.Pass(), - DownloadItem::kInvalidId, + resource_context_, render_process_id_, render_view_id, render_frame_id, + false, false, std::move(save_info), DownloadItem::kInvalidId, ResourceDispatcherHostImpl::DownloadStartedCallback()); } diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc index 23ca20d..a1200cd 100644 --- a/content/browser/renderer_host/render_process_host_impl.cc +++ b/content/browser/renderer_host/render_process_host_impl.cc @@ -291,7 +291,7 @@ IPC::PlatformFileForTransit CreateFileForProcess(base::FilePath file_path, << dump_file.error_details(); return IPC::InvalidPlatformFileForTransit(); } - return IPC::TakeFileHandleForProcess(dump_file.Pass(), process); + return IPC::TakeFileHandleForProcess(std::move(dump_file), process); } #if defined(ENABLE_WEBRTC) diff --git a/content/browser/renderer_host/render_widget_host_impl.cc b/content/browser/renderer_host/render_widget_host_impl.cc index 81d89aa..cf4ed0f 100644 --- a/content/browser/renderer_host/render_widget_host_impl.cc +++ b/content/browser/renderer_host/render_widget_host_impl.cc @@ -293,7 +293,7 @@ scoped_ptr<RenderWidgetHostIterator> RenderWidgetHost::GetRenderWidgetHosts() { hosts->Add(widget); } - return hosts.Pass(); + return std::move(hosts); } // static @@ -304,7 +304,7 @@ RenderWidgetHostImpl::GetAllRenderWidgetHosts() { for (auto& it : g_routing_id_widget_map.Get()) hosts->Add(it.second); - return hosts.Pass(); + return std::move(hosts); } // static @@ -1185,12 +1185,11 @@ void RenderWidgetHostImpl::QueueSyntheticGesture( const base::Callback<void(SyntheticGesture::Result)>& on_complete) { if (!synthetic_gesture_controller_ && view_) { synthetic_gesture_controller_.reset( - new SyntheticGestureController( - view_->CreateSyntheticGestureTarget().Pass())); + new SyntheticGestureController(view_->CreateSyntheticGestureTarget())); } if (synthetic_gesture_controller_) { synthetic_gesture_controller_->QueueSyntheticGesture( - synthetic_gesture.Pass(), on_complete); + std::move(synthetic_gesture), on_complete); } } @@ -1587,12 +1586,12 @@ bool RenderWidgetHostImpl::OnSwapCompositorFrame( touch_emulator_->SetDoubleTapSupportForPageEnabled(!is_mobile_optimized); if (view_) { - view_->OnSwapCompositorFrame(output_surface_id, frame.Pass()); + view_->OnSwapCompositorFrame(output_surface_id, std::move(frame)); view_->DidReceiveRendererFrame(); } else { cc::CompositorFrameAck ack; if (frame->gl_frame_data) { - ack.gl_frame_data = frame->gl_frame_data.Pass(); + ack.gl_frame_data = std::move(frame->gl_frame_data); ack.gl_frame_data->sync_token.Clear(); } else if (frame->delegated_frame_data) { cc::TransferableResource::ReturnResources( diff --git a/content/browser/renderer_host/render_widget_host_view_aura.cc b/content/browser/renderer_host/render_widget_host_view_aura.cc index 9834f89..6968dfc 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura.cc @@ -1158,7 +1158,7 @@ bool RenderWidgetHostViewAura::CanCopyToVideoFrame() const { void RenderWidgetHostViewAura::BeginFrameSubscription( scoped_ptr<RenderWidgetHostViewFrameSubscriber> subscriber) { - delegated_frame_host_->BeginFrameSubscription(subscriber.Pass()); + delegated_frame_host_->BeginFrameSubscription(std::move(subscriber)); } void RenderWidgetHostViewAura::EndFrameSubscription() { diff --git a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc index 8de1e73..4c277ca 100644 --- a/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc +++ b/content/browser/renderer_host/render_widget_host_view_aura_unittest.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "base/macros.h" @@ -266,7 +267,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { void UseFakeDispatcher() { dispatcher_ = new FakeWindowEventDispatcher(window()->GetHost()); scoped_ptr<aura::WindowEventDispatcher> dispatcher(dispatcher_); - aura::test::SetHostDispatcher(window()->GetHost(), dispatcher.Pass()); + aura::test::SetHostDispatcher(window()->GetHost(), std::move(dispatcher)); } ~FakeRenderWidgetHostViewAura() override {} @@ -286,7 +287,7 @@ class FakeRenderWidgetHostViewAura : public RenderWidgetHostViewAura { } void InterceptCopyOfOutput(scoped_ptr<cc::CopyOutputRequest> request) { - last_copy_request_ = request.Pass(); + last_copy_request_ = std::move(request); if (last_copy_request_->has_texture_mailbox()) { // Give the resulting texture a size. GLHelper* gl_helper = ImageTransportFactory::GetInstance()->GetGLHelper(); @@ -1530,8 +1531,8 @@ scoped_ptr<cc::CompositorFrame> MakeDelegatedFrame(float scale_factor, scoped_ptr<cc::RenderPass> pass = cc::RenderPass::Create(); pass->SetNew( cc::RenderPassId(1, 1), gfx::Rect(size), damage, gfx::Transform()); - frame->delegated_frame_data->render_pass_list.push_back(pass.Pass()); - return frame.Pass(); + frame->delegated_frame_data->render_pass_list.push_back(std::move(pass)); + return frame; } // Resizing in fullscreen mode should send the up-to-date screen info. @@ -2295,7 +2296,7 @@ class RenderWidgetHostViewAuraCopyRequestTest void ReleaseSwappedFrame() { scoped_ptr<cc::CopyOutputRequest> request = - view_->last_copy_request_.Pass(); + std::move(view_->last_copy_request_); request->SendTextureResult(view_rect_.size(), request->texture_mailbox(), scoped_ptr<cc::SingleReleaseCallback>()); RunLoopUntilCallback(); @@ -2407,7 +2408,8 @@ TEST_F(RenderWidgetHostViewAuraCopyRequestTest, DestroyedAfterCopyRequest) { OnSwapCompositorFrame(); EXPECT_EQ(1, callback_count_); - scoped_ptr<cc::CopyOutputRequest> request = view_->last_copy_request_.Pass(); + scoped_ptr<cc::CopyOutputRequest> request = + std::move(view_->last_copy_request_); // Destroy the RenderWidgetHostViewAura and ImageTransportFactory. TearDownEnvironment(); diff --git a/content/browser/renderer_host/render_widget_host_view_browsertest.cc b/content/browser/renderer_host/render_widget_host_view_browsertest.cc index 1c33876..d7f79a0 100644 --- a/content/browser/renderer_host/render_widget_host_view_browsertest.cc +++ b/content/browser/renderer_host/render_widget_host_view_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/barrier_closure.h" #include "base/command_line.h" @@ -348,7 +349,7 @@ IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, &RenderWidgetHostViewBrowserTest::FrameDelivered, base::Unretained(this), base::ThreadTaskRunnerHandle::Get(), run_loop.QuitClosure()))); - view->BeginFrameSubscription(subscriber.Pass()); + view->BeginFrameSubscription(std::move(subscriber)); run_loop.Run(); view->EndFrameSubscription(); diff --git a/content/browser/renderer_host/render_widget_host_view_mus.cc b/content/browser/renderer_host/render_widget_host_view_mus.cc index cb35976..26a0022 100644 --- a/content/browser/renderer_host/render_widget_host_view_mus.cc +++ b/content/browser/renderer_host/render_widget_host_view_mus.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/render_widget_host_view_mus.h" +#include <utility> + #include "build/build_config.h" #include "components/mus/public/cpp/window.h" #include "components/mus/public/cpp/window_tree_connection.h" @@ -43,7 +45,7 @@ RenderWidgetHostViewMus::RenderWidgetHostViewMus(mus::Window* parent_window, mus::mojom::WindowTreeClientPtr window_tree_client; factory->CreateWindowTreeClientForRenderWidget( host_->GetRoutingID(), mojo::GetProxy(&window_tree_client)); - mus_window_->window()->Embed(window_tree_client.Pass()); + mus_window_->window()->Embed(std::move(window_tree_client)); } RenderWidgetHostViewMus::~RenderWidgetHostViewMus() {} diff --git a/content/browser/renderer_host/websocket_host.cc b/content/browser/renderer_host/websocket_host.cc index f032282..5551e96 100644 --- a/content/browser/renderer_host/websocket_host.cc +++ b/content/browser/renderer_host/websocket_host.cc @@ -4,6 +4,8 @@ #include "content/browser/renderer_host/websocket_host.h" +#include <utility> + #include "base/location.h" #include "base/macros.h" #include "base/memory/weak_ptr.h" @@ -274,7 +276,7 @@ ChannelState WebSocketEventHandler::OnSSLCertificateError( << " routing_id=" << routing_id_ << " url=" << url.spec() << " cert_status=" << ssl_info.cert_status << " fatal=" << fatal; ssl_error_handler_delegate_.reset( - new SSLErrorHandlerDelegate(callbacks.Pass())); + new SSLErrorHandlerDelegate(std::move(callbacks))); SSLManager::OnSSLCertificateSubresourceError( ssl_error_handler_delegate_->GetWeakPtr(), url, dispatcher_->render_process_id(), render_frame_id_, ssl_info, fatal); @@ -284,7 +286,7 @@ ChannelState WebSocketEventHandler::OnSSLCertificateError( WebSocketEventHandler::SSLErrorHandlerDelegate::SSLErrorHandlerDelegate( scoped_ptr<net::WebSocketEventInterface::SSLErrorCallbacks> callbacks) - : callbacks_(callbacks.Pass()), weak_ptr_factory_(this) {} + : callbacks_(std::move(callbacks)), weak_ptr_factory_(this) {} WebSocketEventHandler::SSLErrorHandlerDelegate::~SSLErrorHandlerDelegate() {} @@ -382,8 +384,8 @@ void WebSocketHost::AddChannel( scoped_ptr<net::WebSocketEventInterface> event_interface( new WebSocketEventHandler(dispatcher_, routing_id_, render_frame_id)); - channel_.reset( - new net::WebSocketChannel(event_interface.Pass(), url_request_context_)); + channel_.reset(new net::WebSocketChannel(std::move(event_interface), + url_request_context_)); if (pending_flow_control_quota_ > 0) { // channel_->SendFlowControl(pending_flow_control_quota_) must be called diff --git a/content/browser/service_worker/embedded_worker_instance.cc b/content/browser/service_worker/embedded_worker_instance.cc index 17c3022..c40adea 100644 --- a/content/browser/service_worker/embedded_worker_instance.cc +++ b/content/browser/service_worker/embedded_worker_instance.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/embedded_worker_instance.h" +#include <utility> + #include "base/bind_helpers.h" #include "base/macros.h" #include "base/metrics/histogram_macros.h" @@ -86,8 +88,8 @@ void SetupMojoOnUIThread( return; EmbeddedWorkerSetupPtr setup; rph->GetServiceRegistry()->ConnectToRemoteService(mojo::GetProxy(&setup)); - setup->ExchangeServiceProviders(thread_id, services.Pass(), - mojo::MakeProxy(exposed_services.Pass())); + setup->ExchangeServiceProviders(thread_id, std::move(services), + mojo::MakeProxy(std::move(exposed_services))); } } // namespace @@ -263,7 +265,7 @@ void EmbeddedWorkerInstance::RunProcessAllocated( callback.Run(SERVICE_WORKER_ERROR_ABORT); return; } - instance->ProcessAllocated(params.Pass(), callback, process_id, + instance->ProcessAllocated(std::move(params), callback, process_id, is_new_process, status); } @@ -342,7 +344,7 @@ void EmbeddedWorkerInstance::SendStartWorker( starting_phase_ = SENT_START_WORKER; ServiceWorkerStatusCode status = - registry_->SendStartWorker(params.Pass(), process_id_); + registry_->SendStartWorker(std::move(params), process_id_); if (status != SERVICE_WORKER_OK) { OnStartFailed(callback, status); return; @@ -397,7 +399,7 @@ void EmbeddedWorkerInstance::OnThreadStarted(int thread_id) { base::Bind(SetupMojoOnUIThread, process_id_, thread_id_, base::Passed(&services_request), base::Passed(exposed_services.PassInterface()))); - service_registry_->BindRemoteServiceProvider(services.Pass()); + service_registry_->BindRemoteServiceProvider(std::move(services)); } void EmbeddedWorkerInstance::OnScriptLoadFailed() { diff --git a/content/browser/service_worker/embedded_worker_instance_unittest.cc b/content/browser/service_worker/embedded_worker_instance_unittest.cc index 4057e3a..b19f884 100644 --- a/content/browser/service_worker/embedded_worker_instance_unittest.cc +++ b/content/browser/service_worker/embedded_worker_instance_unittest.cc @@ -2,12 +2,14 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/service_worker/embedded_worker_instance.h" + #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/run_loop.h" #include "base/stl_util.h" -#include "content/browser/service_worker/embedded_worker_instance.h" #include "content/browser/service_worker/embedded_worker_registry.h" #include "content/browser/service_worker/embedded_worker_test_helper.h" #include "content/browser/service_worker/service_worker_context_core.h" @@ -265,9 +267,10 @@ TEST_F(EmbeddedWorkerInstanceTest, DetachDuringStart) { // SendStartWorker. worker->status_ = EmbeddedWorkerInstance::STOPPED; base::RunLoop run_loop; - worker->SendStartWorker(params.Pass(), base::Bind(&SaveStatusAndCall, &status, - run_loop.QuitClosure()), - true, -1, false); + worker->SendStartWorker( + std::move(params), + base::Bind(&SaveStatusAndCall, &status, run_loop.QuitClosure()), true, -1, + false); run_loop.Run(); EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); // Don't expect SendStartWorker() to dispatch an OnStopped/Detached() message @@ -280,8 +283,9 @@ TEST_F(EmbeddedWorkerInstanceTest, DetachDuringStart) { worker->status_ = EmbeddedWorkerInstance::STOPPED; EmbeddedWorkerInstance* worker_ptr = worker.get(); worker_ptr->SendStartWorker( - params.Pass(), base::Bind(&DestroyWorker, base::Passed(&worker), &status), - true, -1, false); + std::move(params), + base::Bind(&DestroyWorker, base::Passed(&worker), &status), true, -1, + false); // No crash. EXPECT_EQ(SERVICE_WORKER_ERROR_ABORT, status); } diff --git a/content/browser/service_worker/embedded_worker_registry.cc b/content/browser/service_worker/embedded_worker_registry.cc index 2a83ba9..73eb49f 100644 --- a/content/browser/service_worker/embedded_worker_registry.cc +++ b/content/browser/service_worker/embedded_worker_registry.cc @@ -40,7 +40,7 @@ scoped_ptr<EmbeddedWorkerInstance> EmbeddedWorkerRegistry::CreateWorker() { scoped_ptr<EmbeddedWorkerInstance> worker( new EmbeddedWorkerInstance(context_, next_embedded_worker_id_)); worker_map_[next_embedded_worker_id_++] = worker.get(); - return worker.Pass(); + return worker; } ServiceWorkerStatusCode EmbeddedWorkerRegistry::StopWorker( diff --git a/content/browser/service_worker/embedded_worker_test_helper.cc b/content/browser/service_worker/embedded_worker_test_helper.cc index f3f557d..e8cbe2d 100644 --- a/content/browser/service_worker/embedded_worker_test_helper.cc +++ b/content/browser/service_worker/embedded_worker_test_helper.cc @@ -6,6 +6,7 @@ #include <map> #include <string> +#include <utility> #include "base/atomic_sequence_num.h" #include "base/bind.h" @@ -57,7 +58,7 @@ EmbeddedWorkerTestHelper::EmbeddedWorkerTestHelper( scoped_ptr<MockServiceWorkerDatabaseTaskManager> database_task_manager( new MockServiceWorkerDatabaseTaskManager( base::ThreadTaskRunnerHandle::Get())); - wrapper_->InitInternal(user_data_directory, database_task_manager.Pass(), + wrapper_->InitInternal(user_data_directory, std::move(database_task_manager), base::ThreadTaskRunnerHandle::Get(), nullptr, nullptr); wrapper_->process_manager()->SetProcessIdForTest(mock_render_process_id_); registry()->AddChildProcessSender(mock_render_process_id_, this, diff --git a/content/browser/service_worker/service_worker_browsertest.cc b/content/browser/service_worker/service_worker_browsertest.cc index 10b727c..6ef3306 100644 --- a/content/browser/service_worker/service_worker_browsertest.cc +++ b/content/browser/service_worker/service_worker_browsertest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -220,7 +221,7 @@ scoped_ptr<net::test_server::HttpResponse> VerifyServiceWorkerHeaderInRequest( scoped_ptr<net::test_server::BasicHttpResponse> http_response( new net::test_server::BasicHttpResponse()); http_response->set_content_type("text/javascript"); - return http_response.Pass(); + return std::move(http_response); } // The ImportsBustMemcache test requires that the imported script @@ -261,12 +262,12 @@ void CreateLongLivedResourceInterceptors( interceptor.reset(new LongLivedResourceInterceptor( "importScripts('long_lived_import.js');")); net::URLRequestFilter::GetInstance()->AddUrlInterceptor( - worker_url, interceptor.Pass()); + worker_url, std::move(interceptor)); interceptor.reset(new LongLivedResourceInterceptor( "// the imported script does nothing")); net::URLRequestFilter::GetInstance()->AddUrlInterceptor( - import_url, interceptor.Pass()); + import_url, std::move(interceptor)); } void CountScriptResources( @@ -454,7 +455,7 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { ASSERT_TRUE(prepare_result); *result = fetch_result.result; *response = fetch_result.response; - *blob_data_handle = fetch_result.blob_data_handle.Pass(); + *blob_data_handle = std::move(fetch_result.blob_data_handle); ASSERT_EQ(SERVICE_WORKER_OK, fetch_result.status); } @@ -507,7 +508,7 @@ class ServiceWorkerVersionBrowserTest : public ServiceWorkerBrowserTest { embedded_test_server()->GetURL("/service_worker/host")); host->AssociateRegistration(registration_.get(), false /* notify_controllerchange */); - wrapper()->context()->AddProviderHost(host.Pass()); + wrapper()->context()->AddProviderHost(std::move(host)); } void AddWaitingWorkerOnIOThread(const std::string& worker_url) { diff --git a/content/browser/service_worker/service_worker_cache_writer_unittest.cc b/content/browser/service_worker/service_worker_cache_writer_unittest.cc index 96f6599..030411b 100644 --- a/content/browser/service_worker/service_worker_cache_writer_unittest.cc +++ b/content/browser/service_worker/service_worker_cache_writer_unittest.cc @@ -361,14 +361,14 @@ class ServiceWorkerCacheWriterTest : public ::testing::Test { return make_scoped_ptr<ServiceWorkerResponseReader>(nullptr); scoped_ptr<ServiceWorkerResponseReader> reader(readers_.front()); readers_.pop_front(); - return reader.Pass(); + return reader; } scoped_ptr<ServiceWorkerResponseWriter> CreateWriter() { if (writers_.empty()) return make_scoped_ptr<ServiceWorkerResponseWriter>(nullptr); scoped_ptr<ServiceWorkerResponseWriter> writer(writers_.front()); writers_.pop_front(); - return writer.Pass(); + return writer; } ServiceWorkerCacheWriter::OnWriteCompleteCallback CreateWriteCallback() { diff --git a/content/browser/service_worker/service_worker_context_core.cc b/content/browser/service_worker/service_worker_context_core.cc index 487fdbd..f6aa212 100644 --- a/content/browser/service_worker/service_worker_context_core.cc +++ b/content/browser/service_worker/service_worker_context_core.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_context_core.h" +#include <utility> + #include "base/barrier_closure.h" #include "base/bind.h" #include "base/bind_helpers.h" @@ -222,12 +224,9 @@ ServiceWorkerContextCore::ServiceWorkerContextCore( weak_factory_(this) { // These get a WeakPtr from weak_factory_, so must be set after weak_factory_ // is initialized. - storage_ = ServiceWorkerStorage::Create(path, - AsWeakPtr(), - database_task_manager.Pass(), - disk_cache_thread, - quota_manager_proxy, - special_storage_policy); + storage_ = ServiceWorkerStorage::Create( + path, AsWeakPtr(), std::move(database_task_manager), disk_cache_thread, + quota_manager_proxy, special_storage_policy); embedded_worker_registry_ = EmbeddedWorkerRegistry::Create(AsWeakPtr()); job_coordinator_.reset(new ServiceWorkerJobCoordinator(AsWeakPtr())); } @@ -334,7 +333,7 @@ void ServiceWorkerContextCore::HasMainFrameProviderHost( BrowserThread::PostTaskAndReplyWithResult( BrowserThread::UI, FROM_HERE, base::Bind(&FrameListContainsMainFrameOnUI, - base::Passed(render_frames.Pass())), + base::Passed(std::move(render_frames))), callback); } diff --git a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc index 42841cb..94bc88e 100644 --- a/content/browser/service_worker/service_worker_context_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_context_request_handler_unittest.cc @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/service_worker/service_worker_context_request_handler.h" + +#include <utility> + #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/run_loop.h" @@ -9,7 +13,6 @@ #include "content/browser/fileapi/mock_url_request_delegate.h" #include "content/browser/service_worker/embedded_worker_test_helper.h" #include "content/browser/service_worker/service_worker_context_core.h" -#include "content/browser/service_worker/service_worker_context_request_handler.h" #include "content/browser/service_worker/service_worker_provider_host.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/browser/service_worker/service_worker_write_to_cache_job.h" @@ -49,7 +52,7 @@ class ServiceWorkerContextRequestHandlerTest : public testing::Test { MSG_ROUTING_NONE /* render_frame_id */, 1 /* provider_id */, SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr(), nullptr)); provider_host_ = host->AsWeakPtr(); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); base::RunLoop().RunUntilIdle(); diff --git a/content/browser/service_worker/service_worker_context_watcher.cc b/content/browser/service_worker/service_worker_context_watcher.cc index cee965b..d28f8bf 100644 --- a/content/browser/service_worker/service_worker_context_watcher.cc +++ b/content/browser/service_worker/service_worker_context_watcher.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_context_watcher.h" +#include <utility> + #include "base/bind.h" #include "base/containers/scoped_ptr_hash_map.h" #include "content/browser/service_worker/service_worker_context_observer.h" @@ -175,7 +177,7 @@ void ServiceWorkerContextWatcher::OnNewLiveVersion(int64_t version_id, version->script_url = script_url; SendVersionInfo(*version); if (!IsStoppedAndRedundant(*version)) - version_info_map_.set(version_id, version.Pass()); + version_info_map_.set(version_id, std::move(version)); } void ServiceWorkerContextWatcher::OnRunningStateChanged( diff --git a/content/browser/service_worker/service_worker_context_wrapper.cc b/content/browser/service_worker/service_worker_context_wrapper.cc index 81a6416..cfe5d87 100644 --- a/content/browser/service_worker/service_worker_context_wrapper.cc +++ b/content/browser/service_worker/service_worker_context_wrapper.cc @@ -7,6 +7,7 @@ #include <map> #include <set> #include <string> +#include <utility> #include <vector> #include "base/barrier_closure.h" @@ -114,11 +115,8 @@ void ServiceWorkerContextWrapper::Init( new ServiceWorkerDatabaseTaskManagerImpl(pool)); scoped_refptr<base::SingleThreadTaskRunner> disk_cache_thread = BrowserThread::GetMessageLoopProxyForThread(BrowserThread::CACHE); - InitInternal(user_data_directory, - database_task_manager.Pass(), - disk_cache_thread, - quota_manager_proxy, - special_storage_policy); + InitInternal(user_data_directory, std::move(database_task_manager), + disk_cache_thread, quota_manager_proxy, special_storage_policy); } void ServiceWorkerContextWrapper::Shutdown() { @@ -678,13 +676,9 @@ void ServiceWorkerContextWrapper::InitInternal( if (quota_manager_proxy) { quota_manager_proxy->RegisterClient(new ServiceWorkerQuotaClient(this)); } - context_core_.reset(new ServiceWorkerContextCore(user_data_directory, - database_task_manager.Pass(), - disk_cache_thread, - quota_manager_proxy, - special_storage_policy, - observer_list_.get(), - this)); + context_core_.reset(new ServiceWorkerContextCore( + user_data_directory, std::move(database_task_manager), disk_cache_thread, + quota_manager_proxy, special_storage_policy, observer_list_.get(), this)); } void ServiceWorkerContextWrapper::ShutdownOnIO() { diff --git a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc index f0bd2b2..b2d8794 100644 --- a/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_controllee_request_handler_unittest.cc @@ -2,6 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/service_worker/service_worker_controllee_request_handler.h" + +#include <utility> + #include "base/files/scoped_temp_dir.h" #include "base/logging.h" #include "base/run_loop.h" @@ -9,7 +13,6 @@ #include "content/browser/fileapi/mock_url_request_delegate.h" #include "content/browser/service_worker/embedded_worker_test_helper.h" #include "content/browser/service_worker/service_worker_context_core.h" -#include "content/browser/service_worker/service_worker_controllee_request_handler.h" #include "content/browser/service_worker/service_worker_provider_host.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/browser/service_worker/service_worker_registration.h" @@ -62,7 +65,7 @@ class ServiceWorkerControlleeRequestHandlerTest : public testing::Test { helper_->mock_render_process_id(), MSG_ROUTING_NONE, kMockProviderId, SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr(), NULL)); provider_host_ = host->AsWeakPtr(); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); base::RunLoop().RunUntilIdle(); diff --git a/content/browser/service_worker/service_worker_dispatcher_host.cc b/content/browser/service_worker/service_worker_dispatcher_host.cc index 1e264d8..f8d80e0 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_dispatcher_host.h" +#include <utility> + #include "base/logging.h" #include "base/macros.h" #include "base/profiler/scoped_tracker.h" @@ -278,7 +280,7 @@ ServiceWorkerDispatcherHost::GetOrCreateRegistrationHandle( new ServiceWorkerRegistrationHandle(GetContext()->AsWeakPtr(), provider_host, registration)); ServiceWorkerRegistrationHandle* new_handle_ptr = new_handle.get(); - RegisterServiceWorkerRegistrationHandle(new_handle.Pass()); + RegisterServiceWorkerRegistrationHandle(std::move(new_handle)); return new_handle_ptr; } @@ -765,7 +767,7 @@ void ServiceWorkerDispatcherHost::OnProviderCreated( render_process_id_, route_id, provider_id, provider_type, GetContext()->AsWeakPtr(), this)); } - GetContext()->AddProviderHost(provider_host.Pass()); + GetContext()->AddProviderHost(std::move(provider_host)); } void ServiceWorkerDispatcherHost::OnProviderDestroyed(int provider_id) { diff --git a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc index 2d9d36e..84e1b6e 100644 --- a/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc +++ b/content/browser/service_worker/service_worker_dispatcher_host_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_dispatcher_host.h" #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "base/files/file_path.h" @@ -181,7 +182,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); Register(kProviderId, GURL("https://www.example.com/"), @@ -210,7 +211,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_HTTPS) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); Register(kProviderId, GURL("https://www.example.com/"), @@ -223,7 +224,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_NonSecureTransportLocalhost) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("http://127.0.0.3:81/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); Register(kProviderId, GURL("http://127.0.0.3:81/bar"), @@ -236,7 +237,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_InvalidScopeShouldFail) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendRegister(kProviderId, GURL(""), GURL("https://www.example.com/bar/hoge.js")); @@ -248,7 +249,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_InvalidScriptShouldFail) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendRegister(kProviderId, GURL("https://www.example.com/bar/"), GURL("")); EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); @@ -259,7 +260,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_NonSecureOriginShouldFail) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("http://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendRegister(kProviderId, GURL("http://www.example.com/"), @@ -272,7 +273,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_CrossOriginShouldFail) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); // Script has a different host SendRegister(kProviderId, @@ -316,7 +317,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, Register_BadCharactersShouldFail) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendRegister(kProviderId, GURL("https://www.example.com/%2f"), GURL("https://www.example.com/")); @@ -349,7 +350,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("filesystem:https://www.example.com/temporary/a")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendRegister(kProviderId, GURL("filesystem:https://www.example.com/temporary/"), @@ -373,7 +374,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/temporary/")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendRegister(kProviderId, GURL("filesystem:https://www.example.com/temporary/"), @@ -440,7 +441,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_SameOrigin) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); GetRegistration(kProviderId, GURL("https://www.example.com/"), @@ -452,7 +453,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistration_CrossOriginShouldFail) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendGetRegistration(kProviderId, GURL("https://foo.example.com/")); EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); @@ -464,7 +465,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendGetRegistration(kProviderId, GURL("")); EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); @@ -476,7 +477,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("http://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendGetRegistration(kProviderId, GURL("http://www.example.com/")); EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); @@ -498,7 +499,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, GetRegistrations_SecureOrigin) { scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("https://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); GetRegistrations(kProviderId, ServiceWorkerMsg_DidGetRegistrations::ID); } @@ -509,7 +510,7 @@ TEST_F(ServiceWorkerDispatcherHostTest, scoped_ptr<ServiceWorkerProviderHost> host( CreateServiceWorkerProviderHost(kProviderId)); host->SetDocumentUrl(GURL("http://www.example.com/foo")); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); SendGetRegistrations(kProviderId); EXPECT_EQ(1, dispatcher_host_->bad_messages_received_count_); diff --git a/content/browser/service_worker/service_worker_fetch_dispatcher.cc b/content/browser/service_worker/service_worker_fetch_dispatcher.cc index 771cbb1..60c4eb6 100644 --- a/content/browser/service_worker/service_worker_fetch_dispatcher.cc +++ b/content/browser/service_worker/service_worker_fetch_dispatcher.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_fetch_dispatcher.h" +#include <utility> + #include "base/bind.h" #include "base/trace_event/trace_event.h" #include "content/browser/service_worker/service_worker_version.h" @@ -18,9 +20,8 @@ ServiceWorkerFetchDispatcher::ServiceWorkerFetchDispatcher( : version_(version), prepare_callback_(prepare_callback), fetch_callback_(fetch_callback), - request_(request.Pass()), - weak_factory_(this) { -} + request_(std::move(request)), + weak_factory_(this) {} ServiceWorkerFetchDispatcher::~ServiceWorkerFetchDispatcher() {} diff --git a/content/browser/service_worker/service_worker_internals_ui.cc b/content/browser/service_worker/service_worker_internals_ui.cc index cf46466..ae899dc 100644 --- a/content/browser/service_worker/service_worker_internals_ui.cc +++ b/content/browser/service_worker/service_worker_internals_ui.cc @@ -5,8 +5,8 @@ #include "content/browser/service_worker/service_worker_internals_ui.h" #include <stdint.h> - #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -431,7 +431,8 @@ void ServiceWorkerInternalsUI::AddContextFromStoragePartition( scoped_ptr<PartitionObserver> new_observer( new PartitionObserver(partition_id, web_ui())); context->AddObserver(new_observer.get()); - observers_.set(reinterpret_cast<uintptr_t>(partition), new_observer.Pass()); + observers_.set(reinterpret_cast<uintptr_t>(partition), + std::move(new_observer)); } BrowserThread::PostTask( diff --git a/content/browser/service_worker/service_worker_job_coordinator.cc b/content/browser/service_worker/service_worker_job_coordinator.cc index da417c7..b8f71cf 100644 --- a/content/browser/service_worker/service_worker_job_coordinator.cc +++ b/content/browser/service_worker/service_worker_job_coordinator.cc @@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_job_coordinator.h" #include <stddef.h> +#include <utility> #include "base/memory/scoped_ptr.h" #include "base/stl_util.h" @@ -107,9 +108,8 @@ void ServiceWorkerJobCoordinator::Register( const ServiceWorkerRegisterJob::RegistrationCallback& callback) { scoped_ptr<ServiceWorkerRegisterJobBase> job( new ServiceWorkerRegisterJob(context_, pattern, script_url)); - ServiceWorkerRegisterJob* queued_job = - static_cast<ServiceWorkerRegisterJob*>( - job_queues_[pattern].Push(job.Pass())); + ServiceWorkerRegisterJob* queued_job = static_cast<ServiceWorkerRegisterJob*>( + job_queues_[pattern].Push(std::move(job))); queued_job->AddCallback(callback, provider_host); } @@ -120,7 +120,7 @@ void ServiceWorkerJobCoordinator::Unregister( new ServiceWorkerUnregisterJob(context_, pattern)); ServiceWorkerUnregisterJob* queued_job = static_cast<ServiceWorkerUnregisterJob*>( - job_queues_[pattern].Push(job.Pass())); + job_queues_[pattern].Push(std::move(job))); queued_job->AddCallback(callback); } diff --git a/content/browser/service_worker/service_worker_navigation_handle_core.cc b/content/browser/service_worker/service_worker_navigation_handle_core.cc index f1dc1ee..8c4791d 100644 --- a/content/browser/service_worker/service_worker_navigation_handle_core.cc +++ b/content/browser/service_worker/service_worker_navigation_handle_core.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_navigation_handle_core.h" +#include <utility> + #include "base/bind.h" #include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_context_wrapper.h" @@ -37,7 +39,7 @@ void ServiceWorkerNavigationHandleCore::DidPreCreateProviderHost( DCHECK(precreated_host.get()); DCHECK(context_wrapper_->context()); - precreated_host_ = precreated_host.Pass(); + precreated_host_ = std::move(precreated_host); context_wrapper_->context()->AddNavigationHandleCore( precreated_host_->provider_id(), this); BrowserThread::PostTask( @@ -57,7 +59,7 @@ ServiceWorkerNavigationHandleCore::RetrievePreCreatedHost() { DCHECK(context_wrapper_->context()); context_wrapper_->context()->RemoveNavigationHandleCore( precreated_host_->provider_id()); - return precreated_host_.Pass(); + return std::move(precreated_host_); } } // namespace content diff --git a/content/browser/service_worker/service_worker_provider_host.cc b/content/browser/service_worker/service_worker_provider_host.cc index 359010c..ed87996 100644 --- a/content/browser/service_worker/service_worker_provider_host.cc +++ b/content/browser/service_worker/service_worker_provider_host.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_provider_host.h" +#include <utility> + #include "base/guid.h" #include "base/stl_util.h" #include "base/time/time.h" @@ -394,7 +396,7 @@ ServiceWorkerProviderHost::GetOrCreateServiceWorkerHandle( scoped_ptr<ServiceWorkerHandle> new_handle( ServiceWorkerHandle::Create(context_, AsWeakPtr(), version)); handle = new_handle.get(); - dispatcher_host_->RegisterServiceWorkerHandle(new_handle.Pass()); + dispatcher_host_->RegisterServiceWorkerHandle(std::move(new_handle)); return handle->GetObjectInfo(); } diff --git a/content/browser/service_worker/service_worker_registration_unittest.cc b/content/browser/service_worker/service_worker_registration_unittest.cc index 0bbe673..4ba7d00 100644 --- a/content/browser/service_worker/service_worker_registration_unittest.cc +++ b/content/browser/service_worker/service_worker_registration_unittest.cc @@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_registration.h" #include <stdint.h> +#include <utility> #include "base/files/scoped_temp_dir.h" #include "base/logging.h" @@ -27,14 +28,9 @@ class ServiceWorkerRegistrationTest : public testing::Test { scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager( new MockServiceWorkerDatabaseTaskManager( base::ThreadTaskRunnerHandle::Get())); - context_.reset( - new ServiceWorkerContextCore(base::FilePath(), - database_task_manager.Pass(), - base::ThreadTaskRunnerHandle::Get(), - NULL, - NULL, - NULL, - NULL)); + context_.reset(new ServiceWorkerContextCore( + base::FilePath(), std::move(database_task_manager), + base::ThreadTaskRunnerHandle::Get(), NULL, NULL, NULL, NULL)); context_ptr_ = context_->AsWeakPtr(); } diff --git a/content/browser/service_worker/service_worker_request_handler.cc b/content/browser/service_worker/service_worker_request_handler.cc index bd27e42..05984a1 100644 --- a/content/browser/service_worker/service_worker_request_handler.cc +++ b/content/browser/service_worker/service_worker_request_handler.cc @@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_request_handler.h" #include <string> +#include <utility> #include "base/macros.h" #include "content/browser/service_worker/service_worker_context_core.h" @@ -136,7 +137,7 @@ void ServiceWorkerRequestHandler::InitializeForNavigation( // transferred to its "final" destination in the OnProviderCreated handler. If // the navigation fails, it will be destroyed along with the // ServiceWorkerNavigationHandleCore. - navigation_handle_core->DidPreCreateProviderHost(provider_host.Pass()); + navigation_handle_core->DidPreCreateProviderHost(std::move(provider_host)); } void ServiceWorkerRequestHandler::InitializeHandler( @@ -217,7 +218,7 @@ void ServiceWorkerRequestHandler::CompleteCrossSiteTransfer( return; DCHECK_EQ(provider_host_.get(), host_for_cross_site_transfer_.get()); context_->TransferProviderHostIn(new_process_id, new_provider_id, - host_for_cross_site_transfer_.Pass()); + std::move(host_for_cross_site_transfer_)); DCHECK_EQ(provider_host_->provider_id(), new_provider_id); } diff --git a/content/browser/service_worker/service_worker_request_handler_unittest.cc b/content/browser/service_worker/service_worker_request_handler_unittest.cc index 37b53f8..f2be209 100644 --- a/content/browser/service_worker/service_worker_request_handler_unittest.cc +++ b/content/browser/service_worker/service_worker_request_handler_unittest.cc @@ -4,6 +4,8 @@ #include "content/browser/service_worker/service_worker_request_handler.h" +#include <utility> + #include "base/run_loop.h" #include "content/browser/fileapi/mock_url_request_delegate.h" #include "content/browser/service_worker/embedded_worker_test_helper.h" @@ -53,7 +55,7 @@ class ServiceWorkerRequestHandlerTest : public testing::Test { SERVICE_WORKER_PROVIDER_FOR_WINDOW, context()->AsWeakPtr(), nullptr)); host->SetDocumentUrl(GURL("http://host/scope/")); provider_host_ = host->AsWeakPtr(); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); context()->storage()->LazyInitialize(base::Bind(&EmptyCallback)); base::RunLoop().RunUntilIdle(); diff --git a/content/browser/service_worker/service_worker_storage.cc b/content/browser/service_worker/service_worker_storage.cc index 4bb270f..fff8726 100644 --- a/content/browser/service_worker/service_worker_storage.cc +++ b/content/browser/service_worker/service_worker_storage.cc @@ -5,6 +5,7 @@ #include "content/browser/service_worker/service_worker_storage.h" #include <stddef.h> +#include <utility> #include "base/bind_helpers.h" #include "base/files/file_util.h" @@ -114,12 +115,9 @@ scoped_ptr<ServiceWorkerStorage> ServiceWorkerStorage::Create( const scoped_refptr<base::SingleThreadTaskRunner>& disk_cache_thread, storage::QuotaManagerProxy* quota_manager_proxy, storage::SpecialStoragePolicy* special_storage_policy) { - return make_scoped_ptr(new ServiceWorkerStorage(path, - context, - database_task_manager.Pass(), - disk_cache_thread, - quota_manager_proxy, - special_storage_policy)); + return make_scoped_ptr(new ServiceWorkerStorage( + path, context, std::move(database_task_manager), disk_cache_thread, + quota_manager_proxy, special_storage_policy)); } // static @@ -783,7 +781,7 @@ ServiceWorkerStorage::ServiceWorkerStorage( state_(UNINITIALIZED), path_(path), context_(context), - database_task_manager_(database_task_manager.Pass()), + database_task_manager_(std::move(database_task_manager)), disk_cache_thread_(disk_cache_thread), quota_manager_proxy_(quota_manager_proxy), special_storage_policy_(special_storage_policy), @@ -1466,21 +1464,21 @@ void ServiceWorkerStorage::ReadInitialDataFromDB( &data->next_resource_id); if (status != ServiceWorkerDatabase::STATUS_OK) { original_task_runner->PostTask( - FROM_HERE, base::Bind(callback, base::Passed(data.Pass()), status)); + FROM_HERE, base::Bind(callback, base::Passed(std::move(data)), status)); return; } status = database->GetOriginsWithRegistrations(&data->origins); if (status != ServiceWorkerDatabase::STATUS_OK) { original_task_runner->PostTask( - FROM_HERE, base::Bind(callback, base::Passed(data.Pass()), status)); + FROM_HERE, base::Bind(callback, base::Passed(std::move(data)), status)); return; } status = database->GetOriginsWithForeignFetchRegistrations( &data->foreign_fetch_origins); original_task_runner->PostTask( - FROM_HERE, base::Bind(callback, base::Passed(data.Pass()), status)); + FROM_HERE, base::Bind(callback, base::Passed(std::move(data)), status)); } void ServiceWorkerStorage::DeleteRegistrationFromDB( diff --git a/content/browser/service_worker/service_worker_storage_unittest.cc b/content/browser/service_worker/service_worker_storage_unittest.cc index 2cc2c49..e9f2c9b 100644 --- a/content/browser/service_worker/service_worker_storage_unittest.cc +++ b/content/browser/service_worker/service_worker_storage_unittest.cc @@ -2,9 +2,11 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "content/browser/service_worker/service_worker_storage.h" +#include <stdint.h> #include <string> +#include <utility> #include "base/files/file_util.h" #include "base/files/scoped_temp_dir.h" @@ -17,7 +19,6 @@ #include "content/browser/service_worker/service_worker_context_core.h" #include "content/browser/service_worker/service_worker_disk_cache.h" #include "content/browser/service_worker/service_worker_registration.h" -#include "content/browser/service_worker/service_worker_storage.h" #include "content/browser/service_worker/service_worker_version.h" #include "content/common/service_worker/service_worker_status_code.h" #include "content/common/service_worker/service_worker_utils.h" @@ -279,14 +280,9 @@ class ServiceWorkerStorageTest : public testing::Test { scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager( new MockServiceWorkerDatabaseTaskManager( base::ThreadTaskRunnerHandle::Get())); - context_.reset( - new ServiceWorkerContextCore(GetUserDataDirectory(), - database_task_manager.Pass(), - base::ThreadTaskRunnerHandle::Get(), - NULL, - NULL, - NULL, - NULL)); + context_.reset(new ServiceWorkerContextCore( + GetUserDataDirectory(), std::move(database_task_manager), + base::ThreadTaskRunnerHandle::Get(), NULL, NULL, NULL, NULL)); context_ptr_ = context_->AsWeakPtr(); } @@ -1214,14 +1210,9 @@ TEST_F(ServiceWorkerResourceStorageDiskTest, CleanupOnRestart) { scoped_ptr<ServiceWorkerDatabaseTaskManager> database_task_manager( new MockServiceWorkerDatabaseTaskManager( base::ThreadTaskRunnerHandle::Get())); - context_.reset( - new ServiceWorkerContextCore(GetUserDataDirectory(), - database_task_manager.Pass(), - base::ThreadTaskRunnerHandle::Get(), - NULL, - NULL, - NULL, - NULL)); + context_.reset(new ServiceWorkerContextCore( + GetUserDataDirectory(), std::move(database_task_manager), + base::ThreadTaskRunnerHandle::Get(), NULL, NULL, NULL, NULL)); storage()->LazyInitialize(base::Bind(&base::DoNothing)); base::RunLoop().RunUntilIdle(); @@ -1581,7 +1572,7 @@ TEST_F(ServiceWorkerStorageDiskTest, OriginHasForeignFetchRegistrations) { new MockServiceWorkerDatabaseTaskManager( base::ThreadTaskRunnerHandle::Get())); context_.reset(new ServiceWorkerContextCore( - GetUserDataDirectory(), database_task_manager.Pass(), + GetUserDataDirectory(), std::move(database_task_manager), base::ThreadTaskRunnerHandle::Get(), nullptr, nullptr, nullptr, nullptr)); LazyInitialize(); diff --git a/content/browser/service_worker/service_worker_url_request_job.cc b/content/browser/service_worker/service_worker_url_request_job.cc index 919602b..10e8502 100644 --- a/content/browser/service_worker/service_worker_url_request_job.cc +++ b/content/browser/service_worker/service_worker_url_request_job.cc @@ -6,10 +6,10 @@ #include <stddef.h> #include <stdint.h> - #include <limits> #include <map> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -475,7 +475,7 @@ ServiceWorkerURLRequestJob::CreateFetchRequest() { request->referrer = Referrer(GURL(request_->referrer()), blink::WebReferrerPolicyDefault); } - return request.Pass(); + return request; } bool ServiceWorkerURLRequestJob::CreateRequestBodyBlob(std::string* blob_uuid, @@ -504,8 +504,8 @@ bool ServiceWorkerURLRequestJob::CreateRequestBodyBlob(std::string* blob_uuid, DCHECK_NE(storage::DataElement::TYPE_BLOB, item->type()); resolved_elements.push_back(item->data_element_ptr()); } - handles.push_back(handle.Pass()); - snapshots.push_back(snapshot.Pass()); + handles.push_back(std::move(handle)); + snapshots.push_back(std::move(snapshot)); } const std::string uuid(base::GenerateGUID()); @@ -684,7 +684,7 @@ void ServiceWorkerURLRequestJob::DidDispatchFetchEvent( return; } blob_request_ = storage::BlobProtocolHandler::CreateBlobRequest( - blob_data_handle.Pass(), request()->context(), this); + std::move(blob_data_handle), request()->context(), this); blob_request_->Start(); } diff --git a/content/browser/service_worker/service_worker_url_request_job_unittest.cc b/content/browser/service_worker/service_worker_url_request_job_unittest.cc index 74400a6..bb3936d 100644 --- a/content/browser/service_worker/service_worker_url_request_job_unittest.cc +++ b/content/browser/service_worker/service_worker_url_request_job_unittest.cc @@ -2,8 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. -#include <stdint.h> +#include "content/browser/service_worker/service_worker_url_request_job.h" +#include <stdint.h> +#include <utility> #include <vector> #include "base/callback.h" @@ -21,7 +23,6 @@ #include "content/browser/service_worker/service_worker_provider_host.h" #include "content/browser/service_worker/service_worker_registration.h" #include "content/browser/service_worker/service_worker_test_utils.h" -#include "content/browser/service_worker/service_worker_url_request_job.h" #include "content/browser/service_worker/service_worker_version.h" #include "content/browser/streams/stream.h" #include "content/browser/streams/stream_context.h" @@ -283,7 +284,7 @@ class ServiceWorkerURLRequestJobTest "blob", CreateMockBlobProtocolHandler(blob_storage_context)); url_request_context_.set_job_factory(url_request_job_factory_.get()); - helper_->context()->AddProviderHost(provider_host.Pass()); + helper_->context()->AddProviderHost(std::move(provider_host)); } void TearDown() override { diff --git a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc index f5fd757..43881d7 100644 --- a/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc +++ b/content/browser/service_worker/service_worker_write_to_cache_job_unittest.cc @@ -4,6 +4,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/location.h" #include "base/macros.h" @@ -280,7 +281,7 @@ class ServiceWorkerWriteToCacheJobTest : public testing::Test { process_id, MSG_ROUTING_NONE, provider_id, SERVICE_WORKER_PROVIDER_FOR_WORKER, context()->AsWeakPtr(), nullptr)); base::WeakPtr<ServiceWorkerProviderHost> provider_host = host->AsWeakPtr(); - context()->AddProviderHost(host.Pass()); + context()->AddProviderHost(std::move(host)); provider_host->running_hosted_version_ = version; } @@ -395,7 +396,7 @@ class ServiceWorkerWriteToCacheJobTest : public testing::Test { scoped_ptr<ServiceWorkerResponseReader> reader = context()->storage()->CreateResponseReader(id); scoped_refptr<ResponseVerifier> verifier = new ResponseVerifier( - reader.Pass(), expected, CreateReceiverOnCurrentThread(&is_equal)); + std::move(reader), expected, CreateReceiverOnCurrentThread(&is_equal)); verifier->Start(); base::RunLoop().RunUntilIdle(); EXPECT_TRUE(is_equal); diff --git a/content/browser/session_history_browsertest.cc b/content/browser/session_history_browsertest.cc index 8a04f7e..dca5546 100644 --- a/content/browser/session_history_browsertest.cc +++ b/content/browser/session_history_browsertest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/strings/string_util.h" #include "base/strings/stringprintf.h" #include "base/strings/utf_string_conversions.h" @@ -39,7 +41,7 @@ scoped_ptr<net::test_server::HttpResponse> HandleEchoTitleRequest( base::StringPrintf( "<html><head><title>%s</title></head></html>", request.content.c_str())); - return http_response.Pass(); + return std::move(http_response); } } // namespace diff --git a/content/browser/shared_worker/shared_worker_service_impl.cc b/content/browser/shared_worker/shared_worker_service_impl.cc index 400541a..46d15bc 100644 --- a/content/browser/shared_worker/shared_worker_service_impl.cc +++ b/content/browser/shared_worker/shared_worker_service_impl.cc @@ -5,10 +5,10 @@ #include "content/browser/shared_worker/shared_worker_service_impl.h" #include <stddef.h> - #include <algorithm> #include <iterator> #include <set> +#include <utility> #include <vector> #include "base/callback.h" @@ -130,7 +130,7 @@ class SharedWorkerServiceImpl::SharedWorkerPendingInstance { explicit SharedWorkerPendingInstance( scoped_ptr<SharedWorkerInstance> instance) - : instance_(instance.Pass()) {} + : instance_(std::move(instance)) {} ~SharedWorkerPendingInstance() {} SharedWorkerInstance* instance() { return instance_.get(); } SharedWorkerInstance* release_instance() { return instance_.release(); } @@ -311,13 +311,14 @@ void SharedWorkerServiceImpl::CreateWorker( *creation_error = blink::WebWorkerCreationErrorSecureContextMismatch; return; } - pending->AddRequest(request.Pass()); + pending->AddRequest(std::move(request)); return; } scoped_ptr<SharedWorkerPendingInstance> pending_instance( - new SharedWorkerPendingInstance(instance.Pass())); - pending_instance->AddRequest(request.Pass()); - ReserveRenderProcessToCreateWorker(pending_instance.Pass(), creation_error); + new SharedWorkerPendingInstance(std::move(instance))); + pending_instance->AddRequest(std::move(request)); + ReserveRenderProcessToCreateWorker(std::move(pending_instance), + creation_error); } void SharedWorkerServiceImpl::ForwardToWorker( @@ -530,7 +531,7 @@ void SharedWorkerServiceImpl::ReserveRenderProcessToCreateWorker( worker_route_id, is_new_worker), s_try_increment_worker_ref_count_)); - pending_instances_.set(pending_instance_id, pending_instance.Pass()); + pending_instances_.set(pending_instance_id, std::move(pending_instance)); } void SharedWorkerServiceImpl::RenderProcessReservedCallback( @@ -556,7 +557,7 @@ void SharedWorkerServiceImpl::RenderProcessReservedCallback( // Retry reserving a renderer process if the existed Shared Worker was // destroyed on IO thread while reserving the renderer process on UI // thread. - ReserveRenderProcessToCreateWorker(pending_instance.Pass(), NULL); + ReserveRenderProcessToCreateWorker(std::move(pending_instance), NULL); return; } pending_instance->RegisterToSharedWorkerHost(existing_host); @@ -569,7 +570,7 @@ void SharedWorkerServiceImpl::RenderProcessReservedCallback( pending_instance->RemoveRequest(worker_process_id); // Retry reserving a renderer process if the requested renderer process was // destroyed on IO thread while reserving the renderer process on UI thread. - ReserveRenderProcessToCreateWorker(pending_instance.Pass(), NULL); + ReserveRenderProcessToCreateWorker(std::move(pending_instance), NULL); return; } scoped_ptr<SharedWorkerHost> host(new SharedWorkerHost( @@ -579,7 +580,7 @@ void SharedWorkerServiceImpl::RenderProcessReservedCallback( const base::string16 name = host->instance()->name(); host->Start(pause_on_start); worker_hosts_.set(std::make_pair(worker_process_id, worker_route_id), - host.Pass()); + std::move(host)); FOR_EACH_OBSERVER( WorkerServiceObserver, observers_, @@ -599,7 +600,7 @@ void SharedWorkerServiceImpl::RenderProcessReserveFailedCallback( return; pending_instance->RemoveRequest(worker_process_id); // Retry reserving a renderer process. - ReserveRenderProcessToCreateWorker(pending_instance.Pass(), NULL); + ReserveRenderProcessToCreateWorker(std::move(pending_instance), NULL); } SharedWorkerHost* SharedWorkerServiceImpl::FindSharedWorkerHost( diff --git a/content/browser/shared_worker/shared_worker_service_impl_unittest.cc b/content/browser/shared_worker/shared_worker_service_impl_unittest.cc index f2f3015..1c7d409 100644 --- a/content/browser/shared_worker/shared_worker_service_impl_unittest.cc +++ b/content/browser/shared_worker/shared_worker_service_impl_unittest.cc @@ -210,7 +210,7 @@ class MockRendererProcessHost { CHECK(queued_messages_.size()); scoped_ptr<IPC::Message> msg(*queued_messages_.begin()); queued_messages_.weak_erase(queued_messages_.begin()); - return msg.Pass(); + return msg; } void FastShutdownIfPossible() { diff --git a/content/browser/speech/chunked_byte_buffer.cc b/content/browser/speech/chunked_byte_buffer.cc index 7ae9f46..7a05589 100644 --- a/content/browser/speech/chunked_byte_buffer.cc +++ b/content/browser/speech/chunked_byte_buffer.cc @@ -5,6 +5,7 @@ #include "content/browser/speech/chunked_byte_buffer.h" #include <algorithm> +#include <utility> #include "base/lazy_instance.h" #include "base/logging.h" @@ -111,7 +112,7 @@ scoped_ptr<std::vector<uint8_t>> ChunkedByteBuffer::PopChunk() { DCHECK_EQ(chunk->content->size(), chunk->ExpectedContentLength()); total_bytes_stored_ -= chunk->content->size(); total_bytes_stored_ -= kHeaderLength; - return chunk->content.Pass(); + return std::move(chunk->content); } void ChunkedByteBuffer::Clear() { diff --git a/content/browser/speech/speech_recognition_manager_impl.cc b/content/browser/speech/speech_recognition_manager_impl.cc index c535e53..06311bb 100644 --- a/content/browser/speech/speech_recognition_manager_impl.cc +++ b/content/browser/speech/speech_recognition_manager_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/speech/speech_recognition_manager_impl.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/single_thread_task_runner.h" @@ -240,7 +242,7 @@ void SpeechRecognitionManagerImpl::MediaRequestPermissionCallback( iter->second->context.devices = devices; // Save the UI object. - iter->second->ui = stream_ui.Pass(); + iter->second->ui = std::move(stream_ui); } // Clear the label to indicate the request has been done. diff --git a/content/browser/ssl/ssl_client_auth_handler.cc b/content/browser/ssl/ssl_client_auth_handler.cc index 7bfb8b5..3c1e42c 100644 --- a/content/browser/ssl/ssl_client_auth_handler.cc +++ b/content/browser/ssl/ssl_client_auth_handler.cc @@ -4,6 +4,8 @@ #include "content/browser/ssl/ssl_client_auth_handler.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -70,7 +72,7 @@ void SelectCertificateOnUIThread( return; GetContentClient()->browser()->SelectClientCertificate( - web_contents, cert_request_info, delegate.Pass()); + web_contents, cert_request_info, std::move(delegate)); } } // namespace @@ -83,7 +85,7 @@ class SSLClientAuthHandler::Core : public base::RefCountedThreadSafe<Core> { scoped_ptr<net::ClientCertStore> client_cert_store, net::SSLCertRequestInfo* cert_request_info) : handler_(handler), - client_cert_store_(client_cert_store.Pass()), + client_cert_store_(std::move(client_cert_store)), cert_request_info_(cert_request_info) {} bool has_client_cert_store() const { return client_cert_store_; } @@ -129,7 +131,7 @@ SSLClientAuthHandler::SSLClientAuthHandler( weak_factory_(this) { DCHECK_CURRENTLY_ON(BrowserThread::IO); - core_ = new Core(weak_factory_.GetWeakPtr(), client_cert_store.Pass(), + core_ = new Core(weak_factory_.GetWeakPtr(), std::move(client_cert_store), cert_request_info_.get()); } diff --git a/content/browser/storage_partition_impl_map.cc b/content/browser/storage_partition_impl_map.cc index 828a1ed..05f771c 100644 --- a/content/browser/storage_partition_impl_map.cc +++ b/content/browser/storage_partition_impl_map.cc @@ -4,6 +4,8 @@ #include "content/browser/storage_partition_impl_map.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/command_line.h" @@ -463,17 +465,13 @@ StoragePartitionImpl* StoragePartitionImplMap::Get( if (partition_domain.empty()) { partition->SetURLRequestContext( GetContentClient()->browser()->CreateRequestContext( - browser_context_, - &protocol_handlers, - request_interceptors.Pass())); + browser_context_, &protocol_handlers, + std::move(request_interceptors))); } else { partition->SetURLRequestContext( GetContentClient()->browser()->CreateRequestContextForStoragePartition( - browser_context_, - partition->GetPath(), - in_memory, - &protocol_handlers, - request_interceptors.Pass())); + browser_context_, partition->GetPath(), in_memory, + &protocol_handlers, std::move(request_interceptors))); } partition->SetMediaURLRequestContext( partition_domain.empty() ? diff --git a/content/browser/storage_partition_impl_map_unittest.cc b/content/browser/storage_partition_impl_map_unittest.cc index b28902f..2659b8e 100644 --- a/content/browser/storage_partition_impl_map_unittest.cc +++ b/content/browser/storage_partition_impl_map_unittest.cc @@ -4,6 +4,8 @@ #include "content/browser/storage_partition_impl_map.h" +#include <utility> + #include "base/files/file_util.h" #include "base/run_loop.h" #include "content/public/browser/browser_thread.h" @@ -82,8 +84,8 @@ TEST(StoragePartitionImplMapTest, GarbageCollect) { ASSERT_TRUE(base::CreateDirectory(inactive_path)); base::RunLoop run_loop; - storage_partition_impl_map.GarbageCollect( - active_paths.Pass(), run_loop.QuitClosure()); + storage_partition_impl_map.GarbageCollect(std::move(active_paths), + run_loop.QuitClosure()); run_loop.Run(); BrowserThread::GetBlockingPool()->FlushForTesting(); diff --git a/content/browser/streams/stream.cc b/content/browser/streams/stream.cc index 3f4ae680..d3a3ec4 100644 --- a/content/browser/streams/stream.cc +++ b/content/browser/streams/stream.cc @@ -168,7 +168,7 @@ Stream::StreamState Stream::ReadRawData(net::IOBuffer* buf, scoped_ptr<StreamHandle> Stream::CreateHandle() { CHECK(!stream_handle_); stream_handle_ = new StreamHandleImpl(weak_ptr_factory_.GetWeakPtr()); - return scoped_ptr<StreamHandle>(stream_handle_).Pass(); + return scoped_ptr<StreamHandle>(stream_handle_); } void Stream::CloseHandle() { diff --git a/content/browser/tracing/background_tracing_config_impl.cc b/content/browser/tracing/background_tracing_config_impl.cc index 57daf1b..32eebe5 100644 --- a/content/browser/tracing/background_tracing_config_impl.cc +++ b/content/browser/tracing/background_tracing_config_impl.cc @@ -2,9 +2,12 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/browser/tracing/background_tracing_config_impl.h" + +#include <utility> + #include "base/macros.h" #include "base/values.h" -#include "content/browser/tracing/background_tracing_config_impl.h" #include "content/browser/tracing/background_tracing_rule.h" namespace content { @@ -111,10 +114,10 @@ void BackgroundTracingConfigImpl::IntoDict(base::DictionaryValue* dict) const { scoped_ptr<base::DictionaryValue> config_dict(new base::DictionaryValue()); DCHECK(it); it->IntoDict(config_dict.get()); - configs_list->Append(config_dict.Pass()); + configs_list->Append(std::move(config_dict)); } - dict->Set(kConfigsKey, configs_list.Pass()); + dict->Set(kConfigsKey, std::move(configs_list)); if (!scenario_name_.empty()) dict->SetString(kConfigScenarioName, scenario_name_); @@ -129,7 +132,7 @@ void BackgroundTracingConfigImpl::AddPreemptiveRule( scoped_ptr<BackgroundTracingRule> rule = BackgroundTracingRule::PreemptiveRuleFromDict(dict); if (rule) - rules_.push_back(rule.Pass()); + rules_.push_back(std::move(rule)); } void BackgroundTracingConfigImpl::AddReactiveRule( @@ -138,7 +141,7 @@ void BackgroundTracingConfigImpl::AddReactiveRule( scoped_ptr<BackgroundTracingRule> rule = BackgroundTracingRule::ReactiveRuleFromDict(dict, category_preset); if (rule) - rules_.push_back(rule.Pass()); + rules_.push_back(std::move(rule)); } scoped_ptr<BackgroundTracingConfigImpl> BackgroundTracingConfigImpl::FromDict( @@ -167,7 +170,7 @@ scoped_ptr<BackgroundTracingConfigImpl> BackgroundTracingConfigImpl::FromDict( &config->disable_blink_features_); } - return config.Pass(); + return config; } scoped_ptr<BackgroundTracingConfigImpl> @@ -201,7 +204,7 @@ BackgroundTracingConfigImpl::PreemptiveFromDict( if (config->rules().empty()) return nullptr; - return config.Pass(); + return config; } scoped_ptr<BackgroundTracingConfigImpl> @@ -235,7 +238,7 @@ BackgroundTracingConfigImpl::ReactiveFromDict( if (config->rules().empty()) return nullptr; - return config.Pass(); + return config; } } // namspace content diff --git a/content/browser/tracing/background_tracing_manager_browsertest.cc b/content/browser/tracing/background_tracing_manager_browsertest.cc index b387b62..e0001b8 100644 --- a/content/browser/tracing/background_tracing_manager_browsertest.cc +++ b/content/browser/tracing/background_tracing_manager_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -107,15 +108,15 @@ scoped_ptr<BackgroundTracingConfig> CreatePreemptiveConfig() { scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "preemptive_test"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); EXPECT_TRUE(config); - return config.Pass(); + return config; } scoped_ptr<BackgroundTracingConfig> CreateReactiveConfig() { @@ -129,15 +130,15 @@ scoped_ptr<BackgroundTracingConfig> CreateReactiveConfig() { rules_dict->SetString("rule", "TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL"); rules_dict->SetString("trigger_name", "reactive_test"); rules_dict->SetString("category", "BENCHMARK"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); EXPECT_TRUE(config); - return config.Pass(); + return config; } void SetupBackgroundTracingManager() { @@ -168,7 +169,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, GetInstance()->RegisterTriggerType("preemptive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -200,7 +201,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "preemptive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -255,7 +256,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, BackgroundTracingManager::GetInstance()->SetTracingEnabledCallbackForTesting( wait_for_activated.QuitClosure()); EXPECT_TRUE(BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::ANONYMIZE_DATA)); wait_for_activated.Run(); @@ -299,7 +300,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, BackgroundTracingManager::GetInstance()->SetTracingEnabledCallbackForTesting( wait_for_activated.QuitClosure()); EXPECT_TRUE(BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::ANONYMIZE_DATA)); wait_for_activated.Run(); @@ -343,7 +344,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, BackgroundTracingManager::GetInstance()->SetTracingEnabledCallbackForTesting( wait_for_activated.QuitClosure()); EXPECT_TRUE(BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::ANONYMIZE_DATA)); wait_for_activated.Run(); @@ -383,16 +384,16 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "test1"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } { scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "test2"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); @@ -404,7 +405,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, BackgroundTracingManager::GetInstance()->RegisterTriggerType("test2"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -442,10 +443,10 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "test2"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); dict.SetString("enable_blink_features", "FasterWeb1,FasterWeb2"); dict.SetString("disable_blink_features", "SlowerWeb1,SlowerWeb2"); scoped_ptr<BackgroundTracingConfig> config( @@ -454,7 +455,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, bool scenario_activated = BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); EXPECT_TRUE(scenario_activated); @@ -489,10 +490,10 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "test2"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); dict.SetString("enable_blink_features", "FasterWeb1,FasterWeb2"); dict.SetString("disable_blink_features", "SlowerWeb1,SlowerWeb2"); scoped_ptr<BackgroundTracingConfig> config( @@ -504,7 +505,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, bool scenario_activated = BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); EXPECT_FALSE(scenario_activated); @@ -533,17 +534,17 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, rules_dict->SetString("histogram_name", "fake"); rules_dict->SetInteger("histogram_value", 1); rules_dict->SetInteger("trigger_delay", 10); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); EXPECT_TRUE(config); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -619,7 +620,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "does_not_exist"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -655,7 +656,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, ->InvalidateTriggerHandlesForTesting(); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -692,9 +693,9 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, rules_dict->SetString("rule", "MONITOR_AND_DUMP_WHEN_TRIGGER_NAMED"); rules_dict->SetString("trigger_name", "preemptive_test"); rules_dict->SetDouble("trigger_chance", 0.0); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); @@ -706,7 +707,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "preemptive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -745,9 +746,9 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, rules_dict->SetString("category", "BENCHMARK"); rules_dict->SetDouble("trigger_chance", 0.0); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); @@ -759,7 +760,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "preemptive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -797,17 +798,17 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "rule", "MONITOR_AND_DUMP_WHEN_SPECIFIC_HISTOGRAM_AND_VALUE"); rules_dict->SetString("histogram_name", "fake"); rules_dict->SetInteger("histogram_value", 1); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); EXPECT_TRUE(config); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); // Our reference value is "1", so a value of "2" should trigger a trace. @@ -841,17 +842,17 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "rule", "MONITOR_AND_DUMP_WHEN_SPECIFIC_HISTOGRAM_AND_VALUE"); rules_dict->SetString("histogram_name", "fake"); rules_dict->SetInteger("histogram_value", 1); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); EXPECT_TRUE(config); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); // This should fail to trigger a trace since the sample value < the @@ -887,17 +888,17 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, rules_dict->SetString("histogram_name", "fake"); rules_dict->SetInteger("histogram_lower_value", 1); rules_dict->SetInteger("histogram_upper_value", 3); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); EXPECT_TRUE(config); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); // This should fail to trigger a trace since the sample value > the @@ -927,10 +928,10 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, { scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); rules_dict->SetString("rule", "INVALID_RULE"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); @@ -956,7 +957,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, GetInstance()->RegisterTriggerType("reactive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -990,7 +991,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, GetInstance()->RegisterTriggerType("reactive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -1028,7 +1029,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL"); rules_dict->SetString("trigger_name", "reactive_test1"); rules_dict->SetString("category", "BENCHMARK"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } { scoped_ptr<base::DictionaryValue> rules_dict(new base::DictionaryValue()); @@ -1036,9 +1037,9 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "TRACE_ON_NAVIGATION_UNTIL_TRIGGER_OR_FULL"); rules_dict->SetString("trigger_name", "reactive_test2"); rules_dict->SetString("category", "BENCHMARK"); - rules_list->Append(rules_dict.Pass()); + rules_list->Append(std::move(rules_dict)); } - dict.Set("configs", rules_list.Pass()); + dict.Set("configs", std::move(rules_list)); scoped_ptr<BackgroundTracingConfig> config( BackgroundTracingConfigImpl::FromDict(&dict)); @@ -1051,7 +1052,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, "reactive_test2"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( @@ -1092,7 +1093,7 @@ IN_PROC_BROWSER_TEST_F(BackgroundTracingManagerBrowserTest, GetInstance()->RegisterTriggerType("reactive_test"); BackgroundTracingManager::GetInstance()->SetActiveScenario( - config.Pass(), upload_config_wrapper.get_receive_callback(), + std::move(config), upload_config_wrapper.get_receive_callback(), BackgroundTracingManager::NO_DATA_FILTERING); BackgroundTracingManager::GetInstance()->WhenIdle( diff --git a/content/browser/tracing/background_tracing_manager_impl.cc b/content/browser/tracing/background_tracing_manager_impl.cc index 3a80992..250d0fa 100644 --- a/content/browser/tracing/background_tracing_manager_impl.cc +++ b/content/browser/tracing/background_tracing_manager_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/tracing/background_tracing_manager_impl.h" +#include <utility> + #include "base/command_line.h" #include "base/json/json_writer.h" #include "base/macros.h" @@ -159,7 +161,7 @@ bool BackgroundTracingManagerImpl::SetActiveScenario( } } - config_ = config_impl.Pass(); + config_ = std::move(config_impl); receive_callback_ = receive_callback; requires_anonymized_data_ = requires_anonymized_data; @@ -408,7 +410,7 @@ void BackgroundTracingManagerImpl::OnFinalizeStarted( if (!receive_callback_.is_null()) { receive_callback_.Run( - file_contents, metadata.Pass(), + file_contents, std::move(metadata), base::Bind(&BackgroundTracingManagerImpl::OnFinalizeComplete, base::Unretained(this))); } @@ -452,7 +454,7 @@ void BackgroundTracingManagerImpl::AddCustomMetadata( scoped_ptr<base::DictionaryValue> config_dict(new base::DictionaryValue()); config_->IntoDict(config_dict.get()); - metadata_dict.Set("config", config_dict.Pass()); + metadata_dict.Set("config", std::move(config_dict)); trace_data_sink->AddMetadata(metadata_dict); } diff --git a/content/browser/tracing/tracing_controller_browsertest.cc b/content/browser/tracing/tracing_controller_browsertest.cc index 3bc7a96..d4b8671 100644 --- a/content/browser/tracing/tracing_controller_browsertest.cc +++ b/content/browser/tracing/tracing_controller_browsertest.cc @@ -2,7 +2,10 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "content/public/browser/tracing_controller.h" + #include <stdint.h> +#include <utility> #include "base/files/file_util.h" #include "base/memory/ref_counted_memory.h" @@ -10,7 +13,6 @@ #include "base/strings/pattern.h" #include "build/build_config.h" #include "content/public/browser/browser_thread.h" -#include "content/public/browser/tracing_controller.h" #include "content/public/test/browser_test_utils.h" #include "content/public/test/content_browser_test.h" #include "content/public/test/content_browser_test_utils.h" @@ -77,7 +79,8 @@ class TracingControllerTestEndpoint BrowserThread::PostTask( BrowserThread::UI, FROM_HERE, - base::Bind(done_callback_, base::Passed(metadata.Pass()), chunk_ptr)); + base::Bind(done_callback_, base::Passed(std::move(metadata)), + chunk_ptr)); } protected: diff --git a/content/browser/tracing/tracing_controller_impl.cc b/content/browser/tracing/tracing_controller_impl.cc index d8db0d6..684bea8 100644 --- a/content/browser/tracing/tracing_controller_impl.cc +++ b/content/browser/tracing/tracing_controller_impl.cc @@ -134,7 +134,7 @@ scoped_ptr<base::DictionaryValue> GenerateTracingMetadataDict() { metadata_dict->SetBoolean("highres-ticks", base::TimeTicks::IsHighResolution()); - return metadata_dict.Pass(); + return metadata_dict; } } // namespace diff --git a/content/browser/tracing/tracing_controller_impl_data_sinks.cc b/content/browser/tracing/tracing_controller_impl_data_sinks.cc index de7dc94..025619f2 100644 --- a/content/browser/tracing/tracing_controller_impl_data_sinks.cc +++ b/content/browser/tracing/tracing_controller_impl_data_sinks.cc @@ -1,13 +1,14 @@ // Copyright 2015 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 "content/browser/tracing/tracing_controller_impl.h" +#include <utility> #include "base/bind.h" #include "base/files/file_util.h" #include "base/json/json_writer.h" #include "base/macros.h" #include "base/strings/pattern.h" +#include "content/browser/tracing/tracing_controller_impl.h" #include "content/public/browser/browser_thread.h" #include "third_party/zlib/zlib.h" @@ -35,7 +36,7 @@ class StringTraceDataEndpoint : public TracingController::TraceDataEndpoint { BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, base::Bind(completion_callback_, - base::Passed(metadata.Pass()), str)); + base::Passed(std::move(metadata)), str)); } private: @@ -325,7 +326,7 @@ void TracingController::TraceDataSink::SetMetadataFilterPredicate( scoped_ptr<const base::DictionaryValue> TracingController::TraceDataSink::GetMetadataCopy() const { if (metadata_filter_predicate_.is_null()) - return scoped_ptr<const base::DictionaryValue>(metadata_.DeepCopy()).Pass(); + return scoped_ptr<const base::DictionaryValue>(metadata_.DeepCopy()); scoped_ptr<base::DictionaryValue> metadata_copy(new base::DictionaryValue); for (base::DictionaryValue::Iterator it(metadata_); !it.IsAtEnd(); @@ -335,7 +336,7 @@ scoped_ptr<const base::DictionaryValue> else metadata_copy->SetString(it.key(), "__stripped__"); } - return metadata_copy.Pass(); + return std::move(metadata_copy); } scoped_refptr<TracingController::TraceDataSink> diff --git a/content/browser/vibration_manager_integration_browsertest.cc b/content/browser/vibration_manager_integration_browsertest.cc index 5623761..0a79119 100644 --- a/content/browser/vibration_manager_integration_browsertest.cc +++ b/content/browser/vibration_manager_integration_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/macros.h" #include "build/build_config.h" @@ -44,12 +45,12 @@ void ResetGlobalValues() { class FakeVibrationManager : public device::VibrationManager { public: static void Create(mojo::InterfaceRequest<VibrationManager> request) { - new FakeVibrationManager(request.Pass()); + new FakeVibrationManager(std::move(request)); } private: FakeVibrationManager(mojo::InterfaceRequest<VibrationManager> request) - : binding_(this, request.Pass()) {} + : binding_(this, std::move(request)) {} ~FakeVibrationManager() override {} void Vibrate(int64_t milliseconds) override { diff --git a/content/browser/wake_lock/wake_lock_service_context.cc b/content/browser/wake_lock/wake_lock_service_context.cc index 48dcb3c..43f0704 100644 --- a/content/browser/wake_lock/wake_lock_service_context.cc +++ b/content/browser/wake_lock/wake_lock_service_context.cc @@ -4,6 +4,8 @@ #include "content/browser/wake_lock/wake_lock_service_context.h" +#include <utility> + #include "base/bind.h" #include "build/build_config.h" #include "content/browser/power_save_blocker_impl.h" @@ -25,7 +27,7 @@ void WakeLockServiceContext::CreateService( int render_frame_id, mojo::InterfaceRequest<WakeLockService> request) { new WakeLockServiceImpl(weak_factory_.GetWeakPtr(), render_process_id, - render_frame_id, request.Pass()); + render_frame_id, std::move(request)); } void WakeLockServiceContext::RenderFrameDeleted( diff --git a/content/browser/wake_lock/wake_lock_service_impl.cc b/content/browser/wake_lock/wake_lock_service_impl.cc index 913a137..036cb1d 100644 --- a/content/browser/wake_lock/wake_lock_service_impl.cc +++ b/content/browser/wake_lock/wake_lock_service_impl.cc @@ -4,6 +4,8 @@ #include "content/browser/wake_lock/wake_lock_service_impl.h" +#include <utility> + #include "content/browser/wake_lock/wake_lock_service_context.h" namespace content { @@ -16,7 +18,7 @@ WakeLockServiceImpl::WakeLockServiceImpl( : context_(context), render_process_id_(render_process_id), render_frame_id_(render_frame_id), - binding_(this, request.Pass()) {} + binding_(this, std::move(request)) {} WakeLockServiceImpl::~WakeLockServiceImpl() {} diff --git a/content/browser/web_contents/aura/gesture_nav_simple.cc b/content/browser/web_contents/aura/gesture_nav_simple.cc index 58a030c..debe711 100644 --- a/content/browser/web_contents/aura/gesture_nav_simple.cc +++ b/content/browser/web_contents/aura/gesture_nav_simple.cc @@ -4,6 +4,8 @@ #include "content/browser/web_contents/aura/gesture_nav_simple.h" +#include <utility> + #include "base/macros.h" #include "cc/layers/layer.h" #include "content/browser/frame_host/navigation_controller_impl.h" @@ -50,7 +52,7 @@ template <class T> class DeleteAfterAnimation : public ui::ImplicitAnimationObserver { public: explicit DeleteAfterAnimation(scoped_ptr<T> object) - : object_(object.Pass()) {} + : object_(std::move(object)) {} private: friend class base::DeleteHelper<DeleteAfterAnimation<T> >; @@ -129,9 +131,10 @@ void GestureNavSimple::ApplyEffectsAndDestroy(const gfx::Transform& transform, ui::Layer* layer = arrow_.get(); ui::ScopedLayerAnimationSettings settings(arrow_->GetAnimator()); settings.AddObserver( - new DeleteAfterAnimation<ArrowLayerDelegate>(arrow_delegate_.Pass())); - settings.AddObserver(new DeleteAfterAnimation<ui::Layer>(arrow_.Pass())); - settings.AddObserver(new DeleteAfterAnimation<ui::Layer>(clip_layer_.Pass())); + new DeleteAfterAnimation<ArrowLayerDelegate>(std::move(arrow_delegate_))); + settings.AddObserver(new DeleteAfterAnimation<ui::Layer>(std::move(arrow_))); + settings.AddObserver( + new DeleteAfterAnimation<ui::Layer>(std::move(clip_layer_))); layer->SetTransform(transform); layer->SetOpacity(opacity); } diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc index ef3ee2f..b05feed 100644 --- a/content/browser/web_contents/aura/overscroll_navigation_overlay.cc +++ b/content/browser/web_contents/aura/overscroll_navigation_overlay.cc @@ -4,6 +4,7 @@ #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" +#include <utility> #include <vector> #include "base/i18n/rtl.h" @@ -53,7 +54,7 @@ class OverlayDismissAnimator public: // Takes ownership of the layer. explicit OverlayDismissAnimator(scoped_ptr<ui::Layer> layer) - : layer_(layer.Pass()) { + : layer_(std::move(layer)) { CHECK(layer_.get()); } @@ -134,7 +135,7 @@ void OverscrollNavigationOverlay::StopObservingIfDone() { // animation completes. scoped_ptr<ui::Layer> dismiss_layer = window_->AcquireLayer(); window_.reset(); - (new OverlayDismissAnimator(dismiss_layer.Pass()))->Animate(); + (new OverlayDismissAnimator(std::move(dismiss_layer)))->Animate(); Observe(nullptr); received_paint_update_ = false; loading_complete_ = false; @@ -164,7 +165,7 @@ scoped_ptr<aura::Window> OverscrollNavigationOverlay::CreateOverlayWindow( // off its bounds. event_window->SetCapture(); window->Show(); - return window.Pass(); + return window; } const gfx::Image OverscrollNavigationOverlay::GetImageForDirection( @@ -247,7 +248,7 @@ void OverscrollNavigationOverlay::OnOverscrollCompleted( } main_window->SetTransform(gfx::Transform()); - window_ = window.Pass(); + window_ = std::move(window); // Make sure the window is in its default position. window_->SetBounds(gfx::Rect(web_contents_window_->bounds().size())); window_->SetTransform(gfx::Transform()); diff --git a/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc b/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc index 4c8eea2..97dd750 100644 --- a/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc +++ b/content/browser/web_contents/aura/overscroll_navigation_overlay_unittest.cc @@ -5,7 +5,7 @@ #include "content/browser/web_contents/aura/overscroll_navigation_overlay.h" #include <string.h> - +#include <utility> #include <vector> #include "base/macros.h" @@ -42,7 +42,8 @@ class OverscrollTestWebContents : public TestWebContents { scoped_ptr<aura::Window> fake_native_view, scoped_ptr<aura::Window> fake_contents_window) { OverscrollTestWebContents* web_contents = new OverscrollTestWebContents( - browser_context, fake_native_view.Pass(), fake_contents_window.Pass()); + browser_context, std::move(fake_native_view), + std::move(fake_contents_window)); web_contents->Init(WebContents::CreateParams(browser_context, instance)); return web_contents; } @@ -67,8 +68,8 @@ class OverscrollTestWebContents : public TestWebContents { scoped_ptr<aura::Window> fake_native_view, scoped_ptr<aura::Window> fake_contents_window) : TestWebContents(browser_context), - fake_native_view_(fake_native_view.Pass()), - fake_contents_window_(fake_contents_window.Pass()), + fake_native_view_(std::move(fake_native_view)), + fake_contents_window_(std::move(fake_contents_window)), is_being_destroyed_(false) {} private: @@ -120,7 +121,7 @@ class OverscrollNavigationOverlayTest : public RenderViewHostImplTestHarness { else EXPECT_EQ(GetOverlay()->direction_, OverscrollNavigationOverlay::NONE); window->SetBounds(gfx::Rect(root_window()->bounds().size())); - GetOverlay()->OnOverscrollCompleted(window.Pass()); + GetOverlay()->OnOverscrollCompleted(std::move(window)); if (IsBrowserSideNavigationEnabled()) main_test_rfh()->PrepareForCommit(); else @@ -166,10 +167,8 @@ class OverscrollNavigationOverlayTest : public RenderViewHostImplTestHarness { // Replace the default test web contents with our custom class. SetContents(OverscrollTestWebContents::Create( - browser_context(), - SiteInstance::Create(browser_context()), - fake_native_view.Pass(), - fake_contents_window.Pass())); + browser_context(), SiteInstance::Create(browser_context()), + std::move(fake_native_view), std::move(fake_contents_window))); contents()->NavigateAndCommit(first()); EXPECT_TRUE(controller().GetVisibleEntry()); diff --git a/content/browser/web_contents/aura/overscroll_window_animation.cc b/content/browser/web_contents/aura/overscroll_window_animation.cc index c89faa0..8ed3bf0 100644 --- a/content/browser/web_contents/aura/overscroll_window_animation.cc +++ b/content/browser/web_contents/aura/overscroll_window_animation.cc @@ -5,6 +5,7 @@ #include "content/browser/web_contents/aura/overscroll_window_animation.h" #include <algorithm> +#include <utility> #include "base/i18n/rtl.h" #include "content/browser/web_contents/aura/shadow_layer_delegate.h" @@ -78,7 +79,7 @@ void OverscrollWindowAnimation::OnImplicitAnimationsCompleted() { delegate_->OnOverscrollCancelled(); overscroll_cancelled_ = false; } else { - delegate_->OnOverscrollCompleted(slide_window_.Pass()); + delegate_->OnOverscrollCompleted(std::move(slide_window_)); } direction_ = SLIDE_NONE; } diff --git a/content/browser/web_contents/aura/overscroll_window_animation_unittest.cc b/content/browser/web_contents/aura/overscroll_window_animation_unittest.cc index 5f09797..a34c41b 100644 --- a/content/browser/web_contents/aura/overscroll_window_animation_unittest.cc +++ b/content/browser/web_contents/aura/overscroll_window_animation_unittest.cc @@ -94,7 +94,7 @@ class OverscrollWindowAnimationTest scoped_ptr<aura::Window> window( CreateNormalWindow(++last_window_id_, root_window(), nullptr)); window->SetBounds(bounds); - return window.Pass(); + return window; } return nullptr; } diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc index eadd9c1..9b709d85d 100644 --- a/content/browser/web_contents/web_contents_impl.cc +++ b/content/browser/web_contents/web_contents_impl.cc @@ -1389,7 +1389,7 @@ void WebContentsImpl::Init(const WebContents::CreateParams& params) { if (browser_plugin_guest_ && !BrowserPluginGuestMode::UseCrossProcessFramesForGuests()) { view_.reset(new WebContentsViewGuest(this, browser_plugin_guest_.get(), - view_.Pass(), + std::move(view_), &render_view_host_delegate_view_)); } CHECK(render_view_host_delegate_view_); @@ -2592,7 +2592,7 @@ void WebContentsImpl::SaveFrameWithHeaders(const GURL& url, params->add_request_header(pair[0], pair[1]); } } - dlm->DownloadUrl(params.Pass()); + dlm->DownloadUrl(std::move(params)); } void WebContentsImpl::GenerateMHTML( @@ -2808,7 +2808,7 @@ int WebContentsImpl::DownloadImage( req->bypass_cache = bypass_cache; mojo_image_downloader->DownloadImage( - req.Pass(), + std::move(req), base::Bind(&DidDownloadImage, callback, download_id, url)); return download_id; } diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc index eab029b..941aabe 100644 --- a/content/browser/web_contents/web_contents_impl_unittest.cc +++ b/content/browser/web_contents/web_contents_impl_unittest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stdint.h> +#include <utility> #include "base/command_line.h" #include "base/logging.h" @@ -851,7 +852,7 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredSitelessUrl) { native_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, std::string(), browser_context()); new_entry->SetPageID(0); - entries.push_back(new_entry.Pass()); + entries.push_back(std::move(new_entry)); controller().Restore( 0, NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, @@ -901,7 +902,7 @@ TEST_F(WebContentsImplTest, NavigateFromRestoredRegularUrl) { regular_url, Referrer(), ui::PAGE_TRANSITION_LINK, false, std::string(), browser_context()); new_entry->SetPageID(0); - entries.push_back(new_entry.Pass()); + entries.push_back(std::move(new_entry)); controller().Restore( 0, NavigationController::RESTORE_LAST_SESSION_EXITED_CLEANLY, diff --git a/content/browser/web_contents/web_contents_view_guest.cc b/content/browser/web_contents/web_contents_view_guest.cc index 6e34125..5f6b518 100644 --- a/content/browser/web_contents/web_contents_view_guest.cc +++ b/content/browser/web_contents/web_contents_view_guest.cc @@ -4,6 +4,8 @@ #include "content/browser/web_contents/web_contents_view_guest.h" +#include <utility> + #include "build/build_config.h" #include "content/browser/browser_plugin/browser_plugin_embedder.h" #include "content/browser/browser_plugin/browser_plugin_guest.h" @@ -38,7 +40,7 @@ WebContentsViewGuest::WebContentsViewGuest( RenderViewHostDelegateView** delegate_view) : web_contents_(web_contents), guest_(guest), - platform_view_(platform_view.Pass()), + platform_view_(std::move(platform_view)), platform_view_delegate_view_(*delegate_view) { *delegate_view = this; } diff --git a/content/browser/webui/url_data_manager_backend_unittest.cc b/content/browser/webui/url_data_manager_backend_unittest.cc index 41b9239..9006c6e 100644 --- a/content/browser/webui/url_data_manager_backend_unittest.cc +++ b/content/browser/webui/url_data_manager_backend_unittest.cc @@ -55,7 +55,7 @@ class UrlDataManagerBackendTest : public testing::Test { GURL("chrome://resources/polymer/v1_0/polymer/polymer-extracted.js"), net::HIGHEST, delegate); request->SetExtraRequestHeaderByName("Origin", origin, true); - return request.Pass(); + return request; } protected: diff --git a/content/browser/webui/web_ui_mojo_browsertest.cc b/content/browser/webui/web_ui_mojo_browsertest.cc index 9785997..805f1bb 100644 --- a/content/browser/webui/web_ui_mojo_browsertest.cc +++ b/content/browser/webui/web_ui_mojo_browsertest.cc @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <limits> +#include <utility> #include "base/command_line.h" #include "base/files/file_path.h" @@ -81,7 +82,7 @@ class BrowserTargetImpl : public BrowserTarget { public: BrowserTargetImpl(base::RunLoop* run_loop, mojo::InterfaceRequest<BrowserTarget> request) - : run_loop_(run_loop), binding_(this, request.Pass()) {} + : run_loop_(run_loop), binding_(this, std::move(request)) {} ~BrowserTargetImpl() override {} @@ -140,7 +141,7 @@ class PingTestWebUIController : public TestWebUIController { } void CreateHandler(mojo::InterfaceRequest<BrowserTarget> request) { - browser_target_.reset(new BrowserTargetImpl(run_loop_, request.Pass())); + browser_target_.reset(new BrowserTargetImpl(run_loop_, std::move(request))); } private: |