diff options
96 files changed, 466 insertions, 358 deletions
diff --git a/content/app/content_main_runner.cc b/content/app/content_main_runner.cc index 2085018..a686b02 100644 --- a/content/app/content_main_runner.cc +++ b/content/app/content_main_runner.cc @@ -7,8 +7,8 @@ #include <stddef.h> #include <stdlib.h> #include <string.h> - #include <string> +#include <utility> #include "base/allocator/allocator_extension.h" #include "base/at_exit.h" @@ -286,7 +286,7 @@ int RunZygote(const MainFunctionParams& main_function_params, } // This function call can return multiple times, once per fork(). - if (!ZygoteMain(main_function_params, zygote_fork_delegates.Pass())) + if (!ZygoteMain(main_function_params, std::move(zygote_fork_delegates))) return 1; if (delegate) delegate->ZygoteForked(); diff --git a/content/child/background_sync/background_sync_provider.cc b/content/child/background_sync/background_sync_provider.cc index a0a0e6b..d29a40f 100644 --- a/content/child/background_sync/background_sync_provider.cc +++ b/content/child/background_sync/background_sync_provider.cc @@ -5,6 +5,7 @@ #include "content/child/background_sync/background_sync_provider.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -37,7 +38,7 @@ void ConnectToServiceOnMainThread( mojo::InterfaceRequest<BackgroundSyncService> request) { DCHECK(ChildThreadImpl::current()); ChildThreadImpl::current()->service_registry()->ConnectToRemoteService( - request.Pass()); + std::move(request)); } LazyInstance<ThreadLocalPointer<BackgroundSyncProvider>>::Leaky @@ -102,7 +103,8 @@ void BackgroundSyncProvider::registerBackgroundSync( mojo::ConvertTo<SyncRegistrationPtr>(*(optionsPtr.get())), service_worker_registration_id, requested_from_service_worker, base::Bind(&BackgroundSyncProvider::RegisterCallback, - base::Unretained(this), base::Passed(callbacksPtr.Pass()))); + base::Unretained(this), + base::Passed(std::move(callbacksPtr)))); } void BackgroundSyncProvider::unregisterBackgroundSync( @@ -120,7 +122,8 @@ void BackgroundSyncProvider::unregisterBackgroundSync( GetBackgroundSyncServicePtr()->Unregister( handle_id, service_worker_registration_id, base::Bind(&BackgroundSyncProvider::UnregisterCallback, - base::Unretained(this), base::Passed(callbacksPtr.Pass()))); + base::Unretained(this), + base::Passed(std::move(callbacksPtr)))); } void BackgroundSyncProvider::getRegistration( @@ -140,7 +143,8 @@ void BackgroundSyncProvider::getRegistration( mojo::ConvertTo<BackgroundSyncPeriodicity>(periodicity), tag.utf8(), service_worker_registration_id, base::Bind(&BackgroundSyncProvider::GetRegistrationCallback, - base::Unretained(this), base::Passed(callbacksPtr.Pass()))); + base::Unretained(this), + base::Passed(std::move(callbacksPtr)))); } void BackgroundSyncProvider::getRegistrations( @@ -159,7 +163,8 @@ void BackgroundSyncProvider::getRegistrations( mojo::ConvertTo<BackgroundSyncPeriodicity>(periodicity), service_worker_registration_id, base::Bind(&BackgroundSyncProvider::GetRegistrationsCallback, - base::Unretained(this), base::Passed(callbacksPtr.Pass()))); + base::Unretained(this), + base::Passed(std::move(callbacksPtr)))); } void BackgroundSyncProvider::getPermissionStatus( @@ -179,7 +184,8 @@ void BackgroundSyncProvider::getPermissionStatus( mojo::ConvertTo<BackgroundSyncPeriodicity>(periodicity), service_worker_registration_id, base::Bind(&BackgroundSyncProvider::GetPermissionStatusCallback, - base::Unretained(this), base::Passed(callbacksPtr.Pass()))); + base::Unretained(this), + base::Passed(std::move(callbacksPtr)))); } void BackgroundSyncProvider::releaseRegistration(int64_t handle_id) { @@ -197,9 +203,9 @@ void BackgroundSyncProvider::notifyWhenFinished( // base::Unretained is safe here, as the mojo channel will be deleted (and // will wipe its callbacks) before 'this' is deleted. GetBackgroundSyncServicePtr()->NotifyWhenFinished( - handle_id, - base::Bind(&BackgroundSyncProvider::NotifyWhenFinishedCallback, - base::Unretained(this), base::Passed(callbacks_ptr.Pass()))); + handle_id, base::Bind(&BackgroundSyncProvider::NotifyWhenFinishedCallback, + base::Unretained(this), + base::Passed(std::move(callbacks_ptr)))); } void BackgroundSyncProvider::DuplicateRegistrationHandle( diff --git a/content/child/background_sync/background_sync_type_converters.cc b/content/child/background_sync/background_sync_type_converters.cc index 5144444..de459d2 100644 --- a/content/child/background_sync/background_sync_type_converters.cc +++ b/content/child/background_sync/background_sync_type_converters.cc @@ -128,7 +128,7 @@ content::SyncRegistrationPtr TypeConverter< ConvertTo<content::BackgroundSyncNetworkState>(input.networkState); result->power_state = ConvertTo<content::BackgroundSyncPowerState>(input.powerState); - return result.Pass(); + return result; } // static diff --git a/content/child/blob_storage/blob_transport_controller.cc b/content/child/blob_storage/blob_transport_controller.cc index 602860b..cfd2c05 100644 --- a/content/child/blob_storage/blob_transport_controller.cc +++ b/content/child/blob_storage/blob_transport_controller.cc @@ -4,6 +4,7 @@ #include "content/child/blob_storage/blob_transport_controller.h" +#include <utility> #include <vector> #include "base/lazy_instance.h" @@ -49,7 +50,7 @@ void BlobTransportController::InitiateBlobTransfer( scoped_ptr<BlobConsolidation> consolidation, IPC::Sender* sender) { BlobConsolidation* consolidation_ptr = consolidation.get(); - blob_storage_.insert(std::make_pair(uuid, consolidation.Pass())); + blob_storage_.insert(std::make_pair(uuid, std::move(consolidation))); std::vector<storage::DataElement> descriptions; GetDescriptions(consolidation_ptr, kLargeThresholdBytes, &descriptions); // TODO(dmurph): Uncomment when IPC messages are added. diff --git a/content/child/child_discardable_shared_memory_manager.cc b/content/child/child_discardable_shared_memory_manager.cc index 04db84f..7bb268c 100644 --- a/content/child/child_discardable_shared_memory_manager.cc +++ b/content/child/child_discardable_shared_memory_manager.cc @@ -4,6 +4,8 @@ #include "content/child/child_discardable_shared_memory_manager.h" +#include <utility> + #include "base/atomic_sequence_num.h" #include "base/bind.h" #include "base/debug/crash_logging.h" @@ -32,13 +34,13 @@ class DiscardableMemoryImpl : public base::DiscardableMemory { public: DiscardableMemoryImpl(ChildDiscardableSharedMemoryManager* manager, scoped_ptr<DiscardableSharedMemoryHeap::Span> span) - : manager_(manager), span_(span.Pass()), is_locked_(true) {} + : manager_(manager), span_(std::move(span)), is_locked_(true) {} ~DiscardableMemoryImpl() override { if (is_locked_) manager_->UnlockSpan(span_.get()); - manager_->ReleaseSpan(span_.Pass()); + manager_->ReleaseSpan(std::move(span_)); } // Overridden from base::DiscardableMemory: @@ -157,7 +159,8 @@ ChildDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory( // at least one span from the free lists. MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists()); - return make_scoped_ptr(new DiscardableMemoryImpl(this, free_span.Pass())); + return make_scoped_ptr( + new DiscardableMemoryImpl(this, std::move(free_span))); } // Release purged memory to free up the address space before we attempt to @@ -181,7 +184,7 @@ ChildDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory( // Create span for allocated memory. scoped_ptr<DiscardableSharedMemoryHeap::Span> new_span(heap_.Grow( - shared_memory.Pass(), allocation_size_in_bytes, new_id, + std::move(shared_memory), allocation_size_in_bytes, new_id, base::Bind(&SendDeletedDiscardableSharedMemoryMessage, sender_, new_id))); new_span->set_is_locked(true); @@ -194,12 +197,12 @@ ChildDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory( reinterpret_cast<size_t>(leftover->shared_memory()->memory()), leftover->length() * base::GetPageSize()); leftover->set_is_locked(false); - heap_.MergeIntoFreeLists(leftover.Pass()); + heap_.MergeIntoFreeLists(std::move(leftover)); } MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists()); - return make_scoped_ptr(new DiscardableMemoryImpl(this, new_span.Pass())); + return make_scoped_ptr(new DiscardableMemoryImpl(this, std::move(new_span))); } bool ChildDiscardableSharedMemoryManager::OnMemoryDump( @@ -270,7 +273,7 @@ void ChildDiscardableSharedMemoryManager::ReleaseSpan( if (!span->shared_memory()) return; - heap_.MergeIntoFreeLists(span.Pass()); + heap_.MergeIntoFreeLists(std::move(span)); // Bytes of free memory changed. MemoryUsageChanged(heap_.GetSize(), heap_.GetSizeOfFreeLists()); @@ -302,7 +305,7 @@ ChildDiscardableSharedMemoryManager::AllocateLockedDiscardableSharedMemory( new base::DiscardableSharedMemory(handle)); if (!memory->Map(size)) base::TerminateBecauseOutOfMemory(size); - return memory.Pass(); + return memory; } void ChildDiscardableSharedMemoryManager::MemoryUsageChanged( diff --git a/content/child/child_gpu_memory_buffer_manager.cc b/content/child/child_gpu_memory_buffer_manager.cc index c83ceea..e88b6bd 100644 --- a/content/child/child_gpu_memory_buffer_manager.cc +++ b/content/child/child_gpu_memory_buffer_manager.cc @@ -4,6 +4,8 @@ #include "content/child/child_gpu_memory_buffer_manager.h" +#include <utility> + #include "content/common/child_process_messages.h" #include "content/common/generic_shared_memory_id_generator.h" #include "content/common/gpu/client/gpu_memory_buffer_impl.h" @@ -57,7 +59,7 @@ ChildGpuMemoryBufferManager::AllocateGpuMemoryBuffer(const gfx::Size& size, return nullptr; } - return buffer.Pass(); + return std::move(buffer); } scoped_ptr<gfx::GpuMemoryBuffer> diff --git a/content/child/child_shared_bitmap_manager.cc b/content/child/child_shared_bitmap_manager.cc index 51c883a..d83d431 100644 --- a/content/child/child_shared_bitmap_manager.cc +++ b/content/child/child_shared_bitmap_manager.cc @@ -5,6 +5,7 @@ #include "content/child/child_shared_bitmap_manager.h" #include <stddef.h> +#include <utility> #include "base/debug/alias.h" #include "base/process/memory.h" @@ -32,7 +33,7 @@ class ChildSharedBitmap : public SharedMemoryBitmap { scoped_ptr<base::SharedMemory> shared_memory_holder, const cc::SharedBitmapId& id) : ChildSharedBitmap(sender, shared_memory_holder.get(), id) { - shared_memory_holder_ = shared_memory_holder.Pass(); + shared_memory_holder_ = std::move(shared_memory_holder); } ~ChildSharedBitmap() override { @@ -90,7 +91,7 @@ scoped_ptr<cc::SharedBitmap> ChildSharedBitmapManager::AllocateSharedBitmap( if (bitmap) bitmap->shared_memory()->Close(); #endif - return bitmap.Pass(); + return std::move(bitmap); } scoped_ptr<SharedMemoryBitmap> @@ -122,7 +123,7 @@ ChildSharedBitmapManager::AllocateSharedMemoryBitmap(const gfx::Size& size) { sender_->Send(new ChildProcessHostMsg_AllocatedSharedBitmap( memory_size, handle_to_send, id)); #endif - return make_scoped_ptr(new ChildSharedBitmap(sender_, memory.Pass(), id)); + return make_scoped_ptr(new ChildSharedBitmap(sender_, std::move(memory), id)); } scoped_ptr<cc::SharedBitmap> ChildSharedBitmapManager::GetSharedBitmapFromId( diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc index 5a2c5c3..3c6d869 100644 --- a/content/child/child_thread_impl.cc +++ b/content/child/child_thread_impl.cc @@ -5,8 +5,8 @@ #include "content/child/child_thread_impl.h" #include <signal.h> - #include <string> +#include <utility> #include "base/base_switches.h" #include "base/command_line.h" @@ -470,8 +470,8 @@ void ChildThreadImpl::Init(const Options& options) { new PowerMonitorBroadcastSource()); channel_->AddFilter(power_monitor_source->GetMessageFilter()); - power_monitor_.reset(new base::PowerMonitor( - power_monitor_source.Pass())); + power_monitor_.reset( + new base::PowerMonitor(std::move(power_monitor_source))); } #if defined(OS_POSIX) @@ -726,7 +726,7 @@ void ChildThreadImpl::OnBindExternalMojoShellHandle( mojo::ScopedMessagePipeHandle message_pipe = mojo_shell_channel_init_.Init(handle, GetIOTaskRunner()); DCHECK(message_pipe.is_valid()); - MojoShellConnectionImpl::Get()->BindToMessagePipe(message_pipe.Pass()); + MojoShellConnectionImpl::Get()->BindToMessagePipe(std::move(message_pipe)); #endif // defined(MOJO_SHELL_CLIENT) } diff --git a/content/child/child_thread_impl_browsertest.cc b/content/child/child_thread_impl_browsertest.cc index a39c456..b7e2820 100644 --- a/content/child/child_thread_impl_browsertest.cc +++ b/content/child/child_thread_impl_browsertest.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/child/child_thread_impl.h" + #include <stddef.h> #include <string.h> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -12,7 +15,6 @@ #include "base/time/time.h" #include "content/child/child_discardable_shared_memory_manager.h" #include "content/child/child_gpu_memory_buffer_manager.h" -#include "content/child/child_thread_impl.h" #include "content/common/gpu/client/gpu_memory_buffer_impl.h" #include "content/common/host_discardable_shared_memory_manager.h" #include "content/public/common/content_switches.h" @@ -97,7 +99,7 @@ IN_PROC_BROWSER_TEST_F(ChildThreadImplBrowserTest, void* addr = memory->data(); ASSERT_NE(nullptr, addr); memory->Unlock(); - instances.push_back(memory.Pass()); + instances.push_back(std::move(memory)); } } diff --git a/content/child/mojo/mojo_application.cc b/content/child/mojo/mojo_application.cc index 242f1f1..cfa0e43 100644 --- a/content/child/mojo/mojo_application.cc +++ b/content/child/mojo/mojo_application.cc @@ -4,6 +4,8 @@ #include "content/child/mojo/mojo_application.h" +#include <utility> + #include "build/build_config.h" #include "content/child/child_process.h" #include "content/common/application_setup.mojom.h" @@ -46,14 +48,14 @@ void MojoApplication::OnActivate( ApplicationSetupPtr application_setup; application_setup.Bind( - mojo::InterfacePtrInfo<ApplicationSetup>(message_pipe.Pass(), 0u)); + mojo::InterfacePtrInfo<ApplicationSetup>(std::move(message_pipe), 0u)); mojo::ServiceProviderPtr services; mojo::ServiceProviderPtr exposed_services; service_registry_.Bind(GetProxy(&exposed_services)); application_setup->ExchangeServiceProviders(GetProxy(&services), - exposed_services.Pass()); - service_registry_.BindRemoteServiceProvider(services.Pass()); + std::move(exposed_services)); + service_registry_.BindRemoteServiceProvider(std::move(services)); } } // namespace content diff --git a/content/child/mojo/type_converters.h b/content/child/mojo/type_converters.h index 44e1687..180cadb 100644 --- a/content/child/mojo/type_converters.h +++ b/content/child/mojo/type_converters.h @@ -3,6 +3,7 @@ // found in the LICENSE file. #include <stddef.h> +#include <utility> #include "mojo/public/cpp/bindings/array.h" #include "third_party/WebKit/public/platform/WebVector.h" @@ -15,7 +16,7 @@ struct TypeConverter<Array<T>, blink::WebVector<U>> { Array<T> array(vector.size()); for (size_t i = 0; i < vector.size(); ++i) array[i] = TypeConverter<T, U>::Convert(vector[i]); - return array.Pass(); + return std::move(array); } }; diff --git a/content/child/navigator_connect/service_port_dispatcher_impl.cc b/content/child/navigator_connect/service_port_dispatcher_impl.cc index 1e70399..bc002a9 100644 --- a/content/child/navigator_connect/service_port_dispatcher_impl.cc +++ b/content/child/navigator_connect/service_port_dispatcher_impl.cc @@ -4,6 +4,8 @@ #include "content/child/navigator_connect/service_port_dispatcher_impl.h" +#include <utility> + #include "base/trace_event/trace_event.h" #include "mojo/common/common_type_converters.h" #include "mojo/common/url_type_converters.h" @@ -42,7 +44,7 @@ class WebConnectCallbacksImpl void ServicePortDispatcherImpl::Create( base::WeakPtr<blink::WebServiceWorkerContextProxy> proxy, mojo::InterfaceRequest<ServicePortDispatcher> request) { - new ServicePortDispatcherImpl(proxy, request.Pass()); + new ServicePortDispatcherImpl(proxy, std::move(request)); } ServicePortDispatcherImpl::~ServicePortDispatcherImpl() { @@ -52,7 +54,7 @@ ServicePortDispatcherImpl::~ServicePortDispatcherImpl() { ServicePortDispatcherImpl::ServicePortDispatcherImpl( base::WeakPtr<blink::WebServiceWorkerContextProxy> proxy, mojo::InterfaceRequest<ServicePortDispatcher> request) - : binding_(this, request.Pass()), proxy_(proxy) { + : binding_(this, std::move(request)), proxy_(proxy) { WorkerThread::AddObserver(this); } diff --git a/content/child/navigator_connect/service_port_provider.cc b/content/child/navigator_connect/service_port_provider.cc index 4afcef9..79bf8a5 100644 --- a/content/child/navigator_connect/service_port_provider.cc +++ b/content/child/navigator_connect/service_port_provider.cc @@ -4,6 +4,8 @@ #include "content/child/navigator_connect/service_port_provider.h" +#include <utility> + #include "base/lazy_instance.h" #include "base/single_thread_task_runner.h" #include "base/task_runner_util.h" @@ -23,7 +25,7 @@ namespace { void ConnectToServiceOnMainThread( mojo::InterfaceRequest<ServicePortService> ptr) { ChildThreadImpl::current()->service_registry()->ConnectToRemoteService( - ptr.Pass()); + std::move(ptr)); } } // namespace @@ -124,7 +126,7 @@ ServicePortServicePtr& ServicePortProvider::GetServicePortServicePtr() { // Setup channel for browser to post events back to this class. ServicePortServiceClientPtr client_ptr; binding_.Bind(GetProxy(&client_ptr)); - service_port_service_->SetClient(client_ptr.Pass()); + service_port_service_->SetClient(std::move(client_ptr)); } return service_port_service_; } diff --git a/content/child/permissions/permission_dispatcher.cc b/content/child/permissions/permission_dispatcher.cc index b30129c..2efb9a6 100644 --- a/content/child/permissions/permission_dispatcher.cc +++ b/content/child/permissions/permission_dispatcher.cc @@ -5,6 +5,7 @@ #include "content/child/permissions/permission_dispatcher.h" #include <stddef.h> +#include <utility> #include "base/callback.h" #include "content/public/child/worker_thread.h" @@ -296,13 +297,10 @@ void PermissionDispatcher::RequestPermissionsInternal( names[i] = GetPermissionName(types[i]); GetPermissionServicePtr()->RequestPermissions( - names.Pass(), - origin, + std::move(names), origin, blink::WebUserGestureIndicator::isProcessingUserGesture(), base::Bind(&PermissionDispatcher::OnRequestPermissionsResponse, - base::Unretained(this), - worker_thread_id, - callback_key)); + base::Unretained(this), worker_thread_id, callback_key)); } void PermissionDispatcher::RevokePermissionInternal( diff --git a/content/child/process_control_impl.cc b/content/child/process_control_impl.cc index f1e6c3d..a53c011 100644 --- a/content/child/process_control_impl.cc +++ b/content/child/process_control_impl.cc @@ -4,6 +4,8 @@ #include "content/child/process_control_impl.h" +#include <utility> + #include "base/stl_util.h" #include "content/public/common/content_client.h" #include "mojo/shell/static_application_loader.h" @@ -38,7 +40,7 @@ void ProcessControlImpl::LoadApplication( } callback.Run(true); - it->second->Load(application_url, request.Pass()); + it->second->Load(application_url, std::move(request)); } } // namespace content diff --git a/content/child/request_extra_data.h b/content/child/request_extra_data.h index 0a3a2e0..0905789 100644 --- a/content/child/request_extra_data.h +++ b/content/child/request_extra_data.h @@ -5,6 +5,8 @@ #ifndef CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ #define CONTENT_CHILD_REQUEST_EXTRA_DATA_H_ +#include <utility> + #include "base/compiler_specific.h" #include "base/macros.h" #include "content/child/web_url_loader_impl.h" @@ -114,12 +116,12 @@ class CONTENT_EXPORT RequestExtraData // PlzNavigate: |stream_override| is used to override certain parameters of // navigation requests. scoped_ptr<StreamOverrideParameters> TakeStreamOverrideOwnership() { - return stream_override_.Pass(); + return std::move(stream_override_); } void set_stream_override( scoped_ptr<StreamOverrideParameters> stream_override) { - stream_override_ = stream_override.Pass(); + stream_override_ = std::move(stream_override); } private: diff --git a/content/child/resource_dispatcher.cc b/content/child/resource_dispatcher.cc index d7734432..1e64151 100644 --- a/content/child/resource_dispatcher.cc +++ b/content/child/resource_dispatcher.cc @@ -6,6 +6,8 @@ #include "content/child/resource_dispatcher.h" +#include <utility> + #include "base/bind.h" #include "base/compiler_specific.h" #include "base/debug/alias.h" @@ -286,7 +288,7 @@ void ResourceDispatcher::OnReceivedData(int request_id, factory->Create(data_offset, data_length, encoded_data_length); // |data| takes care of ACKing. send_ack = false; - request_info->peer->OnReceivedData(data.Pass()); + request_info->peer->OnReceivedData(std::move(data)); } UMA_HISTOGRAM_TIMES("ResourceDispatcher.OnReceivedDataTime", @@ -860,7 +862,7 @@ scoped_ptr<ResourceHostMsg_Request> ResourceDispatcher::CreateRequest( request->request_body = request_body; if (frame_origin) *frame_origin = extra_data->frame_origin(); - return request.Pass(); + return request; } void ResourceDispatcher::SetResourceSchedulingFilter( diff --git a/content/child/resource_dispatcher_unittest.cc b/content/child/resource_dispatcher_unittest.cc index 005be33..86391a3 100644 --- a/content/child/resource_dispatcher_unittest.cc +++ b/content/child/resource_dispatcher_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/child/resource_dispatcher.h" + #include <stddef.h> #include <stdint.h> - #include <string> +#include <utility> #include <vector> #include "base/macros.h" @@ -17,7 +19,6 @@ #include "base/stl_util.h" #include "content/child/request_extra_data.h" #include "content/child/request_info.h" -#include "content/child/resource_dispatcher.h" #include "content/common/appcache_interfaces.h" #include "content/common/resource_messages.h" #include "content/common/service_worker/service_worker_types.h" @@ -111,7 +112,7 @@ class TestRequestPeer : public RequestPeer { if (cancel_on_receive_response) return; if (data) - OnReceivedData(data.Pass()); + OnReceivedData(std::move(data)); OnCompletedRequest(error_code, was_ignored_by_handler, stale_copy_in_cache, security_info, completion_time, total_transfer_size); } diff --git a/content/child/resource_scheduling_filter.cc b/content/child/resource_scheduling_filter.cc index 0c086a4..ba05fdc 100644 --- a/content/child/resource_scheduling_filter.cc +++ b/content/child/resource_scheduling_filter.cc @@ -4,6 +4,8 @@ #include "content/child/resource_scheduling_filter.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "content/child/resource_dispatcher.h" @@ -82,7 +84,7 @@ void ResourceSchedulingFilter::SetRequestIdTaskRunner( int id, scoped_ptr<blink::WebTaskRunner> web_task_runner) { base::AutoLock lock(request_id_to_task_runner_map_lock_); request_id_to_task_runner_map_.insert( - std::make_pair(id, web_task_runner.Pass())); + std::make_pair(id, std::move(web_task_runner))); } void ResourceSchedulingFilter::ClearRequestIdTaskRunner(int id) { diff --git a/content/child/scoped_web_callbacks.h b/content/child/scoped_web_callbacks.h index b0c3b2b..0d68230 100644 --- a/content/child/scoped_web_callbacks.h +++ b/content/child/scoped_web_callbacks.h @@ -74,12 +74,12 @@ class ScopedWebCallbacks { ScopedWebCallbacks(scoped_ptr<CallbacksType> callbacks, const DestructionCallback& destruction_callback) - : callbacks_(callbacks.Pass()), + : callbacks_(std::move(callbacks)), destruction_callback_(destruction_callback) {} ~ScopedWebCallbacks() { if (callbacks_) - destruction_callback_.Run(callbacks_.Pass()); + destruction_callback_.Run(std::move(callbacks_)); } ScopedWebCallbacks(ScopedWebCallbacks&& other) { *this = std::move(other); } @@ -90,7 +90,7 @@ class ScopedWebCallbacks { return *this; } - scoped_ptr<CallbacksType> PassCallbacks() { return callbacks_.Pass(); } + scoped_ptr<CallbacksType> PassCallbacks() { return std::move(callbacks_); } private: scoped_ptr<CallbacksType> callbacks_; diff --git a/content/child/service_worker/service_worker_dispatcher.cc b/content/child/service_worker/service_worker_dispatcher.cc index a71d69c..b8fd1421 100644 --- a/content/child/service_worker/service_worker_dispatcher.cc +++ b/content/child/service_worker/service_worker_dispatcher.cc @@ -5,6 +5,7 @@ #include "content/child/service_worker/service_worker_dispatcher.h" #include <stddef.h> +#include <utility> #include "base/lazy_instance.h" #include "base/single_thread_task_runner.h" @@ -275,7 +276,8 @@ ServiceWorkerDispatcher::GetOrCreateServiceWorker( return found->second; // WebServiceWorkerImpl constructor calls AddServiceWorker. - return new WebServiceWorkerImpl(handle_ref.Pass(), thread_safe_sender_.get()); + return new WebServiceWorkerImpl(std::move(handle_ref), + thread_safe_sender_.get()); } scoped_refptr<WebServiceWorkerRegistrationImpl> @@ -323,10 +325,11 @@ ServiceWorkerDispatcher::GetOrAdoptRegistration( // WebServiceWorkerRegistrationImpl constructor calls // AddServiceWorkerRegistration. scoped_refptr<WebServiceWorkerRegistrationImpl> registration( - new WebServiceWorkerRegistrationImpl(registration_ref.Pass())); - registration->SetInstalling(GetOrCreateServiceWorker(installing_ref.Pass())); - registration->SetWaiting(GetOrCreateServiceWorker(waiting_ref.Pass())); - registration->SetActive(GetOrCreateServiceWorker(active_ref.Pass())); + new WebServiceWorkerRegistrationImpl(std::move(registration_ref))); + registration->SetInstalling( + GetOrCreateServiceWorker(std::move(installing_ref))); + registration->SetWaiting(GetOrCreateServiceWorker(std::move(waiting_ref))); + registration->SetActive(GetOrCreateServiceWorker(std::move(active_ref))); return registration; } @@ -345,7 +348,8 @@ void ServiceWorkerDispatcher::OnAssociateRegistration( ProviderContextMap::iterator context = provider_contexts_.find(provider_id); if (context != provider_contexts_.end()) { context->second->OnAssociateRegistration( - registration.Pass(), installing.Pass(), waiting.Pass(), active.Pass()); + std::move(registration), std::move(installing), std::move(waiting), + std::move(active)); } } @@ -657,11 +661,12 @@ void ServiceWorkerDispatcher::OnSetVersionAttributes( // Populate the version fields (eg. .installing) with worker objects. ChangedVersionAttributesMask mask(changed_mask); if (mask.installing_changed()) - found->second->SetInstalling(GetOrCreateServiceWorker(installing.Pass())); + found->second->SetInstalling( + GetOrCreateServiceWorker(std::move(installing))); if (mask.waiting_changed()) - found->second->SetWaiting(GetOrCreateServiceWorker(waiting.Pass())); + found->second->SetWaiting(GetOrCreateServiceWorker(std::move(waiting))); if (mask.active_changed()) - found->second->SetActive(GetOrCreateServiceWorker(active.Pass())); + found->second->SetActive(GetOrCreateServiceWorker(std::move(active))); } } @@ -691,7 +696,7 @@ void ServiceWorkerDispatcher::OnSetControllerServiceWorker( scoped_ptr<ServiceWorkerHandleReference> handle_ref = Adopt(info); ProviderContextMap::iterator provider = provider_contexts_.find(provider_id); if (provider != provider_contexts_.end()) - provider->second->OnSetControllerServiceWorker(handle_ref.Pass()); + provider->second->OnSetControllerServiceWorker(std::move(handle_ref)); ProviderClientMap::iterator found = provider_clients_.find(provider_id); if (found != provider_clients_.end()) { diff --git a/content/child/service_worker/service_worker_network_provider.cc b/content/child/service_worker/service_worker_network_provider.cc index 9f370cd..7ce9697 100644 --- a/content/child/service_worker/service_worker_network_provider.cc +++ b/content/child/service_worker/service_worker_network_provider.cc @@ -97,7 +97,7 @@ ServiceWorkerNetworkProvider::CreateForNavigation( network_provider = scoped_ptr<ServiceWorkerNetworkProvider>( new ServiceWorkerNetworkProvider()); } - return network_provider.Pass(); + return network_provider; } ServiceWorkerNetworkProvider::ServiceWorkerNetworkProvider( diff --git a/content/child/service_worker/service_worker_provider_context.cc b/content/child/service_worker/service_worker_provider_context.cc index 37c5a69..9ff307e 100644 --- a/content/child/service_worker/service_worker_provider_context.cc +++ b/content/child/service_worker/service_worker_provider_context.cc @@ -4,6 +4,8 @@ #include "content/child/service_worker/service_worker_provider_context.h" +#include <utility> + #include "base/macros.h" #include "base/thread_task_runner_handle.h" #include "content/child/child_thread_impl.h" @@ -47,7 +49,7 @@ class ServiceWorkerProviderContext::ControlleeDelegate scoped_ptr<ServiceWorkerHandleReference> waiting, scoped_ptr<ServiceWorkerHandleReference> active) override { DCHECK(!registration_); - registration_ = registration.Pass(); + registration_ = std::move(registration); } void DisassociateRegistration() override { @@ -60,7 +62,7 @@ class ServiceWorkerProviderContext::ControlleeDelegate DCHECK(registration_); DCHECK(!controller || controller->handle_id() != kInvalidServiceWorkerHandleId); - controller_ = controller.Pass(); + controller_ = std::move(controller); } void GetAssociatedRegistration( @@ -94,10 +96,10 @@ class ServiceWorkerProviderContext::ControllerDelegate scoped_ptr<ServiceWorkerHandleReference> waiting, scoped_ptr<ServiceWorkerHandleReference> active) override { DCHECK(!registration_); - registration_ = registration.Pass(); - installing_ = installing.Pass(); - waiting_ = waiting.Pass(); - active_ = active.Pass(); + registration_ = std::move(registration); + installing_ = std::move(installing); + waiting_ = std::move(waiting); + active_ = std::move(active); } void DisassociateRegistration() override { @@ -169,8 +171,9 @@ void ServiceWorkerProviderContext::OnAssociateRegistration( scoped_ptr<ServiceWorkerHandleReference> waiting, scoped_ptr<ServiceWorkerHandleReference> active) { DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); - delegate_->AssociateRegistration(registration.Pass(), installing.Pass(), - waiting.Pass(), active.Pass()); + delegate_->AssociateRegistration(std::move(registration), + std::move(installing), std::move(waiting), + std::move(active)); } void ServiceWorkerProviderContext::OnDisassociateRegistration() { @@ -181,7 +184,7 @@ void ServiceWorkerProviderContext::OnDisassociateRegistration() { void ServiceWorkerProviderContext::OnSetControllerServiceWorker( scoped_ptr<ServiceWorkerHandleReference> controller) { DCHECK(main_thread_task_runner_->RunsTasksOnCurrentThread()); - delegate_->SetController(controller.Pass()); + delegate_->SetController(std::move(controller)); } void ServiceWorkerProviderContext::GetAssociatedRegistration( diff --git a/content/child/service_worker/web_service_worker_impl.cc b/content/child/service_worker/web_service_worker_impl.cc index 273b8fd..f38d2c0 100644 --- a/content/child/service_worker/web_service_worker_impl.cc +++ b/content/child/service_worker/web_service_worker_impl.cc @@ -4,6 +4,8 @@ #include "content/child/service_worker/web_service_worker_impl.h" +#include <utility> + #include "base/macros.h" #include "content/child/service_worker/service_worker_dispatcher.h" #include "content/child/service_worker/service_worker_handle_reference.h" @@ -43,7 +45,7 @@ void SendPostMessageToWorkerOnMainThread( scoped_ptr<WebMessagePortChannelArray> channels) { thread_safe_sender->Send(new ServiceWorkerHostMsg_PostMessageToWorker( handle_id, message, - WebMessagePortChannelImpl::ExtractMessagePortIDs(channels.Pass()))); + WebMessagePortChannelImpl::ExtractMessagePortIDs(std::move(channels)))); } } // namespace @@ -51,7 +53,7 @@ void SendPostMessageToWorkerOnMainThread( WebServiceWorkerImpl::WebServiceWorkerImpl( scoped_ptr<ServiceWorkerHandleReference> handle_ref, ThreadSafeSender* thread_safe_sender) - : handle_ref_(handle_ref.Pass()), + : handle_ref_(std::move(handle_ref)), state_(handle_ref_->state()), thread_safe_sender_(thread_safe_sender), proxy_(nullptr) { diff --git a/content/child/service_worker/web_service_worker_registration_impl.cc b/content/child/service_worker/web_service_worker_registration_impl.cc index a33739f..a753de4 100644 --- a/content/child/service_worker/web_service_worker_registration_impl.cc +++ b/content/child/service_worker/web_service_worker_registration_impl.cc @@ -4,6 +4,8 @@ #include "content/child/service_worker/web_service_worker_registration_impl.h" +#include <utility> + #include "base/macros.h" #include "content/child/service_worker/service_worker_dispatcher.h" #include "content/child/service_worker/service_worker_registration_handle_reference.h" @@ -44,7 +46,7 @@ WebServiceWorkerRegistrationImpl::QueuedTask::~QueuedTask() {} WebServiceWorkerRegistrationImpl::WebServiceWorkerRegistrationImpl( scoped_ptr<ServiceWorkerRegistrationHandleReference> handle_ref) - : handle_ref_(handle_ref.Pass()), proxy_(nullptr) { + : handle_ref_(std::move(handle_ref)), proxy_(nullptr) { DCHECK(handle_ref_); DCHECK_NE(kInvalidServiceWorkerRegistrationHandleId, handle_ref_->handle_id()); diff --git a/content/child/shared_memory_data_consumer_handle.cc b/content/child/shared_memory_data_consumer_handle.cc index 81b368d..b7e4d11 100644 --- a/content/child/shared_memory_data_consumer_handle.cc +++ b/content/child/shared_memory_data_consumer_handle.cc @@ -6,6 +6,7 @@ #include <algorithm> #include <deque> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -24,7 +25,8 @@ class DelegateThreadSafeReceivedData final public: explicit DelegateThreadSafeReceivedData( scoped_ptr<RequestPeer::ReceivedData> data) - : data_(data.Pass()), task_runner_(base::ThreadTaskRunnerHandle::Get()) {} + : data_(std::move(data)), + task_runner_(base::ThreadTaskRunnerHandle::Get()) {} ~DelegateThreadSafeReceivedData() override { if (!task_runner_->BelongsToCurrentThread()) { // Delete the data on the original thread. @@ -303,11 +305,11 @@ void SharedMemoryDataConsumerHandle::Writer::AddData( scoped_ptr<RequestPeer::ThreadSafeReceivedData> data_to_pass; if (mode_ == kApplyBackpressure) { data_to_pass = - make_scoped_ptr(new DelegateThreadSafeReceivedData(data.Pass())); + make_scoped_ptr(new DelegateThreadSafeReceivedData(std::move(data))); } else { data_to_pass = make_scoped_ptr(new FixedReceivedData(data.get())); } - context_->Push(data_to_pass.Pass()); + context_->Push(std::move(data_to_pass)); } if (needs_notification) { diff --git a/content/child/shared_memory_data_consumer_handle_unittest.cc b/content/child/shared_memory_data_consumer_handle_unittest.cc index 0454ada..5694d58 100644 --- a/content/child/shared_memory_data_consumer_handle_unittest.cc +++ b/content/child/shared_memory_data_consumer_handle_unittest.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include <string.h> #include <string> +#include <utility> #include <vector> #include "base/bind.h" @@ -127,7 +128,7 @@ class ThreadedSharedMemoryDataConsumerHandleTest : public ::testing::Test { ReadDataOperation(scoped_ptr<SharedMemoryDataConsumerHandle> handle, base::MessageLoop* main_message_loop, const base::Closure& on_done) - : handle_(handle.Pass()), + : handle_(std::move(handle)), main_message_loop_(main_message_loop), on_done_(on_done) {} @@ -1000,8 +1001,8 @@ TEST(SharedMemoryDataConsumerHandleWithoutBackpressureTest, AddData) { TEST_F(ThreadedSharedMemoryDataConsumerHandleTest, Read) { base::RunLoop run_loop; - auto operation = make_scoped_ptr( - new ReadDataOperation(handle_.Pass(), &loop_, run_loop.QuitClosure())); + auto operation = make_scoped_ptr(new ReadDataOperation( + std::move(handle_), &loop_, run_loop.QuitClosure())); scoped_refptr<Logger> logger(new Logger); base::Thread t("DataConsumerHandle test thread"); diff --git a/content/child/web_data_consumer_handle_impl.cc b/content/child/web_data_consumer_handle_impl.cc index 0d8eca8..f4ded9d 100644 --- a/content/child/web_data_consumer_handle_impl.cc +++ b/content/child/web_data_consumer_handle_impl.cc @@ -5,8 +5,9 @@ #include "content/child/web_data_consumer_handle_impl.h" #include <stdint.h> - #include <limits> +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/macros.h" @@ -19,7 +20,7 @@ using Result = blink::WebDataConsumerHandle::Result; class WebDataConsumerHandleImpl::Context : public base::RefCountedThreadSafe<Context> { public: - explicit Context(Handle handle) : handle_(handle.Pass()) {} + explicit Context(Handle handle) : handle_(std::move(handle)) {} const Handle& handle() { return handle_; } @@ -121,8 +122,7 @@ void WebDataConsumerHandleImpl::ReaderImpl::OnHandleGotReadable(MojoResult) { } WebDataConsumerHandleImpl::WebDataConsumerHandleImpl(Handle handle) - : context_(new Context(handle.Pass())) { -} + : context_(new Context(std::move(handle))) {} WebDataConsumerHandleImpl::~WebDataConsumerHandleImpl() { } diff --git a/content/child/web_data_consumer_handle_impl_unittest.cc b/content/child/web_data_consumer_handle_impl_unittest.cc index 54121ba..747d8d8 100644 --- a/content/child/web_data_consumer_handle_impl_unittest.cc +++ b/content/child/web_data_consumer_handle_impl_unittest.cc @@ -6,9 +6,10 @@ #include <stddef.h> #include <stdint.h> - #include <algorithm> #include <string> +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/memory/scoped_ptr.h" @@ -61,7 +62,7 @@ class ReadDataOperation : public ReadDataOperationBase { ReadDataOperation(mojo::ScopedDataPipeConsumerHandle handle, base::MessageLoop* main_message_loop, const base::Closure& on_done) - : handle_(new WebDataConsumerHandleImpl(handle.Pass())), + : handle_(new WebDataConsumerHandleImpl(std::move(handle))), main_message_loop_(main_message_loop), on_done_(on_done) {} @@ -116,8 +117,9 @@ class TwoPhaseReadDataOperation : public ReadDataOperationBase { TwoPhaseReadDataOperation(mojo::ScopedDataPipeConsumerHandle handle, base::MessageLoop* main_message_loop, const base::Closure& on_done) - : handle_(new WebDataConsumerHandleImpl(handle.Pass())), - main_message_loop_(main_message_loop), on_done_(on_done) {} + : handle_(new WebDataConsumerHandleImpl(std::move(handle))), + main_message_loop_(main_message_loop), + on_done_(on_done) {} const std::string& result() const { return result_; } @@ -228,9 +230,7 @@ class WebDataConsumerHandleImplTest : public ::testing::Test { TEST_F(WebDataConsumerHandleImplTest, ReadData) { base::RunLoop run_loop; auto operation = make_scoped_ptr(new ReadDataOperation( - consumer_.Pass(), - &message_loop_, - run_loop.QuitClosure())); + std::move(consumer_), &message_loop_, run_loop.QuitClosure())); base::Thread t("DataConsumerHandle test thread"); ASSERT_TRUE(t.Start()); @@ -251,9 +251,7 @@ TEST_F(WebDataConsumerHandleImplTest, ReadData) { TEST_F(WebDataConsumerHandleImplTest, TwoPhaseReadData) { base::RunLoop run_loop; auto operation = make_scoped_ptr(new TwoPhaseReadDataOperation( - consumer_.Pass(), - &message_loop_, - run_loop.QuitClosure())); + std::move(consumer_), &message_loop_, run_loop.QuitClosure())); base::Thread t("DataConsumerHandle test thread"); ASSERT_TRUE(t.Start()); diff --git a/content/child/web_discardable_memory_impl.cc b/content/child/web_discardable_memory_impl.cc index 18042b2..a92083c 100644 --- a/content/child/web_discardable_memory_impl.cc +++ b/content/child/web_discardable_memory_impl.cc @@ -4,6 +4,8 @@ #include "content/child/web_discardable_memory_impl.h" +#include <utility> + #include "base/memory/discardable_memory.h" #include "base/memory/discardable_memory_allocator.h" #include "content/child/web_process_memory_dump_impl.h" @@ -43,7 +45,6 @@ WebDiscardableMemoryImpl::createMemoryAllocatorDump( WebDiscardableMemoryImpl::WebDiscardableMemoryImpl( scoped_ptr<base::DiscardableMemory> memory) - : discardable_(memory.Pass()) { -} + : discardable_(std::move(memory)) {} } // namespace content diff --git a/content/child/web_process_memory_dump_impl.cc b/content/child/web_process_memory_dump_impl.cc index 47e9d1a..c8c3ca7 100644 --- a/content/child/web_process_memory_dump_impl.cc +++ b/content/child/web_process_memory_dump_impl.cc @@ -114,7 +114,7 @@ void WebProcessMemoryDumpImpl::takeAllDumpsFrom( first_entry->first; memory_allocator_dumps_.set( memory_allocator_dump, - other_impl->memory_allocator_dumps_.take_and_erase(first_entry).Pass()); + other_impl->memory_allocator_dumps_.take_and_erase(first_entry)); } DCHECK_EQ(expected_final_size, memory_allocator_dumps_.size()); DCHECK(other_impl->memory_allocator_dumps_.empty()); diff --git a/content/child/web_url_loader_impl.cc b/content/child/web_url_loader_impl.cc index 8ab7e9b..9eedbf7 100644 --- a/content/child/web_url_loader_impl.cc +++ b/content/child/web_url_loader_impl.cc @@ -5,9 +5,9 @@ #include "content/child/web_url_loader_impl.h" #include <stdint.h> - #include <algorithm> #include <string> +#include <utility> #include "base/bind.h" #include "base/files/file_path.h" @@ -341,11 +341,10 @@ WebURLLoaderImpl::Context::Context( : loader_(loader), client_(NULL), resource_dispatcher_(resource_dispatcher), - web_task_runner_(web_task_runner.Pass()), + web_task_runner_(std::move(web_task_runner)), referrer_policy_(blink::WebReferrerPolicyDefault), defers_loading_(NOT_DEFERRING), - request_id_(-1) { -} + request_id_(-1) {} void WebURLLoaderImpl::Context::Cancel() { if (resource_dispatcher_ && // NULL in unittest. @@ -520,7 +519,7 @@ void WebURLLoaderImpl::Context::Start(const WebURLRequest& request, void WebURLLoaderImpl::Context::SetWebTaskRunner( scoped_ptr<blink::WebTaskRunner> web_task_runner) { - web_task_runner_ = web_task_runner.Pass(); + web_task_runner_ = std::move(web_task_runner); } void WebURLLoaderImpl::Context::OnUploadProgress(uint64_t position, @@ -700,7 +699,7 @@ void WebURLLoaderImpl::Context::OnReceivedData(scoped_ptr<ReceivedData> data) { // We don't support ftp_listening_delegate_ and multipart_delegate_ for // now. // TODO(yhirano): Support ftp listening and multipart. - body_stream_writer_->AddData(data.Pass()); + body_stream_writer_->AddData(std::move(data)); } } } @@ -763,7 +762,7 @@ void WebURLLoaderImpl::Context::OnReceivedCompletedResponse( OnReceivedResponse(info); if (data) - OnReceivedData(data.Pass()); + OnReceivedData(std::move(data)); OnCompletedRequest(error_code, was_ignored_by_handler, stale_copy_in_cache, security_info, completion_time, total_transfer_size); } @@ -869,8 +868,8 @@ void WebURLLoaderImpl::Context::HandleDataURL() { WebURLLoaderImpl::WebURLLoaderImpl( ResourceDispatcher* resource_dispatcher, scoped_ptr<blink::WebTaskRunner> web_task_runner) - : context_(new Context(this, resource_dispatcher, web_task_runner.Pass())) { -} + : context_( + new Context(this, resource_dispatcher, std::move(web_task_runner))) {} WebURLLoaderImpl::~WebURLLoaderImpl() { cancel(); diff --git a/content/child/web_url_loader_impl_unittest.cc b/content/child/web_url_loader_impl_unittest.cc index 36edb37..10676a0 100644 --- a/content/child/web_url_loader_impl_unittest.cc +++ b/content/child/web_url_loader_impl_unittest.cc @@ -6,6 +6,7 @@ #include <stdint.h> #include <string.h> +#include <utility> #include <vector> #include "base/command_line.h" @@ -692,7 +693,7 @@ TEST_F(WebURLLoaderImplTest, BrowserSideNavigationCommit) { stream_override->stream_url = kStreamURL; stream_override->response.mime_type = kMimeType; RequestExtraData* extra_data = new RequestExtraData(); - extra_data->set_stream_override(stream_override.Pass()); + extra_data->set_stream_override(std::move(stream_override)); request.setExtraData(extra_data); base::CommandLine::ForCurrentProcess()->AppendSwitch( switches::kEnableBrowserSideNavigation); diff --git a/content/child/webmessageportchannel_impl.cc b/content/child/webmessageportchannel_impl.cc index 7b89370..6fdd08c 100644 --- a/content/child/webmessageportchannel_impl.cc +++ b/content/child/webmessageportchannel_impl.cc @@ -5,6 +5,7 @@ #include "content/child/webmessageportchannel_impl.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/values.h" @@ -184,14 +185,14 @@ void WebMessagePortChannelImpl::postMessage( converter->SetRegExpAllowed(true); scoped_ptr<base::Value> message_as_value(converter->FromV8Value( v8_value, v8::Isolate::GetCurrent()->GetCurrentContext())); - message = MessagePortMessage(message_as_value.Pass()); + message = MessagePortMessage(std::move(message_as_value)); } if (!main_thread_task_runner_->BelongsToCurrentThread()) { main_thread_task_runner_->PostTask( FROM_HERE, base::Bind(&WebMessagePortChannelImpl::PostMessage, this, - message, base::Passed(channels.Pass()))); + message, base::Passed(std::move(channels)))); } else { - PostMessage(message, channels.Pass()); + PostMessage(message, std::move(channels)); } } @@ -199,7 +200,7 @@ void WebMessagePortChannelImpl::PostMessage( const MessagePortMessage& message, scoped_ptr<WebMessagePortChannelArray> channels) { IPC::Message* msg = new MessagePortHostMsg_PostMessage( - message_port_id_, message, ExtractMessagePortIDs(channels.Pass())); + message_port_id_, message, ExtractMessagePortIDs(std::move(channels))); Send(msg); } diff --git a/content/common/cc_messages.cc b/content/common/cc_messages.cc index e31067d..7072946 100644 --- a/content/common/cc_messages.cc +++ b/content/common/cc_messages.cc @@ -5,6 +5,7 @@ #include "content/common/cc_messages.h" #include <stddef.h> +#include <utility> #include "cc/output/compositor_frame.h" #include "cc/output/filter_operations.h" @@ -728,7 +729,7 @@ bool ParamTraits<cc::DelegatedFrameData>::Read(const Message* m, return false; } pass_set.insert(render_pass->id); - p->render_pass_list.push_back(render_pass.Pass()); + p->render_pass_list.push_back(std::move(render_pass)); } return true; } diff --git a/content/common/cc_messages_perftest.cc b/content/common/cc_messages_perftest.cc index 0251354c..cec2a78 100644 --- a/content/common/cc_messages_perftest.cc +++ b/content/common/cc_messages_perftest.cc @@ -4,6 +4,8 @@ #include "content/common/cc_messages.h" +#include <utility> + #include "base/test/launcher/unit_test_launcher.h" #include "base/test/test_suite.h" #include "cc/output/compositor_frame.h" @@ -74,7 +76,8 @@ TEST_F(CCMessagesPerfTest, DelegatedFrame_ManyQuads_1_4000) { } frame->delegated_frame_data.reset(new DelegatedFrameData); - frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back( + std::move(render_pass)); RunTest("DelegatedFrame_ManyQuads_1_4000", *frame); } @@ -91,7 +94,8 @@ TEST_F(CCMessagesPerfTest, DelegatedFrame_ManyQuads_1_100000) { } frame->delegated_frame_data.reset(new DelegatedFrameData); - frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back( + std::move(render_pass)); RunTest("DelegatedFrame_ManyQuads_1_100000", *frame); } @@ -108,7 +112,8 @@ TEST_F(CCMessagesPerfTest, DelegatedFrame_ManyQuads_4000_4000) { } frame->delegated_frame_data.reset(new DelegatedFrameData); - frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back( + std::move(render_pass)); RunTest("DelegatedFrame_ManyQuads_4000_4000", *frame); } @@ -125,7 +130,8 @@ TEST_F(CCMessagesPerfTest, DelegatedFrame_ManyQuads_100000_100000) { } frame->delegated_frame_data.reset(new DelegatedFrameData); - frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back( + std::move(render_pass)); RunTest("DelegatedFrame_ManyQuads_100000_100000", *frame); } @@ -143,7 +149,8 @@ TEST_F(CCMessagesPerfTest, render_pass->CreateAndAppendDrawQuad<PictureDrawQuad>(); quad->shared_quad_state = render_pass->shared_quad_state_list.back(); } - frame->delegated_frame_data->render_pass_list.push_back(render_pass.Pass()); + frame->delegated_frame_data->render_pass_list.push_back( + std::move(render_pass)); } RunTest("DelegatedFrame_ManyRenderPasses_10000_100", *frame); diff --git a/content/common/cc_messages_unittest.cc b/content/common/cc_messages_unittest.cc index d7f12cc..799c39ff 100644 --- a/content/common/cc_messages_unittest.cc +++ b/content/common/cc_messages_unittest.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <string.h> - #include <algorithm> +#include <utility> #include "base/macros.h" #include "build/build_config.h" @@ -468,8 +468,8 @@ TEST_F(CCMessagesTest, AllQuads) { } DelegatedFrameData frame_in; - frame_in.render_pass_list.push_back(child_pass_in.Pass()); - frame_in.render_pass_list.push_back(pass_in.Pass()); + frame_in.render_pass_list.push_back(std::move(child_pass_in)); + frame_in.render_pass_list.push_back(std::move(pass_in)); IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); @@ -479,11 +479,12 @@ TEST_F(CCMessagesTest, AllQuads) { &iter, &frame_out)); // Make sure the out and cmp RenderPasses match. - scoped_ptr<RenderPass> child_pass_out = frame_out.render_pass_list[0].Pass(); + scoped_ptr<RenderPass> child_pass_out = + std::move(frame_out.render_pass_list[0]); Compare(child_pass_cmp.get(), child_pass_out.get()); ASSERT_EQ(0u, child_pass_out->shared_quad_state_list.size()); ASSERT_EQ(0u, child_pass_out->quad_list.size()); - scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list[1].Pass(); + scoped_ptr<RenderPass> pass_out = std::move(frame_out.render_pass_list[1]); Compare(pass_cmp.get(), pass_out.get()); ASSERT_EQ(3u, pass_out->shared_quad_state_list.size()); ASSERT_EQ(9u, pass_out->quad_list.size()); @@ -588,7 +589,7 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) { ASSERT_EQ(2u, pass_in->quad_list.size()); DelegatedFrameData frame_in; - frame_in.render_pass_list.push_back(pass_in.Pass()); + frame_in.render_pass_list.push_back(std::move(pass_in)); IPC::Message msg(1, 2, IPC::Message::PRIORITY_NORMAL); IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); @@ -598,7 +599,7 @@ TEST_F(CCMessagesTest, UnusedSharedQuadStates) { EXPECT_TRUE( IPC::ParamTraits<DelegatedFrameData>::Read(&msg, &iter, &frame_out)); - scoped_ptr<RenderPass> pass_out = frame_out.render_pass_list[0].Pass(); + scoped_ptr<RenderPass> pass_out = std::move(frame_out.render_pass_list[0]); // 2 SharedQuadStates come out. The first and fourth SharedQuadStates were // used by quads, and so serialized. Others were not. @@ -656,7 +657,7 @@ TEST_F(CCMessagesTest, Resources) { DelegatedFrameData frame_in; frame_in.resource_list.push_back(arbitrary_resource1); frame_in.resource_list.push_back(arbitrary_resource2); - frame_in.render_pass_list.push_back(renderpass_in.Pass()); + frame_in.render_pass_list.push_back(std::move(renderpass_in)); IPC::ParamTraits<DelegatedFrameData>::Write(&msg, frame_in); diff --git a/content/common/discardable_shared_memory_heap.cc b/content/common/discardable_shared_memory_heap.cc index 9b62df3..263f83b 100644 --- a/content/common/discardable_shared_memory_heap.cc +++ b/content/common/discardable_shared_memory_heap.cc @@ -5,6 +5,7 @@ #include "content/common/discardable_shared_memory_heap.h" #include <algorithm> +#include <utility> #include "base/format_macros.h" #include "base/macros.h" @@ -44,11 +45,10 @@ DiscardableSharedMemoryHeap::ScopedMemorySegment::ScopedMemorySegment( int32_t id, const base::Closure& deleted_callback) : heap_(heap), - shared_memory_(shared_memory.Pass()), + shared_memory_(std::move(shared_memory)), size_(size), id_(id), - deleted_callback_(deleted_callback) { -} + deleted_callback_(deleted_callback) {} DiscardableSharedMemoryHeap::ScopedMemorySegment::~ScopedMemorySegment() { heap_->ReleaseMemory(shared_memory_.get(), size_); @@ -131,9 +131,9 @@ scoped_ptr<DiscardableSharedMemoryHeap::Span> DiscardableSharedMemoryHeap::Grow( // Start tracking if segment is resident by adding it to |memory_segments_|. memory_segments_.push_back(new ScopedMemorySegment( - this, shared_memory.Pass(), size, id, deleted_callback)); + this, std::move(shared_memory), size, id, deleted_callback)); - return span.Pass(); + return span; } void DiscardableSharedMemoryHeap::MergeIntoFreeLists(scoped_ptr<Span> span) { @@ -167,7 +167,7 @@ void DiscardableSharedMemoryHeap::MergeIntoFreeLists(scoped_ptr<Span> span) { spans_[span->start_ + span->length_ - 1] = span.get(); } - InsertIntoFreeList(span.Pass()); + InsertIntoFreeList(std::move(span)); } scoped_ptr<DiscardableSharedMemoryHeap::Span> @@ -182,7 +182,7 @@ DiscardableSharedMemoryHeap::Split(Span* span, size_t blocks) { RegisterSpan(leftover.get()); spans_[span->start_ + blocks - 1] = span; span->length_ = blocks; - return leftover.Pass(); + return leftover; } scoped_ptr<DiscardableSharedMemoryHeap::Span> @@ -288,7 +288,7 @@ DiscardableSharedMemoryHeap::Carve(Span* span, size_t blocks) { // No need to coalesce as the previous span of |leftover| was just split // and the next span of |leftover| was not previously coalesced with // |span|. - InsertIntoFreeList(leftover.Pass()); + InsertIntoFreeList(std::move(leftover)); serving->length_ = blocks; spans_[serving->start_ + blocks - 1] = serving.get(); @@ -299,7 +299,7 @@ DiscardableSharedMemoryHeap::Carve(Span* span, size_t blocks) { DCHECK_GE(num_free_blocks_, serving->length_); num_free_blocks_ -= serving->length_; - return serving.Pass(); + return serving; } void DiscardableSharedMemoryHeap::RegisterSpan(Span* span) { diff --git a/content/common/discardable_shared_memory_heap_unittest.cc b/content/common/discardable_shared_memory_heap_unittest.cc index 318f528..b2fc22f 100644 --- a/content/common/discardable_shared_memory_heap_unittest.cc +++ b/content/common/discardable_shared_memory_heap_unittest.cc @@ -5,6 +5,7 @@ #include "content/common/discardable_shared_memory_heap.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/memory/discardable_shared_memory.h" @@ -40,8 +41,8 @@ TEST(DiscardableSharedMemoryHeapTest, Basic) { // Create new span for memory. scoped_ptr<DiscardableSharedMemoryHeap::Span> new_span( - heap.Grow(memory.Pass(), memory_size, next_discardable_shared_memory_id++, - base::Bind(NullTask))); + heap.Grow(std::move(memory), memory_size, + next_discardable_shared_memory_id++, base::Bind(NullTask))); // Size should match |memory_size|. EXPECT_EQ(memory_size, heap.GetSize()); @@ -53,7 +54,7 @@ TEST(DiscardableSharedMemoryHeapTest, Basic) { EXPECT_FALSE(heap.SearchFreeLists(1, 0)); // Done using |new_span|. Merge it into the free lists. - heap.MergeIntoFreeLists(new_span.Pass()); + heap.MergeIntoFreeLists(std::move(new_span)); // Size of free lists should now match |memory_size|. EXPECT_EQ(memory_size, heap.GetSizeOfFreeLists()); @@ -70,7 +71,7 @@ TEST(DiscardableSharedMemoryHeapTest, Basic) { EXPECT_FALSE(heap.SearchFreeLists(1, 0)); // Merge it into the free lists again. - heap.MergeIntoFreeLists(span.Pass()); + heap.MergeIntoFreeLists(std::move(span)); } TEST(DiscardableSharedMemoryHeapTest, SplitAndMerge) { @@ -85,8 +86,8 @@ TEST(DiscardableSharedMemoryHeapTest, SplitAndMerge) { new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(memory_size)); scoped_ptr<DiscardableSharedMemoryHeap::Span> new_span( - heap.Grow(memory.Pass(), memory_size, next_discardable_shared_memory_id++, - base::Bind(NullTask))); + heap.Grow(std::move(memory), memory_size, + next_discardable_shared_memory_id++, base::Bind(NullTask))); // Split span into two. scoped_ptr<DiscardableSharedMemoryHeap::Span> leftover = @@ -94,13 +95,13 @@ TEST(DiscardableSharedMemoryHeapTest, SplitAndMerge) { ASSERT_TRUE(leftover); // Merge |leftover| into free lists. - heap.MergeIntoFreeLists(leftover.Pass()); + heap.MergeIntoFreeLists(std::move(leftover)); // Some of the memory is still in use. EXPECT_FALSE(heap.SearchFreeLists(kBlocks, 0)); // Merge |span| into free lists. - heap.MergeIntoFreeLists(new_span.Pass()); + heap.MergeIntoFreeLists(std::move(new_span)); // Remove a 2 page span from free lists. scoped_ptr<DiscardableSharedMemoryHeap::Span> span1 = @@ -113,13 +114,13 @@ TEST(DiscardableSharedMemoryHeapTest, SplitAndMerge) { ASSERT_TRUE(span2); // Merge |span1| back into free lists. - heap.MergeIntoFreeLists(span1.Pass()); + heap.MergeIntoFreeLists(std::move(span1)); // Some of the memory is still in use. EXPECT_FALSE(heap.SearchFreeLists(kBlocks, 0)); // Merge |span2| back into free lists. - heap.MergeIntoFreeLists(span2.Pass()); + heap.MergeIntoFreeLists(std::move(span2)); // All memory has been returned to the free lists. scoped_ptr<DiscardableSharedMemoryHeap::Span> large_span = @@ -127,7 +128,7 @@ TEST(DiscardableSharedMemoryHeapTest, SplitAndMerge) { ASSERT_TRUE(large_span); // Merge it into the free lists again. - heap.MergeIntoFreeLists(large_span.Pass()); + heap.MergeIntoFreeLists(std::move(large_span)); } TEST(DiscardableSharedMemoryHeapTest, MergeSingleBlockSpan) { @@ -142,8 +143,8 @@ TEST(DiscardableSharedMemoryHeapTest, MergeSingleBlockSpan) { new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(memory_size)); scoped_ptr<DiscardableSharedMemoryHeap::Span> new_span( - heap.Grow(memory.Pass(), memory_size, next_discardable_shared_memory_id++, - base::Bind(NullTask))); + heap.Grow(std::move(memory), memory_size, + next_discardable_shared_memory_id++, base::Bind(NullTask))); // Split span into two. scoped_ptr<DiscardableSharedMemoryHeap::Span> leftover = @@ -151,10 +152,10 @@ TEST(DiscardableSharedMemoryHeapTest, MergeSingleBlockSpan) { ASSERT_TRUE(leftover); // Merge |new_span| into free lists. - heap.MergeIntoFreeLists(new_span.Pass()); + heap.MergeIntoFreeLists(std::move(new_span)); // Merge |leftover| into free lists. - heap.MergeIntoFreeLists(leftover.Pass()); + heap.MergeIntoFreeLists(std::move(leftover)); } TEST(DiscardableSharedMemoryHeapTest, Grow) { @@ -165,9 +166,9 @@ TEST(DiscardableSharedMemoryHeapTest, Grow) { scoped_ptr<base::DiscardableSharedMemory> memory1( new base::DiscardableSharedMemory); ASSERT_TRUE(memory1->CreateAndMap(block_size)); - heap.MergeIntoFreeLists(heap.Grow(memory1.Pass(), block_size, + heap.MergeIntoFreeLists(heap.Grow(std::move(memory1), block_size, next_discardable_shared_memory_id++, - base::Bind(NullTask)).Pass()); + base::Bind(NullTask))); // Remove a span from free lists. scoped_ptr<DiscardableSharedMemoryHeap::Span> span1 = @@ -181,9 +182,9 @@ TEST(DiscardableSharedMemoryHeapTest, Grow) { scoped_ptr<base::DiscardableSharedMemory> memory2( new base::DiscardableSharedMemory); ASSERT_TRUE(memory2->CreateAndMap(block_size)); - heap.MergeIntoFreeLists(heap.Grow(memory2.Pass(), block_size, + heap.MergeIntoFreeLists(heap.Grow(std::move(memory2), block_size, next_discardable_shared_memory_id++, - base::Bind(NullTask)).Pass()); + base::Bind(NullTask))); // Memory should now be available. scoped_ptr<DiscardableSharedMemoryHeap::Span> span2 = @@ -191,8 +192,8 @@ TEST(DiscardableSharedMemoryHeapTest, Grow) { EXPECT_TRUE(span2); // Merge spans into the free lists again. - heap.MergeIntoFreeLists(span1.Pass()); - heap.MergeIntoFreeLists(span2.Pass()); + heap.MergeIntoFreeLists(std::move(span1)); + heap.MergeIntoFreeLists(std::move(span2)); } TEST(DiscardableSharedMemoryHeapTest, ReleaseFreeMemory) { @@ -204,8 +205,8 @@ TEST(DiscardableSharedMemoryHeapTest, ReleaseFreeMemory) { new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(block_size)); scoped_ptr<DiscardableSharedMemoryHeap::Span> span = - heap.Grow(memory.Pass(), block_size, next_discardable_shared_memory_id++, - base::Bind(NullTask)); + heap.Grow(std::move(memory), block_size, + next_discardable_shared_memory_id++, base::Bind(NullTask)); // Free lists should be empty. EXPECT_EQ(0u, heap.GetSizeOfFreeLists()); @@ -215,7 +216,7 @@ TEST(DiscardableSharedMemoryHeapTest, ReleaseFreeMemory) { // Size should still match |block_size|. EXPECT_EQ(block_size, heap.GetSize()); - heap.MergeIntoFreeLists(span.Pass()); + heap.MergeIntoFreeLists(std::move(span)); heap.ReleaseFreeMemory(); // Memory should have been released. @@ -232,8 +233,8 @@ TEST(DiscardableSharedMemoryHeapTest, ReleasePurgedMemory) { new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(block_size)); scoped_ptr<DiscardableSharedMemoryHeap::Span> span = - heap.Grow(memory.Pass(), block_size, next_discardable_shared_memory_id++, - base::Bind(NullTask)); + heap.Grow(std::move(memory), block_size, + next_discardable_shared_memory_id++, base::Bind(NullTask)); // Unlock memory so it can be purged. span->shared_memory()->Unlock(0, 0); @@ -261,9 +262,9 @@ TEST(DiscardableSharedMemoryHeapTest, Slack) { scoped_ptr<base::DiscardableSharedMemory> memory( new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(memory_size)); - heap.MergeIntoFreeLists(heap.Grow(memory.Pass(), memory_size, + heap.MergeIntoFreeLists(heap.Grow(std::move(memory), memory_size, next_discardable_shared_memory_id++, - base::Bind(NullTask)).Pass()); + base::Bind(NullTask))); // No free span that is less or equal to 3 + 1. EXPECT_FALSE(heap.SearchFreeLists(3, 1)); @@ -278,7 +279,7 @@ TEST(DiscardableSharedMemoryHeapTest, Slack) { heap.SearchFreeLists(1, 5); EXPECT_TRUE(span); - heap.MergeIntoFreeLists(span.Pass()); + heap.MergeIntoFreeLists(std::move(span)); } void OnDeleted(bool* deleted) { @@ -294,11 +295,11 @@ TEST(DiscardableSharedMemoryHeapTest, DeletedCallback) { new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(block_size)); bool deleted = false; - scoped_ptr<DiscardableSharedMemoryHeap::Span> span = - heap.Grow(memory.Pass(), block_size, next_discardable_shared_memory_id++, - base::Bind(OnDeleted, base::Unretained(&deleted))); + scoped_ptr<DiscardableSharedMemoryHeap::Span> span = heap.Grow( + std::move(memory), block_size, next_discardable_shared_memory_id++, + base::Bind(OnDeleted, base::Unretained(&deleted))); - heap.MergeIntoFreeLists(span.Pass()); + heap.MergeIntoFreeLists(std::move(span)); heap.ReleaseFreeMemory(); EXPECT_TRUE(deleted); @@ -313,8 +314,8 @@ TEST(DiscardableSharedMemoryHeapTest, CreateMemoryAllocatorDumpTest) { new base::DiscardableSharedMemory); ASSERT_TRUE(memory->CreateAndMap(block_size)); scoped_ptr<DiscardableSharedMemoryHeap::Span> span = - heap.Grow(memory.Pass(), block_size, next_discardable_shared_memory_id++, - base::Bind(NullTask)); + heap.Grow(std::move(memory), block_size, + next_discardable_shared_memory_id++, base::Bind(NullTask)); // Check if allocator dump is created when span exists. scoped_ptr<base::trace_event::ProcessMemoryDump> pmd( diff --git a/content/common/font_list_pango.cc b/content/common/font_list_pango.cc index 7a67b3c..15f21dc 100644 --- a/content/common/font_list_pango.cc +++ b/content/common/font_list_pango.cc @@ -37,7 +37,7 @@ scoped_ptr<base::ListValue> GetFontList_SlowBlocking() { font_list->Append(font_item); } - return font_list.Pass(); + return font_list; } } // namespace content diff --git a/content/common/gpu/client/command_buffer_proxy_impl.cc b/content/common/gpu/client/command_buffer_proxy_impl.cc index ded3baf..1a60495 100644 --- a/content/common/gpu/client/command_buffer_proxy_impl.cc +++ b/content/common/gpu/client/command_buffer_proxy_impl.cc @@ -4,6 +4,7 @@ #include "content/common/gpu/client/command_buffer_proxy_impl.h" +#include <utility> #include <vector> #include "base/callback.h" @@ -383,7 +384,7 @@ scoped_refptr<gpu::Buffer> CommandBufferProxyImpl::CreateTransferBuffer( *id = new_id; scoped_refptr<gpu::Buffer> buffer( - gpu::MakeBufferFromSharedMemory(shared_memory.Pass(), size)); + gpu::MakeBufferFromSharedMemory(std::move(shared_memory), size)); return buffer; } diff --git a/content/common/gpu/client/context_provider_command_buffer.cc b/content/common/gpu/client/context_provider_command_buffer.cc index c9b57d8..2560d78 100644 --- a/content/common/gpu/client/context_provider_command_buffer.cc +++ b/content/common/gpu/client/context_provider_command_buffer.cc @@ -5,8 +5,8 @@ #include "content/common/gpu/client/context_provider_command_buffer.h" #include <stddef.h> - #include <set> +#include <utility> #include <vector> #include "base/callback_helpers.h" @@ -43,7 +43,7 @@ ContextProviderCommandBuffer::Create( if (!context3d) return NULL; - return new ContextProviderCommandBuffer(context3d.Pass(), type); + return new ContextProviderCommandBuffer(std::move(context3d), type); } ContextProviderCommandBuffer::ContextProviderCommandBuffer( @@ -51,8 +51,8 @@ ContextProviderCommandBuffer::ContextProviderCommandBuffer( CommandBufferContextType type) : context_type_(type), debug_name_(CommandBufferContextTypeToString(type)) { - gr_interface_ = skia::AdoptRef(new GrGLInterfaceForWebGraphicsContext3D( - context3d.Pass())); + gr_interface_ = skia::AdoptRef( + new GrGLInterfaceForWebGraphicsContext3D(std::move(context3d))); DCHECK(main_thread_checker_.CalledOnValidThread()); DCHECK(gr_interface_->WebContext3D()); context_thread_checker_.DetachFromThread(); diff --git a/content/common/gpu/client/gl_helper_unittest.cc b/content/common/gpu/client/gl_helper_unittest.cc index 0044991..1a3a352 100644 --- a/content/common/gpu/client/gl_helper_unittest.cc +++ b/content/common/gpu/client/gl_helper_unittest.cc @@ -702,7 +702,7 @@ class GLHelperTest : public testing::Test { } } } - return bitmap.Pass(); + return bitmap; } // Binds texture and framebuffer and loads the bitmap pixels into the texture. @@ -741,7 +741,7 @@ class GLHelperTest : public testing::Test { WebGLId src_texture = context_->createTexture(); WebGLId framebuffer = context_->createFramebuffer(); scoped_ptr<SkBitmap> input_pixels = - CreateTestBitmap(xsize, ysize, test_pattern).Pass(); + CreateTestBitmap(xsize, ysize, test_pattern); BindTextureAndFrameBuffer( src_texture, framebuffer, input_pixels.get(), xsize, ysize); @@ -835,7 +835,7 @@ class GLHelperTest : public testing::Test { WebGLId src_texture = context_->createTexture(); WebGLId framebuffer = context_->createFramebuffer(); scoped_ptr<SkBitmap> input_pixels = - CreateTestBitmap(xsize, ysize, test_pattern).Pass(); + CreateTestBitmap(xsize, ysize, test_pattern); BindTextureAndFrameBuffer( src_texture, framebuffer, input_pixels.get(), xsize, ysize); diff --git a/content/common/gpu/client/gpu_channel_host.cc b/content/common/gpu/client/gpu_channel_host.cc index 43bd544..25328f4 100644 --- a/content/common/gpu/client/gpu_channel_host.cc +++ b/content/common/gpu/client/gpu_channel_host.cc @@ -5,6 +5,7 @@ #include "content/common/gpu/client/gpu_channel_host.h" #include <algorithm> +#include <utility> #include "base/atomic_sequence_num.h" #include "base/bind.h" @@ -237,7 +238,7 @@ scoped_ptr<CommandBufferProxyImpl> GpuChannelHost::CreateViewCommandBuffer( make_scoped_ptr(new CommandBufferProxyImpl(this, route_id, stream_id)); AddRoute(route_id, command_buffer->AsWeakPtr()); - return command_buffer.Pass(); + return command_buffer; } scoped_ptr<CommandBufferProxyImpl> GpuChannelHost::CreateOffscreenCommandBuffer( @@ -279,7 +280,7 @@ scoped_ptr<CommandBufferProxyImpl> GpuChannelHost::CreateOffscreenCommandBuffer( make_scoped_ptr(new CommandBufferProxyImpl(this, route_id, stream_id)); AddRoute(route_id, command_buffer->AsWeakPtr()); - return command_buffer.Pass(); + return command_buffer; } scoped_ptr<media::JpegDecodeAccelerator> GpuChannelHost::CreateJpegDecoder( @@ -301,7 +302,7 @@ scoped_ptr<media::JpegDecodeAccelerator> GpuChannelHost::CreateJpegDecoder( channel_filter_.get(), route_id, decoder->GetReceiver(), io_task_runner)); - return decoder.Pass(); + return std::move(decoder); } void GpuChannelHost::DestroyCommandBuffer( diff --git a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc index 0c180c1..83781ae 100644 --- a/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc +++ b/content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.cc @@ -5,6 +5,7 @@ #include "content/common/gpu/client/gpu_memory_buffer_impl_shared_memory.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/numerics/safe_math.h" @@ -28,7 +29,7 @@ GpuMemoryBufferImplSharedMemory::GpuMemoryBufferImplSharedMemory( size_t offset, int stride) : GpuMemoryBufferImpl(id, size, format, callback), - shared_memory_(shared_memory.Pass()), + shared_memory_(std::move(shared_memory)), offset_(offset), stride_(stride) { DCHECK(IsSizeValidForFormat(size, format)); @@ -52,7 +53,7 @@ GpuMemoryBufferImplSharedMemory::Create(gfx::GpuMemoryBufferId id, return nullptr; return make_scoped_ptr(new GpuMemoryBufferImplSharedMemory( - id, size, format, callback, shared_memory.Pass(), 0, + id, size, format, callback, std::move(shared_memory), 0, gfx::RowSizeForBufferFormat(size.width(), format, 0))); } diff --git a/content/common/gpu/client/grcontext_for_webgraphicscontext3d.cc b/content/common/gpu/client/grcontext_for_webgraphicscontext3d.cc index 492b42e..5cd4944 100644 --- a/content/common/gpu/client/grcontext_for_webgraphicscontext3d.cc +++ b/content/common/gpu/client/grcontext_for_webgraphicscontext3d.cc @@ -6,6 +6,7 @@ #include <stddef.h> #include <string.h> +#include <utility> #include "base/lazy_instance.h" #include "base/macros.h" @@ -89,8 +90,7 @@ void GrContextForWebGraphicsContext3D::FreeGpuResources() { GrGLInterfaceForWebGraphicsContext3D::GrGLInterfaceForWebGraphicsContext3D( scoped_ptr<gpu_blink::WebGraphicsContext3DImpl> context3d) - : context3d_(context3d.Pass()) { -} + : context3d_(std::move(context3d)) {} void GrGLInterfaceForWebGraphicsContext3D::BindToCurrentThread() { context_thread_checker_.DetachFromThread(); diff --git a/content/common/gpu/gpu_channel.cc b/content/common/gpu/gpu_channel.cc index b5e9aec..c8c11a4 100644 --- a/content/common/gpu/gpu_channel.cc +++ b/content/common/gpu/gpu_channel.cc @@ -4,6 +4,8 @@ #include "content/common/gpu/gpu_channel.h" +#include <utility> + #if defined(OS_WIN) #include <windows.h> #endif @@ -127,7 +129,7 @@ bool GpuChannelMessageQueue::GenerateSyncPointMessage( msg->retire_sync_point = retire_sync_point; msg->sync_point = *sync_point; - PushMessageHelper(msg.Pass()); + PushMessageHelper(std::move(msg)); return true; } return false; @@ -745,7 +747,7 @@ CreateCommandBufferResult GpuChannel::CreateViewCommandBuffer( streams_.insert(std::make_pair(stream_id, stream)); } - stubs_.set(route_id, stub.Pass()); + stubs_.set(route_id, std::move(stub)); return CREATE_COMMAND_BUFFER_SUCCEEDED; } @@ -964,7 +966,7 @@ void GpuChannel::OnCreateOffscreenCommandBuffer( streams_.insert(std::make_pair(stream_id, stream)); } - stubs_.set(route_id, stub.Pass()); + stubs_.set(route_id, std::move(stub)); *succeeded = true; } diff --git a/content/common/gpu/gpu_channel_manager.cc b/content/common/gpu/gpu_channel_manager.cc index d5cf8c8..4dd1027 100644 --- a/content/common/gpu/gpu_channel_manager.cc +++ b/content/common/gpu/gpu_channel_manager.cc @@ -5,6 +5,7 @@ #include "content/common/gpu/gpu_channel_manager.h" #include <algorithm> +#include <utility> #include "base/bind.h" #include "base/command_line.h" @@ -180,7 +181,7 @@ void GpuChannelManager::OnEstablishChannel( channel->SetPreemptByFlag(preemption_flag_.get()); IPC::ChannelHandle channel_handle = channel->Init(shutdown_event_); - gpu_channels_.set(params.client_id, channel.Pass()); + gpu_channels_.set(params.client_id, std::move(channel)); Send(new GpuHostMsg_ChannelEstablished(channel_handle)); } diff --git a/content/common/gpu/gpu_command_buffer_stub.cc b/content/common/gpu/gpu_command_buffer_stub.cc index d21478d..8aabdca 100644 --- a/content/common/gpu/gpu_command_buffer_stub.cc +++ b/content/common/gpu/gpu_command_buffer_stub.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/common/gpu/gpu_command_buffer_stub.h" + +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/command_line.h" @@ -14,7 +18,6 @@ #include "build/build_config.h" #include "content/common/gpu/gpu_channel.h" #include "content/common/gpu/gpu_channel_manager.h" -#include "content/common/gpu/gpu_command_buffer_stub.h" #include "content/common/gpu/gpu_memory_manager.h" #include "content/common/gpu/gpu_memory_tracking.h" #include "content/common/gpu/gpu_messages.h" @@ -665,7 +668,7 @@ void GpuCommandBufferStub::OnInitialize( return; } command_buffer_->SetSharedStateBuffer(gpu::MakeBackingFromSharedMemory( - shared_state_shm.Pass(), kSharedStateSize)); + std::move(shared_state_shm), kSharedStateSize)); gpu::Capabilities capabilities = decoder_->GetCapabilities(); capabilities.future_sync_points = channel_->allow_future_sync_points(); @@ -859,7 +862,7 @@ void GpuCommandBufferStub::OnRegisterTransferBuffer( if (command_buffer_) { command_buffer_->RegisterTransferBuffer( - id, gpu::MakeBackingFromSharedMemory(shared_memory.Pass(), size)); + id, gpu::MakeBackingFromSharedMemory(std::move(shared_memory), size)); } } diff --git a/content/common/gpu/image_transport_surface.cc b/content/common/gpu/image_transport_surface.cc index 1866786..192ec96 100644 --- a/content/common/gpu/image_transport_surface.cc +++ b/content/common/gpu/image_transport_surface.cc @@ -5,6 +5,7 @@ #include "content/common/gpu/image_transport_surface.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/bind_helpers.h" @@ -171,7 +172,7 @@ void PassThroughImageTransportSurface::SetLatencyInfo( gfx::SwapResult PassThroughImageTransportSurface::SwapBuffers() { scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); gfx::SwapResult result = gfx::GLSurfaceAdapter::SwapBuffers(); - FinishSwapBuffers(latency_info.Pass(), result); + FinishSwapBuffers(std::move(latency_info), result); return result; } @@ -195,7 +196,7 @@ gfx::SwapResult PassThroughImageTransportSurface::PostSubBuffer(int x, scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); gfx::SwapResult result = gfx::GLSurfaceAdapter::PostSubBuffer(x, y, width, height); - FinishSwapBuffers(latency_info.Pass(), result); + FinishSwapBuffers(std::move(latency_info), result); return result; } @@ -216,7 +217,7 @@ void PassThroughImageTransportSurface::PostSubBufferAsync( gfx::SwapResult PassThroughImageTransportSurface::CommitOverlayPlanes() { scoped_ptr<std::vector<ui::LatencyInfo>> latency_info = StartSwapBuffers(); gfx::SwapResult result = gfx::GLSurfaceAdapter::CommitOverlayPlanes(); - FinishSwapBuffers(latency_info.Pass(), result); + FinishSwapBuffers(std::move(latency_info), result); return result; } @@ -294,7 +295,7 @@ void PassThroughImageTransportSurface::FinishSwapBuffersAsync( scoped_ptr<std::vector<ui::LatencyInfo>> latency_info, GLSurface::SwapCompletionCallback callback, gfx::SwapResult result) { - FinishSwapBuffers(latency_info.Pass(), result); + FinishSwapBuffers(std::move(latency_info), result); callback.Run(result); } diff --git a/content/common/gpu/media/gpu_jpeg_decode_accelerator.cc b/content/common/gpu/media/gpu_jpeg_decode_accelerator.cc index bb6d652..1082b5c 100644 --- a/content/common/gpu/media/gpu_jpeg_decode_accelerator.cc +++ b/content/common/gpu/media/gpu_jpeg_decode_accelerator.cc @@ -5,6 +5,7 @@ #include "content/common/gpu/media/gpu_jpeg_decode_accelerator.h" #include <stdint.h> +#include <utility> #include "base/bind.h" #include "base/containers/hash_tables.h" @@ -112,7 +113,7 @@ class GpuJpegDecodeAccelerator::Client void set_accelerator(scoped_ptr<media::JpegDecodeAccelerator> accelerator) { DCHECK(CalledOnValidThread()); - accelerator_ = accelerator.Pass(); + accelerator_ = std::move(accelerator); } private: @@ -343,7 +344,7 @@ void GpuJpegDecodeAccelerator::AddClient(int32_t route_id, scoped_ptr<media::JpegDecodeAccelerator> tmp_accelerator = (*create_jda_function)(io_task_runner_); if (tmp_accelerator && tmp_accelerator->Initialize(client.get())) { - accelerator = tmp_accelerator.Pass(); + accelerator = std::move(tmp_accelerator); break; } } @@ -354,7 +355,7 @@ void GpuJpegDecodeAccelerator::AddClient(int32_t route_id, Send(reply_msg); return; } - client->set_accelerator(accelerator.Pass()); + client->set_accelerator(std::move(accelerator)); if (!filter_) { DCHECK_EQ(client_number_, 0); @@ -409,7 +410,7 @@ GpuJpegDecodeAccelerator::CreateV4L2JDA( if (device) decoder.reset(new V4L2JpegDecodeAccelerator(device, io_task_runner)); #endif - return decoder.Pass(); + return decoder; } // static @@ -420,7 +421,7 @@ GpuJpegDecodeAccelerator::CreateVaapiJDA( #if defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) decoder.reset(new VaapiJpegDecodeAccelerator(io_task_runner)); #endif - return decoder.Pass(); + return decoder; } // static diff --git a/content/common/gpu/media/gpu_video_decode_accelerator.cc b/content/common/gpu/media/gpu_video_decode_accelerator.cc index 14ad3625..5424a5f 100644 --- a/content/common/gpu/media/gpu_video_decode_accelerator.cc +++ b/content/common/gpu/media/gpu_video_decode_accelerator.cc @@ -389,7 +389,7 @@ GpuVideoDecodeAccelerator::CreateDXVAVDA() { NOTIMPLEMENTED() << "HW video decode acceleration not available."; } #endif - return decoder.Pass(); + return decoder; } scoped_ptr<media::VideoDecodeAccelerator> @@ -407,7 +407,7 @@ GpuVideoDecodeAccelerator::CreateV4L2VDA() { io_task_runner_)); } #endif - return decoder.Pass(); + return decoder; } scoped_ptr<media::VideoDecodeAccelerator> @@ -425,7 +425,7 @@ GpuVideoDecodeAccelerator::CreateV4L2SliceVDA() { io_task_runner_)); } #endif - return decoder.Pass(); + return decoder; } void GpuVideoDecodeAccelerator::BindImage(uint32_t client_texture_id, @@ -449,7 +449,7 @@ GpuVideoDecodeAccelerator::CreateVaapiVDA() { make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage, base::Unretained(this)))); #endif - return decoder.Pass(); + return decoder; } scoped_ptr<media::VideoDecodeAccelerator> @@ -460,7 +460,7 @@ GpuVideoDecodeAccelerator::CreateVTVDA() { make_context_current_, base::Bind(&GpuVideoDecodeAccelerator::BindImage, base::Unretained(this)))); #endif - return decoder.Pass(); + return decoder; } scoped_ptr<media::VideoDecodeAccelerator> @@ -471,7 +471,7 @@ GpuVideoDecodeAccelerator::CreateOzoneVDA() { media::MediaOzonePlatform::GetInstance(); decoder.reset(platform->CreateVideoDecodeAccelerator(make_context_current_)); #endif - return decoder.Pass(); + return decoder; } scoped_ptr<media::VideoDecodeAccelerator> @@ -481,7 +481,7 @@ GpuVideoDecodeAccelerator::CreateAndroidVDA() { decoder.reset(new AndroidVideoDecodeAccelerator(stub_->decoder()->AsWeakPtr(), make_context_current_)); #endif - return decoder.Pass(); + return decoder; } void GpuVideoDecodeAccelerator::OnSetCdm(int cdm_id) { diff --git a/content/common/gpu/media/gpu_video_encode_accelerator.cc b/content/common/gpu/media/gpu_video_encode_accelerator.cc index 821fbd2..ff80628 100644 --- a/content/common/gpu/media/gpu_video_encode_accelerator.cc +++ b/content/common/gpu/media/gpu_video_encode_accelerator.cc @@ -213,7 +213,7 @@ GpuVideoEncodeAccelerator::CreateV4L2VEA() { if (device) encoder.reset(new V4L2VideoEncodeAccelerator(device)); #endif - return encoder.Pass(); + return encoder; } // static @@ -225,7 +225,7 @@ GpuVideoEncodeAccelerator::CreateVaapiVEA() { if (!cmd_line->HasSwitch(switches::kDisableVaapiAcceleratedVideoEncode)) encoder.reset(new VaapiVideoEncodeAccelerator()); #endif - return encoder.Pass(); + return encoder; } // static @@ -235,7 +235,7 @@ GpuVideoEncodeAccelerator::CreateAndroidVEA() { #if defined(OS_ANDROID) && defined(ENABLE_WEBRTC) encoder.reset(new AndroidVideoEncodeAccelerator()); #endif - return encoder.Pass(); + return encoder; } void GpuVideoEncodeAccelerator::OnEncode( diff --git a/content/common/host_discardable_shared_memory_manager.cc b/content/common/host_discardable_shared_memory_manager.cc index d897b71..a97cf7a 100644 --- a/content/common/host_discardable_shared_memory_manager.cc +++ b/content/common/host_discardable_shared_memory_manager.cc @@ -5,6 +5,7 @@ #include "content/common/host_discardable_shared_memory_manager.h" #include <algorithm> +#include <utility> #include "base/atomic_sequence_num.h" #include "base/bind.h" @@ -34,7 +35,7 @@ class DiscardableMemoryImpl : public base::DiscardableMemory { public: DiscardableMemoryImpl(scoped_ptr<base::DiscardableSharedMemory> shared_memory, const base::Closure& deleted_callback) - : shared_memory_(shared_memory.Pass()), + : shared_memory_(std::move(shared_memory)), deleted_callback_(deleted_callback), is_locked_(true) {} @@ -106,8 +107,7 @@ base::StaticAtomicSequenceNumber g_next_discardable_shared_memory_id; HostDiscardableSharedMemoryManager::MemorySegment::MemorySegment( scoped_ptr<base::DiscardableSharedMemory> memory) - : memory_(memory.Pass()) { -} + : memory_(std::move(memory)) {} HostDiscardableSharedMemoryManager::MemorySegment::~MemorySegment() { } @@ -167,7 +167,7 @@ HostDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory( // Close file descriptor to avoid running out. memory->Close(); return make_scoped_ptr(new DiscardableMemoryImpl( - memory.Pass(), + std::move(memory), base::Bind( &HostDiscardableSharedMemoryManager::DeletedDiscardableSharedMemory, base::Unretained(this), new_id, ChildProcessHost::kInvalidUniqueID))); @@ -346,7 +346,7 @@ void HostDiscardableSharedMemoryManager::AllocateLockedDiscardableSharedMemory( bytes_allocated_ = checked_bytes_allocated.ValueOrDie(); BytesAllocatedChanged(bytes_allocated_); - scoped_refptr<MemorySegment> segment(new MemorySegment(memory.Pass())); + scoped_refptr<MemorySegment> segment(new MemorySegment(std::move(memory))); process_segments[id] = segment.get(); segments_.push_back(segment.get()); std::push_heap(segments_.begin(), segments_.end(), CompareMemoryUsageTime); diff --git a/content/common/host_shared_bitmap_manager.cc b/content/common/host_shared_bitmap_manager.cc index 03b389a..d41ec39 100644 --- a/content/common/host_shared_bitmap_manager.cc +++ b/content/common/host_shared_bitmap_manager.cc @@ -5,6 +5,7 @@ #include "content/common/host_shared_bitmap_manager.h" #include <stdint.h> +#include <utility> #include "base/lazy_instance.h" #include "base/macros.h" @@ -232,7 +233,7 @@ void HostSharedBitmapManager::AllocateSharedBitmapForChild( scoped_refptr<BitmapData> data( new BitmapData(process_handle, buffer_size)); - data->memory = shared_memory.Pass(); + data->memory = std::move(shared_memory); handle_map_[id] = data; if (!data->memory->ShareToProcess(process_handle, shared_memory_handle)) { diff --git a/content/common/input/input_event_ack.cc b/content/common/input/input_event_ack.cc index 76ec577..27e5aa2 100644 --- a/content/common/input/input_event_ack.cc +++ b/content/common/input/input_event_ack.cc @@ -4,6 +4,8 @@ #include "content/common/input/input_event_ack.h" +#include <utility> + namespace content { InputEventAck::InputEventAck( @@ -15,7 +17,7 @@ InputEventAck::InputEventAck( : type(type), state(state), latency(latency), - overscroll(overscroll.Pass()), + overscroll(std::move(overscroll)), unique_touch_event_id(unique_touch_event_id) {} InputEventAck::InputEventAck(blink::WebInputEvent::Type type, diff --git a/content/common/input/input_param_traits.cc b/content/common/input/input_param_traits.cc index b0d079f..0402f43 100644 --- a/content/common/input/input_param_traits.cc +++ b/content/common/input/input_param_traits.cc @@ -4,6 +4,8 @@ #include "content/common/input/input_param_traits.h" +#include <utility> + #include "content/common/content_param_traits.h" #include "content/common/input/synthetic_pinch_gesture_params.h" #include "content/common/input/synthetic_smooth_drag_gesture_params.h" @@ -21,7 +23,7 @@ scoped_ptr<content::SyntheticGestureParams> ReadGestureParams( if (!ReadParam(m, iter, gesture_params.get())) return scoped_ptr<content::SyntheticGestureParams>(); - return gesture_params.Pass(); + return std::move(gesture_params); } } // namespace @@ -107,7 +109,7 @@ bool ParamTraits<content::SyntheticGesturePacket>::Read( return false; } - p->set_gesture_params(gesture_params.Pass()); + p->set_gesture_params(std::move(gesture_params)); return p->gesture_params() != NULL; } diff --git a/content/common/input/input_param_traits_unittest.cc b/content/common/input/input_param_traits_unittest.cc index 11c397e..0dd2b3d 100644 --- a/content/common/input/input_param_traits_unittest.cc +++ b/content/common/input/input_param_traits_unittest.cc @@ -5,6 +5,7 @@ #include "content/common/input/input_param_traits.h" #include <stddef.h> +#include <utility> #include "content/common/input/input_event.h" #include "content/common/input/synthetic_gesture_params.h" @@ -215,7 +216,7 @@ TEST_F(InputParamTraitsTest, SyntheticSmoothScrollGestureParams) { ASSERT_EQ(SyntheticGestureParams::SMOOTH_SCROLL_GESTURE, gesture_params->GetGestureType()); SyntheticGesturePacket packet_in; - packet_in.set_gesture_params(gesture_params.Pass()); + packet_in.set_gesture_params(std::move(gesture_params)); Verify(packet_in); } @@ -230,7 +231,7 @@ TEST_F(InputParamTraitsTest, SyntheticPinchGestureParams) { ASSERT_EQ(SyntheticGestureParams::PINCH_GESTURE, gesture_params->GetGestureType()); SyntheticGesturePacket packet_in; - packet_in.set_gesture_params(gesture_params.Pass()); + packet_in.set_gesture_params(std::move(gesture_params)); Verify(packet_in); } @@ -244,7 +245,7 @@ TEST_F(InputParamTraitsTest, SyntheticTapGestureParams) { ASSERT_EQ(SyntheticGestureParams::TAP_GESTURE, gesture_params->GetGestureType()); SyntheticGesturePacket packet_in; - packet_in.set_gesture_params(gesture_params.Pass()); + packet_in.set_gesture_params(std::move(gesture_params)); Verify(packet_in); } diff --git a/content/common/input/synthetic_gesture_packet.h b/content/common/input/synthetic_gesture_packet.h index f1dd35b..db2c80b 100644 --- a/content/common/input/synthetic_gesture_packet.h +++ b/content/common/input/synthetic_gesture_packet.h @@ -5,6 +5,8 @@ #ifndef CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PACKET_H_ #define CONTENT_COMMON_INPUT_SYNTHETIC_GESTURE_PACKET_H_ +#include <utility> + #include "base/macros.h" #include "base/memory/scoped_ptr.h" #include "content/common/content_export.h" @@ -20,13 +22,13 @@ class CONTENT_EXPORT SyntheticGesturePacket { ~SyntheticGesturePacket(); void set_gesture_params(scoped_ptr<SyntheticGestureParams> gesture_params) { - gesture_params_ = gesture_params.Pass(); + gesture_params_ = std::move(gesture_params); } const SyntheticGestureParams* gesture_params() const { return gesture_params_.get(); } scoped_ptr<SyntheticGestureParams> pass_gesture_params() { - return gesture_params_.Pass(); + return std::move(gesture_params_); } private: diff --git a/content/common/input/web_input_event_traits.cc b/content/common/input/web_input_event_traits.cc index 89db933..1008c54 100644 --- a/content/common/input/web_input_event_traits.cc +++ b/content/common/input/web_input_event_traits.cc @@ -439,7 +439,7 @@ size_t WebInputEventTraits::GetSize(WebInputEvent::Type type) { ScopedWebInputEvent WebInputEventTraits::Clone(const WebInputEvent& event) { ScopedWebInputEvent scoped_event; Apply(WebInputEventClone(), event.type, event, &scoped_event); - return scoped_event.Pass(); + return scoped_event; } void WebInputEventTraits::Delete(WebInputEvent* event) { diff --git a/content/common/mojo/channel_init.cc b/content/common/mojo/channel_init.cc index 39aa1d0..967fb10 100644 --- a/content/common/mojo/channel_init.cc +++ b/content/common/mojo/channel_init.cc @@ -4,6 +4,8 @@ #include "content/common/mojo/channel_init.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/lazy_instance.h" @@ -26,15 +28,13 @@ mojo::ScopedMessagePipeHandle ChannelInit::Init( scoped_refptr<base::TaskRunner> io_thread_task_runner) { scoped_ptr<IPC::ScopedIPCSupport> ipc_support( new IPC::ScopedIPCSupport(io_thread_task_runner)); - mojo::ScopedMessagePipeHandle message_pipe = - mojo::embedder::CreateChannel( - mojo::embedder::ScopedPlatformHandle( - mojo::embedder::PlatformHandle(file)), - base::Bind(&ChannelInit::OnCreatedChannel, - weak_factory_.GetWeakPtr(), - base::Passed(&ipc_support)), - base::ThreadTaskRunnerHandle::Get()).Pass(); - return message_pipe.Pass(); + mojo::ScopedMessagePipeHandle message_pipe = mojo::embedder::CreateChannel( + mojo::embedder::ScopedPlatformHandle( + mojo::embedder::PlatformHandle(file)), + base::Bind(&ChannelInit::OnCreatedChannel, weak_factory_.GetWeakPtr(), + base::Passed(&ipc_support)), + base::ThreadTaskRunnerHandle::Get()); + return message_pipe; } void ChannelInit::WillDestroySoon() { @@ -56,7 +56,7 @@ void ChannelInit::OnCreatedChannel( DCHECK(!self->channel_info_); self->channel_info_ = channel; - self->ipc_support_ = ipc_support.Pass(); + self->ipc_support_ = std::move(ipc_support); } } // namespace content diff --git a/content/common/mojo/mojo_shell_connection_impl.cc b/content/common/mojo/mojo_shell_connection_impl.cc index 3c0714d..0c6a3df 100644 --- a/content/common/mojo/mojo_shell_connection_impl.cc +++ b/content/common/mojo/mojo_shell_connection_impl.cc @@ -4,6 +4,8 @@ #include "content/common/mojo/mojo_shell_connection_impl.h" +#include <utility> + #include "base/command_line.h" #include "base/lazy_instance.h" #include "base/stl_util.h" @@ -52,7 +54,7 @@ void MojoShellConnectionImpl::BindToMessagePipe( mojo::ScopedMessagePipeHandle handle) { if (initialized_) return; - WaitForShell(handle.Pass()); + WaitForShell(std::move(handle)); } MojoShellConnectionImpl::MojoShellConnectionImpl() : initialized_(false) {} @@ -64,9 +66,9 @@ void MojoShellConnectionImpl::WaitForShell( mojo::ScopedMessagePipeHandle handle) { mojo::InterfaceRequest<mojo::Application> application_request; runner_connection_.reset(mojo::runner::RunnerConnection::ConnectToRunner( - &application_request, handle.Pass())); - application_impl_.reset(new mojo::ApplicationImpl( - this, application_request.Pass())); + &application_request, std::move(handle))); + application_impl_.reset( + new mojo::ApplicationImpl(this, std::move(application_request))); application_impl_->WaitForInitialize(); } diff --git a/content/common/mojo/service_registry_impl.cc b/content/common/mojo/service_registry_impl.cc index 2303f3b..a55864f 100644 --- a/content/common/mojo/service_registry_impl.cc +++ b/content/common/mojo/service_registry_impl.cc @@ -4,6 +4,8 @@ #include "content/common/mojo/service_registry_impl.h" +#include <utility> + #include "mojo/common/common_type_converters.h" namespace content { @@ -20,7 +22,7 @@ ServiceRegistryImpl::~ServiceRegistryImpl() { void ServiceRegistryImpl::Bind( mojo::InterfaceRequest<mojo::ServiceProvider> request) { - binding_.Bind(request.Pass()); + binding_.Bind(std::move(request)); binding_.set_connection_error_handler(base::Bind( &ServiceRegistryImpl::OnConnectionError, base::Unretained(this))); } @@ -28,7 +30,7 @@ void ServiceRegistryImpl::Bind( void ServiceRegistryImpl::BindRemoteServiceProvider( mojo::ServiceProviderPtr service_provider) { CHECK(!remote_provider_); - remote_provider_ = service_provider.Pass(); + remote_provider_ = std::move(service_provider); while (!pending_connects_.empty()) { remote_provider_->ConnectToService( mojo::String::From(pending_connects_.front().first), @@ -56,7 +58,7 @@ void ServiceRegistryImpl::ConnectToRemoteService( return; } remote_provider_->ConnectToService( - mojo::String::From(service_name.as_string()), handle.Pass()); + mojo::String::From(service_name.as_string()), std::move(handle)); } bool ServiceRegistryImpl::IsBound() const { @@ -83,7 +85,7 @@ void ServiceRegistryImpl::ConnectToService( return; } - it->second.Run(client_handle.Pass()); + it->second.Run(std::move(client_handle)); } void ServiceRegistryImpl::OnConnectionError() { diff --git a/content/common/sandbox_linux/sandbox_init_linux.cc b/content/common/sandbox_linux/sandbox_init_linux.cc index f834f90..1119034 100644 --- a/content/common/sandbox_linux/sandbox_init_linux.cc +++ b/content/common/sandbox_linux/sandbox_init_linux.cc @@ -16,13 +16,13 @@ namespace content { bool InitializeSandbox(scoped_ptr<sandbox::bpf_dsl::Policy> policy, base::ScopedFD proc_fd) { - return SandboxSeccompBPF::StartSandboxWithExternalPolicy(policy.Pass(), + return SandboxSeccompBPF::StartSandboxWithExternalPolicy(std::move(policy), std::move(proc_fd)); } #if !defined(OS_NACL_NONSFI) scoped_ptr<sandbox::bpf_dsl::Policy> GetBPFSandboxBaselinePolicy() { - return SandboxSeccompBPF::GetBaselinePolicy().Pass(); + return SandboxSeccompBPF::GetBaselinePolicy(); } #endif // !defined(OS_NACL_NONSFI) diff --git a/content/common/service_port_type_converters.cc b/content/common/service_port_type_converters.cc index b47b0cd..c07a946 100644 --- a/content/common/service_port_type_converters.cc +++ b/content/common/service_port_type_converters.cc @@ -26,7 +26,7 @@ TypeConverter<content::MojoTransferredMessagePortPtr, content::MojoTransferredMessagePort::New()); output->id = input.id; output->send_messages_as_values = input.send_messages_as_values; - return output.Pass(); + return output; } } // namespace mojo diff --git a/content/gpu/gpu_child_thread.cc b/content/gpu/gpu_child_thread.cc index 476b1c6..b9f7bc5 100644 --- a/content/gpu/gpu_child_thread.cc +++ b/content/gpu/gpu_child_thread.cc @@ -5,6 +5,7 @@ #include "content/gpu/gpu_child_thread.h" #include <stddef.h> +#include <utility> #include "base/bind.h" #include "base/lazy_instance.h" @@ -394,7 +395,8 @@ void GpuChildThread::BindProcessControlRequest( mojo::InterfaceRequest<ProcessControl> request) { DVLOG(1) << "GPU: Binding ProcessControl request"; DCHECK(process_control_); - process_control_bindings_.AddBinding(process_control_.get(), request.Pass()); + process_control_bindings_.AddBinding(process_control_.get(), + std::move(request)); } } // namespace content diff --git a/content/public/browser/browser_message_filter.h b/content/public/browser/browser_message_filter.h index 9092ecf..8f652ec 100644 --- a/content/public/browser/browser_message_filter.h +++ b/content/public/browser/browser_message_filter.h @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/memory/ref_counted.h" #include "base/process/process.h" @@ -88,7 +89,7 @@ class CONTENT_EXPORT BrowserMessageFilter base::ProcessId peer_pid() const { return peer_process_.Pid(); } void set_peer_process_for_testing(base::Process peer_process) { - peer_process_ = peer_process.Pass(); + peer_process_ = std::move(peer_process); } // Checks that the given message can be dispatched on the UI thread, depending diff --git a/content/public/browser/download_url_parameters.h b/content/public/browser/download_url_parameters.h index d9c0039..a2b9b00 100644 --- a/content/public/browser/download_url_parameters.h +++ b/content/public/browser/download_url_parameters.h @@ -6,8 +6,8 @@ #define CONTENT_PUBLIC_BROWSER_DOWNLOAD_URL_PARAMETERS_H_ #include <stdint.h> - #include <string> +#include <utility> #include <vector> #include "base/callback.h" @@ -101,9 +101,7 @@ class CONTENT_EXPORT DownloadUrlParameters { save_info_.hash_state = hash_state; } void set_prompt(bool prompt) { save_info_.prompt_for_save_location = prompt; } - void set_file(base::File file) { - save_info_.file = file.Pass(); - } + void set_file(base::File file) { save_info_.file = std::move(file); } void set_do_not_prompt_for_login(bool do_not_prompt) { do_not_prompt_for_login_ = do_not_prompt; } @@ -146,7 +144,7 @@ class CONTENT_EXPORT DownloadUrlParameters { // Note that this is state changing--the DownloadUrlParameters object // will not have a file attached to it after this call. - base::File GetFile() { return save_info_.file.Pass(); } + base::File GetFile() { return std::move(save_info_.file); } private: OnStartedCallback callback_; diff --git a/content/public/browser/navigation_handle.cc b/content/public/browser/navigation_handle.cc index fa67249..4926947 100644 --- a/content/public/browser/navigation_handle.cc +++ b/content/public/browser/navigation_handle.cc @@ -4,6 +4,8 @@ #include "content/public/browser/navigation_handle.h" +#include <utility> + #include "content/browser/frame_host/navigation_handle_impl.h" #include "content/browser/frame_host/navigator.h" #include "content/browser/frame_host/render_frame_host_impl.h" @@ -26,7 +28,7 @@ scoped_ptr<NavigationHandle> NavigationHandle::CreateNavigationHandleForTesting( url, static_cast<RenderFrameHostImpl*>(render_frame_host)->frame_tree_node(), base::TimeTicks::Now()); - return scoped_ptr<NavigationHandle>(handle_impl.Pass()); + return scoped_ptr<NavigationHandle>(std::move(handle_impl)); } } // namespace content diff --git a/content/public/common/service_registry.h b/content/public/common/service_registry.h index 5832131..ad8aaf0 100644 --- a/content/public/common/service_registry.h +++ b/content/public/common/service_registry.h @@ -6,6 +6,7 @@ #define CONTENT_PUBLIC_COMMON_SERVICE_REGISTRY_H_ #include <string> +#include <utility> #include "base/bind.h" #include "base/callback.h" @@ -65,7 +66,7 @@ class CONTENT_EXPORT ServiceRegistry { const base::Callback<void(mojo::InterfaceRequest<Interface>)> service_factory, mojo::ScopedMessagePipeHandle handle) { - service_factory.Run(mojo::MakeRequest<Interface>(handle.Pass())); + service_factory.Run(mojo::MakeRequest<Interface>(std::move(handle))); } }; diff --git a/content/public/renderer/media_stream_api.cc b/content/public/renderer/media_stream_api.cc index 5908c99..9ec76b7 100644 --- a/content/public/renderer/media_stream_api.cc +++ b/content/public/renderer/media_stream_api.cc @@ -4,6 +4,8 @@ #include "content/public/renderer/media_stream_api.h" +#include <utility> + #include "base/base64.h" #include "base/callback.h" #include "base/rand_util.h" @@ -37,7 +39,7 @@ bool AddVideoTrackToMediaStream(scoped_ptr<media::VideoCapturerSource> source, blink::WebMediaStream web_stream = blink::WebMediaStreamRegistry::lookupMediaStreamDescriptor( GURL(media_stream_url)); - return AddVideoTrackToMediaStream(source.Pass(), is_remote, is_readonly, + return AddVideoTrackToMediaStream(std::move(source), is_remote, is_readonly, &web_stream); } @@ -53,7 +55,7 @@ bool AddVideoTrackToMediaStream(scoped_ptr<media::VideoCapturerSource> source, blink::WebMediaStreamSource webkit_source; scoped_ptr<MediaStreamVideoSource> media_stream_source( new MediaStreamVideoCapturerSource( - MediaStreamSource::SourceStoppedCallback(), source.Pass())); + MediaStreamSource::SourceStoppedCallback(), std::move(source))); webkit_source.initialize(track_id, blink::WebMediaStreamSource::TypeVideo, track_id, is_remote, is_readonly); webkit_source.setExtraData(media_stream_source.get()); diff --git a/content/public/test/browser_test_utils.cc b/content/public/test/browser_test_utils.cc index c4d37ac..a15e0f0 100644 --- a/content/public/test/browser_test_utils.cc +++ b/content/public/test/browser_test_utils.cc @@ -5,6 +5,7 @@ #include "content/public/test/browser_test_utils.h" #include <stddef.h> +#include <utility> #include "base/auto_reset.h" #include "base/bind.h" @@ -309,7 +310,7 @@ scoped_ptr<net::test_server::HttpResponse> CrossSiteRedirectResponseHandler( new net::test_server::BasicHttpResponse); http_response->set_code(net::HTTP_MOVED_PERMANENTLY); http_response->AddCustomHeader("Location", redirect_target.spec()); - return http_response.Pass(); + return std::move(http_response); } } // namespace diff --git a/content/public/test/mock_render_process_host.h b/content/public/test/mock_render_process_host.h index 03a4b9e..295c772 100644 --- a/content/public/test/mock_render_process_host.h +++ b/content/public/test/mock_render_process_host.h @@ -7,6 +7,7 @@ #include <stddef.h> #include <stdint.h> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_vector.h" @@ -127,7 +128,7 @@ class MockRenderProcessHost : public RenderProcessHost { } void SetProcessHandle(scoped_ptr<base::ProcessHandle> new_handle) { - process_handle = new_handle.Pass(); + process_handle = std::move(new_handle); } void GetAudioOutputControllers( diff --git a/content/public/test/test_browser_context.cc b/content/public/test/test_browser_context.cc index c1c139c..a022778 100644 --- a/content/public/test/test_browser_context.cc +++ b/content/public/test/test_browser_context.cc @@ -4,6 +4,8 @@ #include "content/public/test/test_browser_context.h" +#include <utility> + #include "base/files/file_path.h" #include "base/test/null_task_runner.h" #include "content/public/browser/background_sync_controller.h" @@ -59,7 +61,7 @@ void TestBrowserContext::SetSpecialStoragePolicy( void TestBrowserContext::SetBackgroundSyncController( scoped_ptr<BackgroundSyncController> controller) { - background_sync_controller_ = controller.Pass(); + background_sync_controller_ = std::move(controller); } base::FilePath TestBrowserContext::GetPath() const { diff --git a/content/public/test/test_download_request_handler.cc b/content/public/test/test_download_request_handler.cc index 107cf1f..89e2cdc 100644 --- a/content/public/test/test_download_request_handler.cc +++ b/content/public/test/test_download_request_handler.cc @@ -5,6 +5,7 @@ #include "content/public/test/test_download_request_handler.h" #include <inttypes.h> +#include <utility> #include "base/logging.h" #include "base/macros.h" @@ -213,7 +214,7 @@ TestDownloadRequestHandler::PartialResponseJob::PartialResponseJob( net::URLRequest* request, net::NetworkDelegate* network_delegate) : net::URLRequestJob(request, network_delegate), - parameters_(parameters.Pass()), + parameters_(std::move(parameters)), interceptor_(interceptor), weak_factory_(this) { DCHECK(parameters_.get()); @@ -488,7 +489,7 @@ TestDownloadRequestHandler::Interceptor::Register( base::WeakPtr<Interceptor> weak_reference = interceptor->weak_ptr_factory_.GetWeakPtr(); net::URLRequestFilter* filter = net::URLRequestFilter::GetInstance(); - filter->AddUrlInterceptor(url, interceptor.Pass()); + filter->AddUrlInterceptor(url, std::move(interceptor)); return weak_reference; } diff --git a/content/public/test/test_file_error_injector.cc b/content/public/test/test_file_error_injector.cc index a6421b1..96fcd95 100644 --- a/content/public/test/test_file_error_injector.cc +++ b/content/public/test/test_file_error_injector.cc @@ -4,6 +4,7 @@ #include "content/public/test/test_file_error_injector.h" +#include <utility> #include <vector> #include "base/compiler_specific.h" @@ -111,12 +112,17 @@ DownloadFileWithErrors::DownloadFileWithErrors( const TestFileErrorInjector::FileErrorInfo& error_info, const ConstructionCallback& ctor_callback, const DestructionCallback& dtor_callback) - : DownloadFileImpl( - save_info.Pass(), default_download_directory, url, referrer_url, - calculate_hash, stream.Pass(), bound_net_log, observer), - source_url_(url), - error_info_(error_info), - destruction_callback_(dtor_callback) { + : DownloadFileImpl(std::move(save_info), + default_download_directory, + url, + referrer_url, + calculate_hash, + std::move(stream), + bound_net_log, + observer), + source_url_(url), + error_info_(error_info), + destruction_callback_(dtor_callback) { // DownloadFiles are created on the UI thread and are destroyed on the FILE // thread. Schedule the ConstructionCallback on the FILE thread so that if a // DownloadItem schedules a DownloadFile to be destroyed and creates another @@ -310,16 +316,9 @@ DownloadFile* DownloadFileWithErrorsFactory::CreateFile( } return new DownloadFileWithErrors( - save_info.Pass(), - default_download_directory, - url, - referrer_url, - calculate_hash, - stream.Pass(), - bound_net_log, - observer, - injected_errors_[url.spec()], - construction_callback_, + std::move(save_info), default_download_directory, url, referrer_url, + calculate_hash, std::move(stream), bound_net_log, observer, + injected_errors_[url.spec()], construction_callback_, destruction_callback_); } @@ -354,7 +353,7 @@ TestFileErrorInjector::TestFileErrorInjector( created_factory_); download_manager_->SetDownloadFileFactoryForTesting( - download_file_factory.Pass()); + std::move(download_file_factory)); } TestFileErrorInjector::~TestFileErrorInjector() { diff --git a/content/public/test/test_file_system_backend.cc b/content/public/test/test_file_system_backend.cc index 8ebe052..ed71987 100644 --- a/content/public/test/test_file_system_backend.cc +++ b/content/public/test/test_file_system_backend.cc @@ -6,6 +6,7 @@ #include <set> #include <string> +#include <utility> #include <vector> #include "base/files/file.h" @@ -171,7 +172,7 @@ TestFileSystemBackend::GetCopyOrMoveFileValidatorFactory( void TestFileSystemBackend::InitializeCopyOrMoveFileValidatorFactory( scoped_ptr<storage::CopyOrMoveFileValidatorFactory> factory) { if (!copy_or_move_file_validator_factory_) - copy_or_move_file_validator_factory_ = factory.Pass(); + copy_or_move_file_validator_factory_ = std::move(factory); } FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation( @@ -182,7 +183,8 @@ FileSystemOperation* TestFileSystemBackend::CreateFileSystemOperation( new FileSystemOperationContext(context)); operation_context->set_update_observers(*GetUpdateObservers(url.type())); operation_context->set_change_observers(*GetChangeObservers(url.type())); - return FileSystemOperation::Create(url, context, operation_context.Pass()); + return FileSystemOperation::Create(url, context, + std::move(operation_context)); } bool TestFileSystemBackend::SupportsStreaming( diff --git a/content/public/test/test_file_system_context.cc b/content/public/test/test_file_system_context.cc index 7f60250..7024985 100644 --- a/content/public/test/test_file_system_context.cc +++ b/content/public/test/test_file_system_context.cc @@ -4,6 +4,8 @@ #include "content/public/test/test_file_system_context.h" +#include <utility> + #include "base/memory/scoped_vector.h" #include "base/thread_task_runner_handle.h" #include "content/public/test/mock_special_storage_policy.h" @@ -22,7 +24,7 @@ storage::FileSystemContext* CreateFileSystemContextForTesting( additional_providers.push_back(new TestFileSystemBackend( base::ThreadTaskRunnerHandle::Get().get(), base_path)); return CreateFileSystemContextWithAdditionalProvidersForTesting( - quota_manager_proxy, additional_providers.Pass(), base_path); + quota_manager_proxy, std::move(additional_providers), base_path); } storage::FileSystemContext* @@ -35,7 +37,7 @@ CreateFileSystemContextWithAdditionalProvidersForTesting( base::ThreadTaskRunnerHandle::Get().get(), storage::ExternalMountPoints::CreateRefCounted().get(), make_scoped_refptr(new MockSpecialStoragePolicy()).get(), - quota_manager_proxy, additional_providers.Pass(), + quota_manager_proxy, std::move(additional_providers), std::vector<storage::URLRequestAutoMountHandler>(), base_path, CreateAllowFileAccessOptions()); } @@ -50,7 +52,7 @@ storage::FileSystemContext* CreateFileSystemContextWithAutoMountersForTesting( base::ThreadTaskRunnerHandle::Get().get(), storage::ExternalMountPoints::CreateRefCounted().get(), make_scoped_refptr(new MockSpecialStoragePolicy()).get(), - quota_manager_proxy, additional_providers.Pass(), auto_mounters, + quota_manager_proxy, std::move(additional_providers), auto_mounters, base_path, CreateAllowFileAccessOptions()); } @@ -63,7 +65,7 @@ storage::FileSystemContext* CreateIncognitoFileSystemContextForTesting( base::ThreadTaskRunnerHandle::Get().get(), storage::ExternalMountPoints::CreateRefCounted().get(), make_scoped_refptr(new MockSpecialStoragePolicy()).get(), - quota_manager_proxy, additional_providers.Pass(), + quota_manager_proxy, std::move(additional_providers), std::vector<storage::URLRequestAutoMountHandler>(), base_path, CreateIncognitoFileSystemOptions()); } diff --git a/content/public/test/test_mojo_app.cc b/content/public/test/test_mojo_app.cc index 13cb9af..aac7665 100644 --- a/content/public/test/test_mojo_app.cc +++ b/content/public/test/test_mojo_app.cc @@ -4,6 +4,8 @@ #include "content/public/test/test_mojo_app.h" +#include <utility> + #include "base/logging.h" #include "mojo/application/public/cpp/application_connection.h" #include "mojo/application/public/cpp/application_impl.h" @@ -32,7 +34,7 @@ bool TestMojoApp::ConfigureIncomingConnection( void TestMojoApp::Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<TestMojoService> request) { DCHECK(!service_binding_.is_bound()); - service_binding_.Bind(request.Pass()); + service_binding_.Bind(std::move(request)); } void TestMojoApp::DoSomething(const DoSomethingCallback& callback) { diff --git a/content/public/test/test_utils.cc b/content/public/test/test_utils.cc index b2c9347..66a493a 100644 --- a/content/public/test/test_utils.cc +++ b/content/public/test/test_utils.cc @@ -4,6 +4,8 @@ #include "content/public/test/test_utils.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/location.h" @@ -68,7 +70,7 @@ class ScriptCallback { virtual ~ScriptCallback() { } void ResultCallback(const base::Value* result); - scoped_ptr<base::Value> result() { return result_.Pass(); } + scoped_ptr<base::Value> result() { return std::move(result_); } private: scoped_ptr<base::Value> result_; @@ -190,7 +192,7 @@ scoped_ptr<base::Value> ExecuteScriptAndGetValue( base::Bind(&ScriptCallback::ResultCallback, base::Unretained(&observer))); base::MessageLoop* loop = base::MessageLoop::current(); loop->Run(); - return observer.result().Pass(); + return observer.result(); } bool AreAllSitesIsolatedForTesting() { diff --git a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc index 32f7d63..b41b92f 100644 --- a/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc +++ b/content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.cc @@ -4,6 +4,8 @@ #include "content/shell/browser/layout_test/layout_test_bluetooth_adapter_provider.h" +#include <utility> + #include "base/bind.h" #include "base/bind_helpers.h" #include "base/format_macros.h" @@ -315,7 +317,7 @@ LayoutTestBluetoothAdapterProvider::GetPowerValueAdapter(int8_t tx_power, ON_CALL(*device, GetInquiryTxPower()).WillByDefault(Return(tx_power)); ON_CALL(*device, GetInquiryRSSI()).WillByDefault(Return(rssi)); - adapter->AddMockDevice(device.Pass()); + adapter->AddMockDevice(std::move(device)); return adapter; } @@ -360,7 +362,7 @@ LayoutTestBluetoothAdapterProvider::GetUnicodeDeviceAdapter() { static void AddDevice(scoped_refptr<NiceMockBluetoothAdapter> adapter, scoped_ptr<NiceMockBluetoothDevice> new_device) { NiceMockBluetoothDevice* new_device_ptr = new_device.get(); - adapter->AddMockDevice(new_device.Pass()); + adapter->AddMockDevice(std::move(new_device)); FOR_EACH_OBSERVER(BluetoothAdapter::Observer, adapter->GetObservers(), DeviceAdded(adapter.get(), new_device_ptr)); } @@ -413,9 +415,9 @@ LayoutTestBluetoothAdapterProvider::GetMissingCharacteristicHeartRateAdapter() { // Intentionally NOT adding a characteristic to heart_rate service. - device->AddMockService(generic_access.Pass()); - device->AddMockService(heart_rate.Pass()); - adapter->AddMockDevice(device.Pass()); + device->AddMockService(std::move(generic_access)); + device->AddMockService(std::move(heart_rate)); + adapter->AddMockDevice(std::move(device)); return adapter; } @@ -451,7 +453,7 @@ LayoutTestBluetoothAdapterProvider::GetDelayedServicesDiscoveryAdapter() { scoped_ptr<NiceMockBluetoothGattService> heart_rate( GetBaseGATTService(device_ptr, kHeartRateServiceUUID)); - device_ptr->AddMockService(heart_rate.Pass()); + device_ptr->AddMockService(std::move(heart_rate)); base::ThreadTaskRunnerHandle::Get()->PostTask( FROM_HERE, base::Bind(&NotifyServicesDiscovered, make_scoped_refptr(adapter_ptr), device_ptr)); @@ -460,7 +462,7 @@ LayoutTestBluetoothAdapterProvider::GetDelayedServicesDiscoveryAdapter() { return services; })); - adapter->AddMockDevice(device.Pass()); + adapter->AddMockDevice(std::move(device)); return adapter; } @@ -476,7 +478,7 @@ LayoutTestBluetoothAdapterProvider::GetHeartRateAdapter() { device->AddMockService(GetGenericAccessService(adapter.get(), device.get())); device->AddMockService(GetHeartRateService(adapter.get(), device.get())); - adapter->AddMockDevice(device.Pass()); + adapter->AddMockDevice(std::move(device)); return adapter; } @@ -518,8 +520,8 @@ LayoutTestBluetoothAdapterProvider::GetFailingGATTOperationsAdapter() { static_cast<BluetoothGattService::GattErrorCode>(error))); } - device->AddMockService(service.Pass()); - adapter->AddMockDevice(device.Pass()); + device->AddMockService(std::move(service)); + adapter->AddMockDevice(std::move(device)); return adapter; } @@ -699,7 +701,7 @@ LayoutTestBluetoothAdapterProvider::GetGenericAccessService( ON_CALL(*device_name, WriteRemoteCharacteristic(_, _, _)) .WillByDefault(RunCallback<1 /* success callback */>()); - generic_access->AddMockCharacteristic(device_name.Pass()); + generic_access->AddMockCharacteristic(std::move(device_name)); return generic_access; } @@ -754,8 +756,8 @@ LayoutTestBluetoothAdapterProvider::GetHeartRateService( return location; })); - heart_rate->AddMockCharacteristic(heart_rate_measurement.Pass()); - heart_rate->AddMockCharacteristic(body_sensor_location.Pass()); + heart_rate->AddMockCharacteristic(std::move(heart_rate_measurement)); + heart_rate->AddMockCharacteristic(std::move(body_sensor_location)); return heart_rate; } diff --git a/content/shell/browser/layout_test/layout_test_browser_context.cc b/content/shell/browser/layout_test/layout_test_browser_context.cc index 8127a65..232e8b5 100644 --- a/content/shell/browser/layout_test/layout_test_browser_context.cc +++ b/content/shell/browser/layout_test/layout_test_browser_context.cc @@ -4,6 +4,8 @@ #include "content/shell/browser/layout_test/layout_test_browser_context.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/files/file_util.h" @@ -42,13 +44,10 @@ LayoutTestBrowserContext::CreateURLRequestContextGetter( ProtocolHandlerMap* protocol_handlers, URLRequestInterceptorScopedVector request_interceptors) { return new LayoutTestURLRequestContextGetter( - ignore_certificate_errors(), - GetPath(), + ignore_certificate_errors(), GetPath(), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), - protocol_handlers, - request_interceptors.Pass(), - net_log()); + protocol_handlers, std::move(request_interceptors), net_log()); } DownloadManagerDelegate* diff --git a/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.cc b/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.cc index 087ffce..07021de 100644 --- a/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.cc +++ b/content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.cc @@ -4,6 +4,8 @@ #include "content/shell/browser/layout_test/layout_test_navigator_connect_service_factory.h" +#include <utility> + #include "base/values.h" #include "content/public/browser/browser_thread.h" #include "content/public/browser/message_port_delegate.h" @@ -66,8 +68,9 @@ void LayoutTestNavigatorConnectServiceFactory::Service::SendMessage( scoped_ptr<base::DictionaryValue> reply(new base::DictionaryValue); reply->SetString("message_as_string", message.message_as_string); reply->Set("message_as_value", message.message_as_value.DeepCopy()); - MessagePortProvider::PostMessageToPort( - message_port_id, MessagePortMessage(reply.Pass()), sent_message_ports); + MessagePortProvider::PostMessageToPort(message_port_id, + MessagePortMessage(std::move(reply)), + sent_message_ports); } else { MessagePortProvider::PostMessageToPort(message_port_id, message, sent_message_ports); @@ -113,7 +116,7 @@ void LayoutTestNavigatorConnectServiceFactory::Connect( scoped_ptr<base::DictionaryValue> value(new base::DictionaryValue); value->SetString("origin", client.origin.spec()); MessagePortProvider::PostMessageToPort( - client.message_port_id, MessagePortMessage(value.Pass()), + client.message_port_id, MessagePortMessage(std::move(value)), std::vector<TransferredMessagePort>()); } } diff --git a/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc b/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc index 7afdb58..4674a58 100644 --- a/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc +++ b/content/shell/browser/layout_test/layout_test_url_request_context_getter.cc @@ -4,6 +4,8 @@ #include "content/shell/browser/layout_test/layout_test_url_request_context_getter.h" +#include <utility> + #include "base/command_line.h" #include "base/logging.h" #include "content/public/browser/browser_thread.h" @@ -25,7 +27,7 @@ LayoutTestURLRequestContextGetter::LayoutTestURLRequestContextGetter( io_loop, file_loop, protocol_handlers, - request_interceptors.Pass(), + std::move(request_interceptors), net_log) { // Must first be created on the UI thread. DCHECK_CURRENTLY_ON(BrowserThread::UI); diff --git a/content/shell/browser/shell_browser_context.cc b/content/shell/browser/shell_browser_context.cc index 3195800..492eb8b 100644 --- a/content/shell/browser/shell_browser_context.cc +++ b/content/shell/browser/shell_browser_context.cc @@ -4,6 +4,8 @@ #include "content/shell/browser/shell_browser_context.h" +#include <utility> + #include "base/bind.h" #include "base/command_line.h" #include "base/environment.h" @@ -129,13 +131,10 @@ ShellBrowserContext::CreateURLRequestContextGetter( ProtocolHandlerMap* protocol_handlers, URLRequestInterceptorScopedVector request_interceptors) { return new ShellURLRequestContextGetter( - ignore_certificate_errors_, - GetPath(), + ignore_certificate_errors_, GetPath(), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::IO), BrowserThread::UnsafeGetMessageLoopForThread(BrowserThread::FILE), - protocol_handlers, - request_interceptors.Pass(), - net_log_); + protocol_handlers, std::move(request_interceptors), net_log_); } net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( @@ -143,7 +142,7 @@ net::URLRequestContextGetter* ShellBrowserContext::CreateRequestContext( URLRequestInterceptorScopedVector request_interceptors) { DCHECK(!url_request_getter_.get()); url_request_getter_ = CreateURLRequestContextGetter( - protocol_handlers, request_interceptors.Pass()); + protocol_handlers, std::move(request_interceptors)); resource_context_->set_url_request_context_getter(url_request_getter_.get()); return url_request_getter_.get(); } diff --git a/content/shell/browser/shell_content_browser_client.cc b/content/shell/browser/shell_content_browser_client.cc index 6c9e9b4..d9a30a2 100644 --- a/content/shell/browser/shell_content_browser_client.cc +++ b/content/shell/browser/shell_content_browser_client.cc @@ -5,6 +5,7 @@ #include "content/shell/browser/shell_content_browser_client.h" #include <stddef.h> +#include <utility> #include "base/base_switches.h" #include "base/command_line.h" @@ -172,7 +173,7 @@ net::URLRequestContextGetter* ShellContentBrowserClient::CreateRequestContext( ShellBrowserContext* shell_browser_context = ShellBrowserContextForBrowserContext(content_browser_context); return shell_browser_context->CreateRequestContext( - protocol_handlers, request_interceptors.Pass()); + protocol_handlers, std::move(request_interceptors)); } net::URLRequestContextGetter* @@ -185,10 +186,8 @@ ShellContentBrowserClient::CreateRequestContextForStoragePartition( ShellBrowserContext* shell_browser_context = ShellBrowserContextForBrowserContext(content_browser_context); return shell_browser_context->CreateRequestContextForStoragePartition( - partition_path, - in_memory, - protocol_handlers, - request_interceptors.Pass()); + partition_path, in_memory, protocol_handlers, + std::move(request_interceptors)); } bool ShellContentBrowserClient::IsHandledURL(const GURL& url) { diff --git a/content/shell/browser/shell_net_log.cc b/content/shell/browser/shell_net_log.cc index 7ecc5e8..6e00a3c 100644 --- a/content/shell/browser/shell_net_log.cc +++ b/content/shell/browser/shell_net_log.cc @@ -5,6 +5,7 @@ #include "content/shell/browser/shell_net_log.h" #include <stdio.h> +#include <utility> #include "base/command_line.h" #include "base/files/file_path.h" @@ -65,8 +66,8 @@ ShellNetLog::ShellNetLog(const std::string& app_name) { } else { scoped_ptr<base::Value> constants(GetShellConstants(app_name)); write_to_file_observer_.reset(new net::WriteToFileNetLogObserver()); - write_to_file_observer_->StartObserving(this, file.Pass(), - constants.get(), nullptr); + write_to_file_observer_->StartObserving(this, std::move(file), + constants.get(), nullptr); } } } diff --git a/content/shell/browser/shell_url_request_context_getter.cc b/content/shell/browser/shell_url_request_context_getter.cc index ed9712d..08d19e6 100644 --- a/content/shell/browser/shell_url_request_context_getter.cc +++ b/content/shell/browser/shell_url_request_context_getter.cc @@ -4,6 +4,8 @@ #include "content/shell/browser/shell_url_request_context_getter.h" +#include <utility> + #include "base/command_line.h" #include "base/logging.h" #include "base/memory/scoped_ptr.h" @@ -75,7 +77,7 @@ ShellURLRequestContextGetter::ShellURLRequestContextGetter( io_loop_(io_loop), file_loop_(file_loop), net_log_(net_log), - request_interceptors_(request_interceptors.Pass()) { + request_interceptors_(std::move(request_interceptors)) { // Must first be created on the UI thread. DCHECK_CURRENTLY_ON(BrowserThread::UI); @@ -104,7 +106,7 @@ ShellURLRequestContextGetter::GetProxyConfigService() { scoped_ptr<net::ProxyService> ShellURLRequestContextGetter::GetProxyService() { // TODO(jam): use v8 if possible, look at chrome code. return net::ProxyService::CreateUsingSystemProxyResolver( - proxy_config_service_.Pass(), 0, url_request_context_->net_log()); + std::move(proxy_config_service_), 0, url_request_context_->net_log()); } net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { @@ -191,23 +193,22 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { } if (command_line.HasSwitch(switches::kHostResolverRules)) { scoped_ptr<net::MappedHostResolver> mapped_host_resolver( - new net::MappedHostResolver(host_resolver.Pass())); + new net::MappedHostResolver(std::move(host_resolver))); mapped_host_resolver->SetRulesFromString( command_line.GetSwitchValueASCII(switches::kHostResolverRules)); - host_resolver = mapped_host_resolver.Pass(); + host_resolver = std::move(mapped_host_resolver); } // Give |storage_| ownership at the end in case it's |mapped_host_resolver|. - storage_->set_host_resolver(host_resolver.Pass()); + storage_->set_host_resolver(std::move(host_resolver)); network_session_params.host_resolver = url_request_context_->host_resolver(); storage_->set_http_network_session( make_scoped_ptr(new net::HttpNetworkSession(network_session_params))); - storage_->set_http_transaction_factory(make_scoped_ptr( - new net::HttpCache(storage_->http_network_session(), - main_backend.Pass(), - true /* set_up_quic_server_info */))); + storage_->set_http_transaction_factory(make_scoped_ptr(new net::HttpCache( + storage_->http_network_session(), std::move(main_backend), + true /* set_up_quic_server_info */))); scoped_ptr<net::URLRequestJobFactoryImpl> job_factory( new net::URLRequestJobFactoryImpl()); @@ -228,17 +229,17 @@ net::URLRequestContext* ShellURLRequestContextGetter::GetURLRequestContext() { // Set up interceptors in the reverse order. scoped_ptr<net::URLRequestJobFactory> top_job_factory = - job_factory.Pass(); + std::move(job_factory); for (URLRequestInterceptorScopedVector::reverse_iterator i = request_interceptors_.rbegin(); i != request_interceptors_.rend(); ++i) { top_job_factory.reset(new net::URLRequestInterceptingJobFactory( - top_job_factory.Pass(), make_scoped_ptr(*i))); + std::move(top_job_factory), make_scoped_ptr(*i))); } request_interceptors_.weak_clear(); - storage_->set_job_factory(top_job_factory.Pass()); + storage_->set_job_factory(std::move(top_job_factory)); } return url_request_context_.get(); diff --git a/content/shell/renderer/layout_test/blink_test_runner.cc b/content/shell/renderer/layout_test/blink_test_runner.cc index 0f40d05..f7c4285 100644 --- a/content/shell/renderer/layout_test/blink_test_runner.cc +++ b/content/shell/renderer/layout_test/blink_test_runner.cc @@ -5,10 +5,10 @@ #include "content/shell/renderer/layout_test/blink_test_runner.h" #include <stddef.h> - #include <algorithm> #include <clocale> #include <cmath> +#include <utility> #include "base/base64.h" #include "base/command_line.h" @@ -116,7 +116,7 @@ namespace { class InvokeTaskHelper : public blink::WebTaskRunner::Task { public: InvokeTaskHelper(scoped_ptr<test_runner::WebTask> task) - : task_(task.Pass()) {} + : task_(std::move(task)) {} // WebThread::Task implementation: void run() override { task_->run(); } @@ -289,7 +289,7 @@ void BlinkTestRunner::SetEditCommand(const std::string& name, void BlinkTestRunner::SetGamepadProvider( test_runner::GamepadController* controller) { scoped_ptr<MockGamepadProvider> provider(new MockGamepadProvider(controller)); - SetMockGamepadProvider(provider.Pass()); + SetMockGamepadProvider(std::move(provider)); } void BlinkTestRunner::SetDeviceLightData(const double data) { diff --git a/content/test/layouttest_support.cc b/content/test/layouttest_support.cc index 7e2dfab..0f4fe3b 100644 --- a/content/test/layouttest_support.cc +++ b/content/test/layouttest_support.cc @@ -5,6 +5,7 @@ #include "content/public/test/layouttest_support.h" #include <stddef.h> +#include <utility> #include "base/callback.h" #include "base/lazy_instance.h" @@ -147,9 +148,8 @@ void FetchManifest(blink::WebView* view, const GURL& url, void SetMockGamepadProvider(scoped_ptr<RendererGamepadProvider> provider) { RenderThreadImpl::current() ->blink_platform_impl() - ->SetPlatformEventObserverForTesting( - blink::WebPlatformEventTypeGamepad, - provider.Pass()); + ->SetPlatformEventObserverForTesting(blink::WebPlatformEventTypeGamepad, + std::move(provider)); } void SetMockDeviceLightData(const double data) { diff --git a/content/test/test_content_client.cc b/content/test/test_content_client.cc index 57db682..edca49c 100644 --- a/content/test/test_content_client.cc +++ b/content/test/test_content_client.cc @@ -4,6 +4,8 @@ #include "content/test/test_content_client.h" +#include <utility> + #include "base/base_paths.h" #include "base/files/file_path.h" #include "base/logging.h" @@ -39,7 +41,7 @@ TestContentClient::TestContentClient() #endif // defined(OS_ANDROID) if (pak_file.IsValid()) { - data_pack_.LoadFromFileRegion(pak_file.Pass(), pak_region); + data_pack_.LoadFromFileRegion(std::move(pak_file), pak_region); } else { content_shell_pack_path = content_shell_pack_path.Append( FILE_PATH_LITERAL("content_shell.pak")); diff --git a/content/test/test_navigation_url_loader.cc b/content/test/test_navigation_url_loader.cc index d054dc3..ecb3b101 100644 --- a/content/test/test_navigation_url_loader.cc +++ b/content/test/test_navigation_url_loader.cc @@ -4,6 +4,8 @@ #include "content/test/test_navigation_url_loader.h" +#include <utility> + #include "content/browser/loader/navigation_url_loader_delegate.h" #include "content/public/browser/stream_handle.h" #include "content/public/common/resource_response.h" @@ -14,10 +16,9 @@ namespace content { TestNavigationURLLoader::TestNavigationURLLoader( scoped_ptr<NavigationRequestInfo> request_info, NavigationURLLoaderDelegate* delegate) - : request_info_(request_info.Pass()), + : request_info_(std::move(request_info)), delegate_(delegate), - redirect_count_(0) { -} + redirect_count_(0) {} void TestNavigationURLLoader::FollowRedirect() { redirect_count_++; @@ -46,7 +47,7 @@ void TestNavigationURLLoader::CallOnRequestRedirected( void TestNavigationURLLoader::CallOnResponseStarted( const scoped_refptr<ResourceResponse>& response, scoped_ptr<StreamHandle> body) { - delegate_->OnResponseStarted(response, body.Pass()); + delegate_->OnResponseStarted(response, std::move(body)); } TestNavigationURLLoader::~TestNavigationURLLoader() {} diff --git a/content/test/test_navigation_url_loader_factory.cc b/content/test/test_navigation_url_loader_factory.cc index 29eddd1..7d0095f 100644 --- a/content/test/test_navigation_url_loader_factory.cc +++ b/content/test/test_navigation_url_loader_factory.cc @@ -4,6 +4,8 @@ #include "content/test/test_navigation_url_loader_factory.h" +#include <utility> + #include "content/browser/loader/navigation_url_loader.h" #include "content/test/test_navigation_url_loader.h" @@ -22,8 +24,8 @@ scoped_ptr<NavigationURLLoader> TestNavigationURLLoaderFactory::CreateLoader( scoped_ptr<NavigationRequestInfo> request_info, ServiceWorkerNavigationHandle* service_worker_handle, NavigationURLLoaderDelegate* delegate) { - return scoped_ptr<NavigationURLLoader>(new TestNavigationURLLoader( - request_info.Pass(), delegate)); + return scoped_ptr<NavigationURLLoader>( + new TestNavigationURLLoader(std::move(request_info), delegate)); } } // namespace content diff --git a/content/utility/utility_thread_impl.cc b/content/utility/utility_thread_impl.cc index 2b6e2b7..b6587f5 100644 --- a/content/utility/utility_thread_impl.cc +++ b/content/utility/utility_thread_impl.cc @@ -5,6 +5,7 @@ #include "content/utility/utility_thread_impl.h" #include <stddef.h> +#include <utility> #include "base/command_line.h" #include "build/build_config.h" @@ -149,7 +150,8 @@ void UtilityThreadImpl::OnLoadPlugins( void UtilityThreadImpl::BindProcessControlRequest( mojo::InterfaceRequest<ProcessControl> request) { DCHECK(process_control_); - process_control_bindings_.AddBinding(process_control_.get(), request.Pass()); + process_control_bindings_.AddBinding(process_control_.get(), + std::move(request)); } } // namespace content diff --git a/content/zygote/zygote_linux.cc b/content/zygote/zygote_linux.cc index 9af3da3..71d94da 100644 --- a/content/zygote/zygote_linux.cc +++ b/content/zygote/zygote_linux.cc @@ -95,7 +95,7 @@ Zygote::Zygote(int sandbox_flags, const std::vector<base::ProcessHandle>& extra_children, const std::vector<int>& extra_fds) : sandbox_flags_(sandbox_flags), - helpers_(helpers.Pass()), + helpers_(std::move(helpers)), initial_uma_index_(0), extra_children_(extra_children), extra_fds_(extra_fds), diff --git a/content/zygote/zygote_main_linux.cc b/content/zygote/zygote_main_linux.cc index 6ebe60d..1f8adc1 100644 --- a/content/zygote/zygote_main_linux.cc +++ b/content/zygote/zygote_main_linux.cc @@ -15,7 +15,7 @@ #include <sys/socket.h> #include <sys/types.h> #include <unistd.h> - +#include <utility> #include <vector> #include "base/bind.h" @@ -609,7 +609,7 @@ bool ZygoteMain(const MainFunctionParams& params, const bool namespace_sandbox_engaged = sandbox_flags & kSandboxLinuxUserNS; CHECK_EQ(using_namespace_sandbox, namespace_sandbox_engaged); - Zygote zygote(sandbox_flags, fork_delegates.Pass(), extra_children, + Zygote zygote(sandbox_flags, std::move(fork_delegates), extra_children, extra_fds); // This function call can return multiple times, once per fork(). return zygote.ProcessRequests(); |
