diff options
34 files changed, 173 insertions, 170 deletions
diff --git a/components/mus/android_loader.cc b/components/mus/android_loader.cc index 06b7869..a7e9b72 100644 --- a/components/mus/android_loader.cc +++ b/components/mus/android_loader.cc @@ -17,7 +17,7 @@ void AndroidLoader::Load( mojo::InterfaceRequest<mojo::Application> application_request) { DCHECK(application_request.is_pending()); app_.reset(new mojo::ApplicationImpl(new MandolineUIServicesApp, - application_request.Pass())); + std::move(application_request))); } } // namespace mus diff --git a/components/mus/gles2/command_buffer_driver.cc b/components/mus/gles2/command_buffer_driver.cc index 2157ef7..89a97f7 100644 --- a/components/mus/gles2/command_buffer_driver.cc +++ b/components/mus/gles2/command_buffer_driver.cc @@ -60,16 +60,16 @@ void CommandBufferDriver::Initialize( loss_observer, mojo::ScopedSharedBufferHandle shared_state, mojo::Array<int32_t> attribs) { - sync_client_ = mojo::MakeProxy(sync_client.Pass()); - loss_observer_ = mojo::MakeProxy(loss_observer.Pass()); - bool success = DoInitialize(shared_state.Pass(), attribs.Pass()); + sync_client_ = mojo::MakeProxy(std::move(sync_client)); + loss_observer_ = mojo::MakeProxy(std::move(loss_observer)); + bool success = DoInitialize(std::move(shared_state), std::move(attribs)); mojom::GpuCapabilitiesPtr capabilities = success ? mojom::GpuCapabilities::From(decoder_->GetCapabilities()) : nullptr; sync_client_->DidInitialize(success, gpu::CommandBufferNamespace::MOJO, command_buffer_id_, - capabilities.Pass()); + std::move(capabilities)); } bool CommandBufferDriver::MakeCurrent() { @@ -158,11 +158,11 @@ bool CommandBufferDriver::DoInitialize( const size_t kSize = sizeof(gpu::CommandBufferSharedState); scoped_ptr<gpu::BufferBacking> backing( - MojoBufferBacking::Create(shared_state.Pass(), kSize)); + MojoBufferBacking::Create(std::move(shared_state), kSize)); if (!backing) return false; - command_buffer_->SetSharedStateBuffer(backing.Pass()); + command_buffer_->SetSharedStateBuffer(std::move(backing)); return true; } @@ -194,12 +194,12 @@ void CommandBufferDriver::RegisterTransferBuffer( // Take ownership of the memory and map it into this process. // This validates the size. scoped_ptr<gpu::BufferBacking> backing( - MojoBufferBacking::Create(transfer_buffer.Pass(), size)); + MojoBufferBacking::Create(std::move(transfer_buffer), size)); if (!backing) { DVLOG(0) << "Failed to map shared memory."; return; } - command_buffer_->RegisterTransferBuffer(id, backing.Pass()); + command_buffer_->RegisterTransferBuffer(id, std::move(backing)); } void CommandBufferDriver::DestroyTransferBuffer(int32_t id) { diff --git a/components/mus/gles2/command_buffer_driver.h b/components/mus/gles2/command_buffer_driver.h index e0e5a7f..12aea76 100644 --- a/components/mus/gles2/command_buffer_driver.h +++ b/components/mus/gles2/command_buffer_driver.h @@ -48,7 +48,7 @@ class CommandBufferDriver { ~CommandBufferDriver(); - void set_client(scoped_ptr<Client> client) { client_ = client.Pass(); } + void set_client(scoped_ptr<Client> client) { client_ = std::move(client); } void Initialize( mojo::InterfacePtrInfo<mojom::CommandBufferSyncClient> sync_client, diff --git a/components/mus/gles2/command_buffer_type_conversions.cc b/components/mus/gles2/command_buffer_type_conversions.cc index 1bd8399..56353ac 100644 --- a/components/mus/gles2/command_buffer_type_conversions.cc +++ b/components/mus/gles2/command_buffer_type_conversions.cc @@ -29,7 +29,7 @@ TypeConverter<CommandBufferStatePtr, gpu::CommandBuffer::State>::Convert( result->error = input.error; result->context_lost_reason = input.context_lost_reason; result->generation = input.generation; - return result.Pass(); + return result; } gpu::CommandBuffer::State @@ -52,7 +52,7 @@ TypeConverter<GpuShaderPrecisionPtr, gpu::Capabilities::ShaderPrecision>:: result->min_range = input.min_range; result->max_range = input.max_range; result->precision = input.precision; - return result.Pass(); + return result; } gpu::Capabilities::ShaderPrecision TypeConverter< @@ -75,7 +75,7 @@ TypeConverter<GpuPerStagePrecisionsPtr, gpu::Capabilities::PerStagePrecisions>:: result->low_float = GpuShaderPrecision::From(input.low_float); result->medium_float = GpuShaderPrecision::From(input.medium_float); result->high_float = GpuShaderPrecision::From(input.high_float); - return result.Pass(); + return result; } gpu::Capabilities::PerStagePrecisions TypeConverter< @@ -133,7 +133,7 @@ TypeConverter<GpuCapabilitiesPtr, gpu::Capabilities>::Convert( result->blend_equation_advanced = input.blend_equation_advanced; result->blend_equation_advanced_coherent = input.blend_equation_advanced_coherent; - return result.Pass(); + return result; } gpu::Capabilities TypeConverter<gpu::Capabilities, GpuCapabilitiesPtr>::Convert( @@ -189,7 +189,7 @@ TypeConverter<GpuInfoPtr, gpu::GPUInfo>::Convert( result->renderer_info = mojo::String::From<std::string>(input.gl_renderer); result->driver_version = mojo::String::From<std::string>(input.driver_version); - return result.Pass(); + return result; } } // namespace mojo diff --git a/components/mus/gles2/gpu_impl.cc b/components/mus/gles2/gpu_impl.cc index e23add8..f00bbc7 100644 --- a/components/mus/gles2/gpu_impl.cc +++ b/components/mus/gles2/gpu_impl.cc @@ -12,14 +12,13 @@ namespace mus { GpuImpl::GpuImpl(mojo::InterfaceRequest<Gpu> request, const scoped_refptr<GpuState>& state) - : binding_(this, request.Pass()), state_(state) { -} + : binding_(this, std::move(request)), state_(state) {} GpuImpl::~GpuImpl() {} void GpuImpl::CreateOffscreenGLES2Context( mojo::InterfaceRequest<mojom::CommandBuffer> request) { - new CommandBufferImpl(request.Pass(), state_, + new CommandBufferImpl(std::move(request), state_, make_scoped_ptr(new CommandBufferDriver(state_))); } diff --git a/components/mus/gles2/mojo_buffer_backing.cc b/components/mus/gles2/mojo_buffer_backing.cc index 1beadb32..5aae1d1 100644 --- a/components/mus/gles2/mojo_buffer_backing.cc +++ b/components/mus/gles2/mojo_buffer_backing.cc @@ -11,7 +11,7 @@ namespace mus { MojoBufferBacking::MojoBufferBacking(mojo::ScopedSharedBufferHandle handle, void* memory, size_t size) - : handle_(handle.Pass()), memory_(memory), size_(size) {} + : handle_(std::move(handle)), memory_(memory), size_(size) {} MojoBufferBacking::~MojoBufferBacking() { mojo::UnmapBuffer(memory_); @@ -28,7 +28,7 @@ scoped_ptr<gpu::BufferBacking> MojoBufferBacking::Create( return scoped_ptr<BufferBacking>(); DCHECK(memory); return scoped_ptr<BufferBacking>( - new MojoBufferBacking(handle.Pass(), memory, size)); + new MojoBufferBacking(std::move(handle), memory, size)); } void* MojoBufferBacking::GetMemory() const { return memory_; diff --git a/components/mus/gles2/mojo_gpu_memory_buffer.cc b/components/mus/gles2/mojo_gpu_memory_buffer.cc index f517263..f54757f 100644 --- a/components/mus/gles2/mojo_gpu_memory_buffer.cc +++ b/components/mus/gles2/mojo_gpu_memory_buffer.cc @@ -17,7 +17,7 @@ MojoGpuMemoryBufferImpl::MojoGpuMemoryBufferImpl( scoped_ptr<base::SharedMemory> shared_memory) : size_(size), format_(format), - shared_memory_(shared_memory.Pass()), + shared_memory_(std::move(shared_memory)), mapped_(false) {} MojoGpuMemoryBufferImpl::~MojoGpuMemoryBufferImpl() {} @@ -40,7 +40,7 @@ scoped_ptr<gfx::GpuMemoryBuffer> MojoGpuMemoryBufferImpl::Create( #endif // defined(OS_MACOSX) return make_scoped_ptr<gfx::GpuMemoryBuffer>( - new MojoGpuMemoryBufferImpl(size, format, shared_memory.Pass())); + new MojoGpuMemoryBufferImpl(size, format, std::move(shared_memory))); } MojoGpuMemoryBufferImpl* MojoGpuMemoryBufferImpl::FromClientBuffer( diff --git a/components/mus/mus_app.cc b/components/mus/mus_app.cc index bb8657c..b3138dd 100644 --- a/components/mus/mus_app.cc +++ b/components/mus/mus_app.cc @@ -86,7 +86,7 @@ void MandolineUIServicesApp::OnFirstRootConnectionCreated() { WindowManagerRequests requests; requests.swap(pending_window_manager_requests_); for (auto& request : requests) - Create(nullptr, request->Pass()); + Create(nullptr, std::move(*request)); } void MandolineUIServicesApp::OnNoMoreRootConnections() { @@ -103,8 +103,9 @@ MandolineUIServicesApp::CreateClientConnectionForEmbedAtWindow( mojom::WindowTreeClientPtr client) { scoped_ptr<ws::WindowTreeImpl> service(new ws::WindowTreeImpl( connection_manager, creator_id, root_id, policy_bitmask)); - return new ws::DefaultClientConnection(service.Pass(), connection_manager, - tree_request.Pass(), client.Pass()); + return new ws::DefaultClientConnection(std::move(service), connection_manager, + std::move(tree_request), + std::move(client)); } void MandolineUIServicesApp::Create( @@ -112,7 +113,7 @@ void MandolineUIServicesApp::Create( mojo::InterfaceRequest<mojom::WindowManager> request) { if (!connection_manager_->has_tree_host_connections()) { pending_window_manager_requests_.push_back(make_scoped_ptr( - new mojo::InterfaceRequest<mojom::WindowManager>(request.Pass()))); + new mojo::InterfaceRequest<mojom::WindowManager>(std::move(request)))); return; } if (!window_manager_impl_) { @@ -120,19 +121,19 @@ void MandolineUIServicesApp::Create( new ws::ForwardingWindowManager(connection_manager_.get())); } window_manager_bindings_.AddBinding(window_manager_impl_.get(), - request.Pass()); + std::move(request)); } void MandolineUIServicesApp::Create( ApplicationConnection* connection, InterfaceRequest<WindowTreeHostFactory> request) { - factory_bindings_.AddBinding(this, request.Pass()); + factory_bindings_.AddBinding(this, std::move(request)); } void MandolineUIServicesApp::Create(mojo::ApplicationConnection* connection, mojo::InterfaceRequest<Gpu> request) { DCHECK(gpu_state_); - new GpuImpl(request.Pass(), gpu_state_); + new GpuImpl(std::move(request), gpu_state_); } void MandolineUIServicesApp::CreateWindowTreeHost( @@ -145,12 +146,12 @@ void MandolineUIServicesApp::CreateWindowTreeHost( // TODO(fsamuel): We need to make sure that only the window manager can create // new roots. ws::WindowTreeHostImpl* host_impl = new ws::WindowTreeHostImpl( - host_client.Pass(), connection_manager_.get(), app_impl_, gpu_state_, - surfaces_state_, window_manager.Pass()); + std::move(host_client), connection_manager_.get(), app_impl_, gpu_state_, + surfaces_state_, std::move(window_manager)); // WindowTreeHostConnection manages its own lifetime. host_impl->Init(new ws::WindowTreeHostConnectionImpl( - host.Pass(), make_scoped_ptr(host_impl), tree_client.Pass(), + std::move(host), make_scoped_ptr(host_impl), std::move(tree_client), connection_manager_.get())); } diff --git a/components/mus/public/cpp/lib/context_provider.cc b/components/mus/public/cpp/lib/context_provider.cc index 256939e..c44d398 100644 --- a/components/mus/public/cpp/lib/context_provider.cc +++ b/components/mus/public/cpp/lib/context_provider.cc @@ -13,7 +13,8 @@ namespace mus { ContextProvider::ContextProvider( mojo::ScopedMessagePipeHandle command_buffer_handle) - : command_buffer_handle_(command_buffer_handle.Pass()), context_(nullptr) { + : command_buffer_handle_(std::move(command_buffer_handle)), + context_(nullptr) { // Enabled the CHROMIUM_image extension to use GpuMemoryBuffers. The // implementation of which is used in CommandBufferDriver. capabilities_.gpu.image = true; diff --git a/components/mus/public/cpp/lib/event_matcher.cc b/components/mus/public/cpp/lib/event_matcher.cc index b619adf..e52e97c 100644 --- a/components/mus/public/cpp/lib/event_matcher.cc +++ b/components/mus/public/cpp/lib/event_matcher.cc @@ -23,7 +23,7 @@ mojom::EventMatcherPtr CreateKeyMatcher(mojom::KeyboardCode code, matcher->type_matcher->type = mus::mojom::EVENT_TYPE_KEY_PRESSED; matcher->flags_matcher->flags = flags; matcher->key_matcher->keyboard_code = code; - return matcher.Pass(); + return matcher; } } // namespace mus diff --git a/components/mus/public/cpp/lib/in_flight_change.cc b/components/mus/public/cpp/lib/in_flight_change.cc index 922ae13..8e3b8de 100644 --- a/components/mus/public/cpp/lib/in_flight_change.cc +++ b/components/mus/public/cpp/lib/in_flight_change.cc @@ -118,7 +118,7 @@ void InFlightPropertyChange::SetRevertValueFrom(const InFlightChange& change) { void InFlightPropertyChange::Revert() { WindowPrivate(window()) - .LocalSetSharedProperty(property_name_, revert_value_.Pass()); + .LocalSetSharedProperty(property_name_, std::move(revert_value_)); } // InFlightPredefinedCursorChange --------------------------------------------- diff --git a/components/mus/public/cpp/lib/output_surface.cc b/components/mus/public/cpp/lib/output_surface.cc index 83f7f7a..f5f0469 100644 --- a/components/mus/public/cpp/lib/output_surface.cc +++ b/components/mus/public/cpp/lib/output_surface.cc @@ -16,7 +16,7 @@ namespace mus { OutputSurface::OutputSurface( const scoped_refptr<cc::ContextProvider>& context_provider, scoped_ptr<mus::WindowSurface> surface) - : cc::OutputSurface(context_provider), surface_(surface.Pass()) { + : cc::OutputSurface(context_provider), surface_(std::move(surface)) { capabilities_.delegated_rendering = true; } diff --git a/components/mus/public/cpp/lib/window.cc b/components/mus/public/cpp/lib/window.cc index dd4c9a4..f242d11 100644 --- a/components/mus/public/cpp/lib/window.cc +++ b/components/mus/public/cpp/lib/window.cc @@ -349,14 +349,14 @@ Window* Window::GetChildById(Id id) { void Window::SetTextInputState(mojo::TextInputStatePtr state) { if (connection_) - tree_client()->SetWindowTextInputState(id_, state.Pass()); + tree_client()->SetWindowTextInputState(id_, std::move(state)); } void Window::SetImeVisibility(bool visible, mojo::TextInputStatePtr state) { // SetImeVisibility() shouldn't be used if the window is not editable. DCHECK(state.is_null() || state->type != mojo::TEXT_INPUT_TYPE_NONE); if (connection_) - tree_client()->SetImeVisibility(id_, visible, state.Pass()); + tree_client()->SetImeVisibility(id_, visible, std::move(state)); } void Window::SetFocus() { @@ -374,7 +374,7 @@ void Window::SetCanFocus(bool can_focus) { } void Window::Embed(mus::mojom::WindowTreeClientPtr client) { - Embed(client.Pass(), mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, + Embed(std::move(client), mus::mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmptyEmbedCallback)); } @@ -382,7 +382,7 @@ void Window::Embed(mus::mojom::WindowTreeClientPtr client, uint32_t policy_bitmask, const EmbedCallback& callback) { if (PrepareForEmbed()) - tree_client()->Embed(id_, client.Pass(), policy_bitmask, callback); + tree_client()->Embed(id_, std::move(client), policy_bitmask, callback); else callback.Run(false, 0); } @@ -395,9 +395,7 @@ namespace { mojom::ViewportMetricsPtr CreateEmptyViewportMetrics() { mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New(); metrics->size_in_pixels = mojo::Size::New(); - // TODO(vtl): The |.Pass()| below is only needed due to an MSVS bug; remove it - // once that's fixed. - return metrics.Pass(); + return metrics; } } // namespace @@ -493,7 +491,7 @@ void Window::SetSharedPropertyInternal(const std::string& name, memcpy(&transport_value.front(), &(value->front()), value->size()); } // TODO: add test coverage of this (450303). - tree_client()->SetProperty(this, name, transport_value.Pass()); + tree_client()->SetProperty(this, name, std::move(transport_value)); } LocalSetSharedProperty(name, value); } diff --git a/components/mus/public/cpp/lib/window_tree_client_impl.cc b/components/mus/public/cpp/lib/window_tree_client_impl.cc index 7ee959a..b4dfc50 100644 --- a/components/mus/public/cpp/lib/window_tree_client_impl.cc +++ b/components/mus/public/cpp/lib/window_tree_client_impl.cc @@ -83,7 +83,7 @@ WindowTreeConnection* WindowTreeConnection::Create( mojo::InterfaceRequest<mojom::WindowTreeClient> request, CreateType create_type) { WindowTreeClientImpl* client = - new WindowTreeClientImpl(delegate, nullptr, request.Pass()); + new WindowTreeClientImpl(delegate, nullptr, std::move(request)); if (create_type == CreateType::WAIT_FOR_EMBED) client->WaitForEmbed(); return client; @@ -95,7 +95,7 @@ WindowTreeConnection* WindowTreeConnection::CreateForWindowManager( CreateType create_type, WindowManagerDelegate* window_manager_delegate) { WindowTreeClientImpl* client = new WindowTreeClientImpl( - delegate, window_manager_delegate, request.Pass()); + delegate, window_manager_delegate, std::move(request)); if (create_type == CreateType::WAIT_FOR_EMBED) client->WaitForEmbed(); return client; @@ -118,7 +118,7 @@ WindowTreeClientImpl::WindowTreeClientImpl( in_destructor_(false) { // Allow for a null request in tests. if (request.is_pending()) - binding_.Bind(request.Pass()); + binding_.Bind(std::move(request)); } WindowTreeClientImpl::~WindowTreeClientImpl() { @@ -269,21 +269,21 @@ void WindowTreeClientImpl::SetProperty(Window* window, const uint32_t change_id = ScheduleInFlightChange( make_scoped_ptr(new InFlightPropertyChange(window, name, old_value))); tree_->SetWindowProperty(change_id, window->id(), mojo::String(name), - data.Pass()); + std::move(data)); } void WindowTreeClientImpl::SetWindowTextInputState( Id window_id, mojo::TextInputStatePtr state) { DCHECK(tree_); - tree_->SetWindowTextInputState(window_id, state.Pass()); + tree_->SetWindowTextInputState(window_id, std::move(state)); } void WindowTreeClientImpl::SetImeVisibility(Id window_id, bool visible, mojo::TextInputStatePtr state) { DCHECK(tree_); - tree_->SetImeVisibility(window_id, visible, state.Pass()); + tree_->SetImeVisibility(window_id, visible, std::move(state)); } void WindowTreeClientImpl::Embed( @@ -292,7 +292,7 @@ void WindowTreeClientImpl::Embed( uint32_t policy_bitmask, const mojom::WindowTree::EmbedCallback& callback) { DCHECK(tree_); - tree_->Embed(window_id, client.Pass(), policy_bitmask, callback); + tree_->Embed(window_id, std::move(client), policy_bitmask, callback); } void WindowTreeClientImpl::AttachSurface( @@ -301,7 +301,7 @@ void WindowTreeClientImpl::AttachSurface( mojo::InterfaceRequest<mojom::Surface> surface, mojom::SurfaceClientPtr client) { DCHECK(tree_); - tree_->AttachSurface(window_id, type, surface.Pass(), client.Pass()); + tree_->AttachSurface(window_id, type, std::move(surface), std::move(client)); } void WindowTreeClientImpl::LocalSetFocus(Window* focused) { @@ -433,7 +433,7 @@ Window* WindowTreeClientImpl::NewWindow( transport_properties = mojo::Map<mojo::String, mojo::Array<uint8_t>>::From(*properties); } - tree_->NewWindow(change_id, window->id(), transport_properties.Pass()); + tree_->NewWindow(change_id, window->id(), std::move(transport_properties)); return window; } @@ -463,9 +463,9 @@ void WindowTreeClientImpl::OnEmbed(ConnectionSpecificId connection_id, Id focused_window_id, uint32 access_policy) { DCHECK(!tree_ptr_); - tree_ptr_ = tree.Pass(); + tree_ptr_ = std::move(tree); tree_ptr_.set_connection_error_handler([this]() { delete this; }); - OnEmbedImpl(tree_ptr_.get(), connection_id, root_data.Pass(), + OnEmbedImpl(tree_ptr_.get(), connection_id, std::move(root_data), focused_window_id, access_policy); } @@ -624,7 +624,7 @@ void WindowTreeClientImpl::OnWindowSharedPropertyChanged( if (ApplyServerChangeToExistingInFlightChange(new_change)) return; - WindowPrivate(window).LocalSetSharedProperty(name, new_data.Pass()); + WindowPrivate(window).LocalSetSharedProperty(name, std::move(new_data)); } void WindowTreeClientImpl::OnWindowInputEvent(uint32_t event_id, diff --git a/components/mus/public/cpp/lib/window_tree_host_factory.cc b/components/mus/public/cpp/lib/window_tree_host_factory.cc index 59e3cf4..98c111b 100644 --- a/components/mus/public/cpp/lib/window_tree_host_factory.cc +++ b/components/mus/public/cpp/lib/window_tree_host_factory.cc @@ -21,8 +21,9 @@ void CreateWindowTreeHost(mojom::WindowTreeHostFactory* factory, delegate, GetProxy(&tree_client), WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED, window_manager_delegate); - factory->CreateWindowTreeHost(GetProxy(host), host_client.Pass(), - tree_client.Pass(), window_manager.Pass()); + factory->CreateWindowTreeHost(GetProxy(host), std::move(host_client), + std::move(tree_client), + std::move(window_manager)); } void CreateSingleWindowTreeHost( @@ -34,8 +35,8 @@ void CreateSingleWindowTreeHost( WindowManagerDelegate* window_manager_delegate) { mojom::WindowTreeHostFactoryPtr factory; app->ConnectToService("mojo:mus", &factory); - CreateWindowTreeHost(factory.get(), host_client.Pass(), delegate, host, - window_manager.Pass(), window_manager_delegate); + CreateWindowTreeHost(factory.get(), std::move(host_client), delegate, host, + std::move(window_manager), window_manager_delegate); } } // namespace mus diff --git a/components/mus/public/cpp/tests/window_server_test_base.cc b/components/mus/public/cpp/tests/window_server_test_base.cc index e4ccdec..2022faa 100644 --- a/components/mus/public/cpp/tests/window_server_test_base.cc +++ b/components/mus/public/cpp/tests/window_server_test_base.cc @@ -99,7 +99,7 @@ void WindowServerTestBase::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<mojom::WindowTreeClient> request) { WindowTreeConnection::Create( - this, request.Pass(), + this, std::move(request), WindowTreeConnection::CreateType::DONT_WAIT_FOR_EMBED); } diff --git a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc index 1785510..3164536 100644 --- a/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc +++ b/components/mus/public/cpp/tests/window_tree_client_impl_unittest.cc @@ -30,7 +30,7 @@ mojo::Array<uint8_t> Int32ToPropertyTransportValue(int32_t value) { mojo::Array<uint8_t> transport_value; transport_value.resize(bytes.size()); memcpy(&transport_value.front(), &(bytes.front()), bytes.size()); - return transport_value.Pass(); + return transport_value; } class TestWindowTreeDelegate : public WindowTreeDelegate { @@ -64,7 +64,7 @@ class WindowTreeClientImplPrivate { root_data->viewport_metrics->size_in_pixels = mojo::Size::From(gfx::Size(1000, 1000)); root_data->viewport_metrics->device_pixel_ratio = 1; - tree_client_impl_->OnEmbedImpl(window_tree, 1, root_data.Pass(), 0, + tree_client_impl_->OnEmbedImpl(window_tree, 1, std::move(root_data), 0, access_policy); } diff --git a/components/mus/surfaces/surfaces_scheduler.cc b/components/mus/surfaces/surfaces_scheduler.cc index f324db7..7338f96 100644 --- a/components/mus/surfaces/surfaces_scheduler.cc +++ b/components/mus/surfaces/surfaces_scheduler.cc @@ -19,7 +19,7 @@ SurfacesScheduler::SurfacesScheduler() rendering_stats_instrumentation_.get())); scheduler_ = cc::Scheduler::Create( this, settings, 0, base::MessageLoop::current()->task_runner().get(), - nullptr, compositor_timing_history.Pass()); + nullptr, std::move(compositor_timing_history)); scheduler_->SetVisible(true); scheduler_->SetCanDraw(true); scheduler_->SetNeedsBeginMainFrame(); diff --git a/components/mus/surfaces/top_level_display_client.cc b/components/mus/surfaces/top_level_display_client.cc index 7668ce9..77f9ff0 100644 --- a/components/mus/surfaces/top_level_display_client.cc +++ b/components/mus/surfaces/top_level_display_client.cc @@ -61,13 +61,13 @@ TopLevelDisplayClient::~TopLevelDisplayClient() { void TopLevelDisplayClient::SubmitCompositorFrame( scoped_ptr<cc::CompositorFrame> frame, const base::Closure& callback) { - pending_frame_ = frame.Pass(); + pending_frame_ = std::move(frame); last_submitted_frame_size_ = pending_frame_->delegated_frame_data->render_pass_list.back() ->output_rect.size(); display_->Resize(last_submitted_frame_size_); - factory_.SubmitCompositorFrame(cc_id_, pending_frame_.Pass(), + factory_.SubmitCompositorFrame(cc_id_, std::move(pending_frame_), base::Bind(&CallCallback, callback)); surfaces_state_->scheduler()->SetNeedsDraw(); } diff --git a/components/mus/ws/client_connection.cc b/components/mus/ws/client_connection.cc index aa8bf90..91ecd81 100644 --- a/components/mus/ws/client_connection.cc +++ b/components/mus/ws/client_connection.cc @@ -13,7 +13,7 @@ namespace ws { ClientConnection::ClientConnection(scoped_ptr<WindowTreeImpl> service, mojom::WindowTreeClient* client) - : service_(service.Pass()), client_(client) {} + : service_(std::move(service)), client_(client) {} ClientConnection::~ClientConnection() {} @@ -22,10 +22,10 @@ DefaultClientConnection::DefaultClientConnection( ConnectionManager* connection_manager, mojo::InterfaceRequest<mojom::WindowTree> service_request, mojom::WindowTreeClientPtr client) - : ClientConnection(service_impl.Pass(), client.get()), + : ClientConnection(std::move(service_impl), client.get()), connection_manager_(connection_manager), - binding_(service(), service_request.Pass()), - client_(client.Pass()) { + binding_(service(), std::move(service_request)), + client_(std::move(client)) { binding_.set_connection_error_handler( [this]() { connection_manager_->OnConnectionError(this); }); } diff --git a/components/mus/ws/connection_manager.cc b/components/mus/ws/connection_manager.cc index ebc785d..98152b3 100644 --- a/components/mus/ws/connection_manager.cc +++ b/components/mus/ws/connection_manager.cc @@ -144,10 +144,10 @@ WindowTreeImpl* ConnectionManager::EmbedAtWindow( ClientConnection* client_connection = delegate_->CreateClientConnectionForEmbedAtWindow( this, GetProxy(&service_ptr), creator_id, window_id, policy_bitmask, - client.Pass()); + std::move(client)); AddConnection(client_connection); client_connection->service()->Init(client_connection->client(), - service_ptr.Pass()); + std::move(service_ptr)); OnConnectionMessagedClient(client_connection->service()->id()); return client_connection->service(); @@ -206,7 +206,7 @@ mojom::ViewportMetricsPtr ConnectionManager::GetViewportMetricsForWindow( mojom::ViewportMetricsPtr metrics = mojom::ViewportMetrics::New(); metrics->size_in_pixels = mojo::Size::New(); - return metrics.Pass(); + return metrics; } const WindowTreeImpl* ConnectionManager::GetConnectionWithRoot( diff --git a/components/mus/ws/display_manager.cc b/components/mus/ws/display_manager.cc index d62c488..efb5153 100644 --- a/components/mus/ws/display_manager.cc +++ b/components/mus/ws/display_manager.cc @@ -270,8 +270,8 @@ void DefaultDisplayManager::Draw() { frame_pending_ = true; if (top_level_display_client_) { top_level_display_client_->SubmitCompositorFrame( - frame.Pass(), base::Bind(&DefaultDisplayManager::DidDraw, - weak_factory_.GetWeakPtr())); + std::move(frame), base::Bind(&DefaultDisplayManager::DidDraw, + weak_factory_.GetWeakPtr())); } dirty_rect_ = gfx::Rect(); } @@ -325,11 +325,11 @@ DefaultDisplayManager::GenerateCompositorFrame() { scoped_ptr<cc::DelegatedFrameData> frame_data(new cc::DelegatedFrameData); frame_data->device_scale_factor = metrics_.device_pixel_ratio; - frame_data->render_pass_list.push_back(render_pass.Pass()); + frame_data->render_pass_list.push_back(std::move(render_pass)); scoped_ptr<cc::CompositorFrame> frame(new cc::CompositorFrame); - frame->delegated_frame_data = frame_data.Pass(); - return frame.Pass(); + frame->delegated_frame_data = std::move(frame_data); + return frame; } void DefaultDisplayManager::OnBoundsChanged(const gfx::Rect& new_bounds) { @@ -343,7 +343,7 @@ void DefaultDisplayManager::OnDamageRect(const gfx::Rect& damaged_region) { void DefaultDisplayManager::DispatchEvent(ui::Event* event) { mojom::EventPtr mojo_event(mojom::Event::From(*event)); - delegate_->OnEvent(mojo_event.Pass()); + delegate_->OnEvent(std::move(mojo_event)); switch (event->type()) { case ui::ET_MOUSE_PRESSED: diff --git a/components/mus/ws/event_dispatcher.cc b/components/mus/ws/event_dispatcher.cc index 8da8c8a..76ac76d 100644 --- a/components/mus/ws/event_dispatcher.cc +++ b/components/mus/ws/event_dispatcher.cc @@ -203,18 +203,18 @@ void EventDispatcher::OnEvent(mojom::EventPtr event) { !event->key_data->is_char) { uint32_t accelerator = 0u; if (FindAccelerator(*event, &accelerator)) { - delegate_->OnAccelerator(accelerator, event.Pass()); + delegate_->OnAccelerator(accelerator, std::move(event)); return; } } if (event->key_data) { - ProcessKeyEvent(event.Pass()); + ProcessKeyEvent(std::move(event)); return; } if (event->pointer_data.get()) { - ProcessPointerEvent(event.Pass()); + ProcessPointerEvent(std::move(event)); return; } @@ -225,7 +225,8 @@ void EventDispatcher::ProcessKeyEvent(mojom::EventPtr event) { ServerWindow* focused_window = delegate_->GetFocusedWindowForEventDispatcher(); if (focused_window) - delegate_->DispatchInputEventToWindow(focused_window, false, event.Pass()); + delegate_->DispatchInputEventToWindow(focused_window, false, + std::move(event)); } void EventDispatcher::ProcessPointerEvent(mojom::EventPtr event) { @@ -250,7 +251,7 @@ void EventDispatcher::ProcessPointerEvent(mojom::EventPtr event) { } if (is_mouse_event && !mouse_button_down_) mouse_cursor_source_window_ = pointer_target.window; - DispatchToPointerTarget(pointer_target, event.Pass()); + DispatchToPointerTarget(pointer_target, std::move(event)); return; } @@ -298,7 +299,7 @@ void EventDispatcher::ProcessPointerEvent(mojom::EventPtr event) { FindDeepestVisibleWindowForEvents(root_, surface_id_, &location); } - DispatchToPointerTarget(pointer_targets_[pointer_id], event.Pass()); + DispatchToPointerTarget(pointer_targets_[pointer_id], std::move(event)); if (should_reset_target) { ServerWindow* target = pointer_targets_[pointer_id].window; @@ -319,7 +320,7 @@ void EventDispatcher::DispatchToPointerTarget(const PointerTarget& target, event->pointer_data->location->x = location.x(); event->pointer_data->location->y = location.y(); delegate_->DispatchInputEventToWindow(target.window, target.in_nonclient_area, - event.Pass()); + std::move(event)); } void EventDispatcher::CancelPointerEventsToTarget(ServerWindow* window) { diff --git a/components/mus/ws/event_dispatcher_unittest.cc b/components/mus/ws/event_dispatcher_unittest.cc index 010a017..aec3a69 100644 --- a/components/mus/ws/event_dispatcher_unittest.cc +++ b/components/mus/ws/event_dispatcher_unittest.cc @@ -28,7 +28,7 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate { ~TestEventDispatcherDelegate() override {} mojom::EventPtr GetAndClearLastDispatchedEvent() { - return last_dispatched_event_.Pass(); + return std::move(last_dispatched_event_); } uint32_t GetAndClearLastAccelerator() { @@ -72,7 +72,7 @@ class TestEventDispatcherDelegate : public EventDispatcherDelegate { bool in_nonclient_area, mojom::EventPtr event) override { last_target_ = target; - last_dispatched_event_ = event.Pass(); + last_dispatched_event_ = std::move(event); last_in_nonclient_area_ = in_nonclient_area; } @@ -172,34 +172,34 @@ TEST(EventDispatcherTest, AcceleratorBasic) { uint32_t accelerator_1 = 1; mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher( mus::mojom::KEYBOARD_CODE_W, mus::mojom::EVENT_FLAGS_CONTROL_DOWN); - EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_1, matcher.Pass())); + EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_1, std::move(matcher))); uint32_t accelerator_2 = 2; matcher = mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_N, mus::mojom::EVENT_FLAGS_NONE); - EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_2, matcher.Pass())); + EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_2, std::move(matcher))); // Attempting to add a new accelerator with the same id should fail. matcher = mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_T, mus::mojom::EVENT_FLAGS_NONE); - EXPECT_FALSE(dispatcher.AddAccelerator(accelerator_2, matcher.Pass())); + EXPECT_FALSE(dispatcher.AddAccelerator(accelerator_2, std::move(matcher))); // Adding the accelerator with the same id should succeed once the existing // accelerator is removed. dispatcher.RemoveAccelerator(accelerator_2); matcher = mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_T, mus::mojom::EVENT_FLAGS_NONE); - EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_2, matcher.Pass())); + EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_2, std::move(matcher))); // Attempting to add an accelerator with the same matcher should fail. uint32_t accelerator_3 = 3; matcher = mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_T, mus::mojom::EVENT_FLAGS_NONE); - EXPECT_FALSE(dispatcher.AddAccelerator(accelerator_3, matcher.Pass())); + EXPECT_FALSE(dispatcher.AddAccelerator(accelerator_3, std::move(matcher))); matcher = mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_T, mus::mojom::EVENT_FLAGS_CONTROL_DOWN); - EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_3, matcher.Pass())); + EXPECT_TRUE(dispatcher.AddAccelerator(accelerator_3, std::move(matcher))); } TEST(EventDispatcherTest, EventMatching) { @@ -212,7 +212,7 @@ TEST(EventDispatcherTest, EventMatching) { mojom::EventMatcherPtr matcher = mus::CreateKeyMatcher( mus::mojom::KEYBOARD_CODE_W, mus::mojom::EVENT_FLAGS_CONTROL_DOWN); uint32_t accelerator_1 = 1; - dispatcher.AddAccelerator(accelerator_1, matcher.Pass()); + dispatcher.AddAccelerator(accelerator_1, std::move(matcher)); ui::KeyEvent key(ui::ET_KEY_PRESSED, ui::VKEY_W, ui::EF_CONTROL_DOWN); dispatcher.OnEvent(mojom::Event::From(key)); @@ -234,7 +234,7 @@ TEST(EventDispatcherTest, EventMatching) { uint32_t accelerator_2 = 2; matcher = mus::CreateKeyMatcher(mus::mojom::KEYBOARD_CODE_W, mus::mojom::EVENT_FLAGS_NONE); - dispatcher.AddAccelerator(accelerator_2, matcher.Pass()); + dispatcher.AddAccelerator(accelerator_2, std::move(matcher)); dispatcher.OnEvent(mojom::Event::From(key)); EXPECT_EQ(accelerator_2, event_dispatcher_delegate.GetAndClearLastAccelerator()); diff --git a/components/mus/ws/forwarding_window_manager.cc b/components/mus/ws/forwarding_window_manager.cc index 6b27432..7aad498d 100644 --- a/components/mus/ws/forwarding_window_manager.cc +++ b/components/mus/ws/forwarding_window_manager.cc @@ -25,7 +25,8 @@ mojom::WindowManager* ForwardingWindowManager::GetActiveWindowManager() { void ForwardingWindowManager::OpenWindow( mus::mojom::WindowTreeClientPtr client, mojo::Map<mojo::String, mojo::Array<uint8_t>> properties) { - GetActiveWindowManager()->OpenWindow(client.Pass(), properties.Pass()); + GetActiveWindowManager()->OpenWindow(std::move(client), + std::move(properties)); } void ForwardingWindowManager::GetConfig(const GetConfigCallback& callback) { diff --git a/components/mus/ws/server_window.cc b/components/mus/ws/server_window.cc index c0bcffa..407d698 100644 --- a/components/mus/ws/server_window.cc +++ b/components/mus/ws/server_window.cc @@ -75,8 +75,8 @@ void ServerWindow::RemoveObserver(ServerWindowObserver* observer) { void ServerWindow::CreateSurface(mojom::SurfaceType surface_type, mojo::InterfaceRequest<mojom::Surface> request, mojom::SurfaceClientPtr client) { - GetOrCreateSurfaceManager()->CreateSurface(surface_type, request.Pass(), - client.Pass()); + GetOrCreateSurfaceManager()->CreateSurface(surface_type, std::move(request), + std::move(client)); } void ServerWindow::Add(ServerWindow* child) { diff --git a/components/mus/ws/server_window_surface.cc b/components/mus/ws/server_window_surface.cc index 0ee1a52b..ea97b39 100644 --- a/components/mus/ws/server_window_surface.cc +++ b/components/mus/ws/server_window_surface.cc @@ -37,8 +37,8 @@ ServerWindowSurface::ServerWindowSurface( ->GetSurfacesState() ->manager(), this), - client_(client.Pass()), - binding_(this, request.Pass()) { + client_(std::move(client)), + binding_(this, std::move(request)) { surface_factory_.Create(surface_id_); } diff --git a/components/mus/ws/server_window_surface_manager.cc b/components/mus/ws/server_window_surface_manager.cc index 9b3962e..0661209 100644 --- a/components/mus/ws/server_window_surface_manager.cc +++ b/components/mus/ws/server_window_surface_manager.cc @@ -35,7 +35,7 @@ void ServerWindowSurfaceManager::CreateSurface( mojo::InterfaceRequest<mojom::Surface> request, mojom::SurfaceClientPtr client) { type_to_surface_map_[surface_type] = make_scoped_ptr(new ServerWindowSurface( - this, surface_type, request.Pass(), client.Pass())); + this, surface_type, std::move(request), std::move(client))); } ServerWindowSurface* ServerWindowSurfaceManager::GetDefaultSurface() { diff --git a/components/mus/ws/window_manager_client_apptest.cc b/components/mus/ws/window_manager_client_apptest.cc index 79e6730..0d88e81 100644 --- a/components/mus/ws/window_manager_client_apptest.cc +++ b/components/mus/ws/window_manager_client_apptest.cc @@ -244,7 +244,7 @@ class WindowServerTest : public WindowServerTestBase { ConnectToApplicationAndGetWindowServerClient() { mus::mojom::WindowTreeClientPtr client; application_impl()->ConnectToService(application_impl()->url(), &client); - return client.Pass(); + return client; } // WindowServerTestBase: diff --git a/components/mus/ws/window_tree_apptest.cc b/components/mus/ws/window_tree_apptest.cc index d62f95b..92beb78 100644 --- a/components/mus/ws/window_tree_apptest.cc +++ b/components/mus/ws/window_tree_apptest.cc @@ -70,7 +70,8 @@ bool EmbedUrl(mojo::ApplicationImpl* app, { mojom::WindowTreeClientPtr client; app->ConnectToService(url.get(), &client); - ws->Embed(root_id, client.Pass(), mojom::WindowTree::ACCESS_POLICY_DEFAULT, + ws->Embed(root_id, std::move(client), + mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); } run_loop.Run(); @@ -81,7 +82,8 @@ bool Embed(WindowTree* ws, Id root_id, mojom::WindowTreeClientPtr client) { bool result = false; base::RunLoop run_loop; { - ws->Embed(root_id, client.Pass(), mojom::WindowTree::ACCESS_POLICY_DEFAULT, + ws->Embed(root_id, std::move(client), + mojom::WindowTree::ACCESS_POLICY_DEFAULT, base::Bind(&EmbedCallbackImpl, &run_loop, &result)); } run_loop.Run(); @@ -130,7 +132,7 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, } void Bind(mojo::InterfaceRequest<mojom::WindowTreeClient> request) { - binding_.Bind(request.Pass()); + binding_.Bind(std::move(request)); } mojom::WindowTree* tree() { return tree_.get(); } @@ -214,7 +216,7 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, Id NewWindowWithCompleteId(Id id) { mojo::Map<mojo::String, mojo::Array<uint8_t>> properties; const uint32_t change_id = GetAndAdvanceChangeId(); - tree()->NewWindow(change_id, id, properties.Pass()); + tree()->NewWindow(change_id, id, std::move(properties)); return WaitForChangeCompleted(change_id) ? id : 0; } @@ -227,7 +229,7 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, if (data) mojo_data = Array<uint8_t>::From(*data); const uint32_t change_id = GetAndAdvanceChangeId(); - tree()->SetWindowProperty(change_id, window_id, name, mojo_data.Pass()); + tree()->SetWindowProperty(change_id, window_id, name, std::move(mojo_data)); return WaitForChangeCompleted(change_id); } @@ -268,9 +270,9 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, Id focused_window_id, uint32_t access_policy) override { // TODO(sky): add coverage of |focused_window_id|. - tree_ = tree.Pass(); + tree_ = std::move(tree); connection_id_ = connection_id; - tracker()->OnEmbed(connection_id, root.Pass()); + tracker()->OnEmbed(connection_id, std::move(root)); if (embed_run_loop_) embed_run_loop_->Quit(); } @@ -286,8 +288,8 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, // it is ignored. if (window_id == root_window_id_) return; - tracker()->OnWindowBoundsChanged(window_id, old_bounds.Pass(), - new_bounds.Pass()); + tracker()->OnWindowBoundsChanged(window_id, std::move(old_bounds), + std::move(new_bounds)); } void OnClientAreaChanged( uint32_t window_id, @@ -311,7 +313,7 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, Id old_parent, Array<WindowDataPtr> windows) override { tracker()->OnWindowHierarchyChanged(window, new_parent, old_parent, - windows.Pass()); + std::move(windows)); } void OnWindowReordered(Id window_id, Id relative_window_id, @@ -336,7 +338,7 @@ class TestWindowTreeClientImpl : public mojom::WindowTreeClient, void OnWindowSharedPropertyChanged(uint32_t window, const String& name, Array<uint8_t> new_data) override { - tracker_.OnWindowSharedPropertyChanged(window, name, new_data.Pass()); + tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); } // TODO(sky): add testing coverage. void OnWindowFocused(uint32_t focused_window_id) override {} @@ -398,7 +400,7 @@ class WindowTreeClientFactory run_loop_->Run(); run_loop_.reset(); } - return client_impl_.Pass(); + return std::move(client_impl_); } private: @@ -406,7 +408,7 @@ class WindowTreeClientFactory void Create(ApplicationConnection* connection, InterfaceRequest<WindowTreeClient> request) override { client_impl_.reset(new TestWindowTreeClientImpl(app_)); - client_impl_->Bind(request.Pass()); + client_impl_->Bind(std::move(request)); if (run_loop_.get()) run_loop_->Quit(); } @@ -516,7 +518,7 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, SingleChangeToDescription(*client->tracker()->changes())); if (connection_id) *connection_id = (*client->tracker()->changes())[0].connection_id; - return client.Pass(); + return client; } // ApplicationTestBase: @@ -534,7 +536,7 @@ class WindowTreeAppTest : public mojo::test::ApplicationTestBase, factory->CreateWindowTreeHost(GetProxy(&host_), mojom::WindowTreeHostClientPtr(), - tree_client_ptr.Pass(), nullptr); + std::move(tree_client_ptr), nullptr); // Next we should get an embed call on the "window manager" client. ws_client1_->WaitForIncomingMethodCall(); @@ -1635,8 +1637,8 @@ TEST_F(WindowTreeAppTest, EmbedSupplyingWindowTreeClient) { TestWindowTreeClientImpl client2(application_impl()); mojom::WindowTreeClientPtr client2_ptr; mojo::Binding<WindowTreeClient> client2_binding(&client2, &client2_ptr); - ASSERT_TRUE( - Embed(ws1(), BuildWindowId(connection_id_1(), 1), client2_ptr.Pass())); + ASSERT_TRUE(Embed(ws1(), BuildWindowId(connection_id_1(), 1), + std::move(client2_ptr))); client2.WaitForOnEmbed(); EXPECT_EQ("OnEmbed", SingleChangeToDescription(*client2.tracker()->changes())); diff --git a/components/mus/ws/window_tree_host_connection.cc b/components/mus/ws/window_tree_host_connection.cc index 638b4eb..f488fc4 100644 --- a/components/mus/ws/window_tree_host_connection.cc +++ b/components/mus/ws/window_tree_host_connection.cc @@ -14,7 +14,7 @@ namespace ws { WindowTreeHostConnection::WindowTreeHostConnection( scoped_ptr<WindowTreeHostImpl> host_impl, ConnectionManager* manager) - : host_(host_impl.Pass()), + : host_(std::move(host_impl)), tree_(nullptr), connection_manager_(manager), connection_closed_(false) {} @@ -53,9 +53,9 @@ WindowTreeHostConnectionImpl::WindowTreeHostConnectionImpl( scoped_ptr<WindowTreeHostImpl> host_impl, mojom::WindowTreeClientPtr client, ConnectionManager* manager) - : WindowTreeHostConnection(host_impl.Pass(), manager), - binding_(window_tree_host(), request.Pass()), - client_(client.Pass()) {} + : WindowTreeHostConnection(std::move(host_impl), manager), + binding_(window_tree_host(), std::move(request)), + client_(std::move(client)) {} WindowTreeHostConnectionImpl::~WindowTreeHostConnectionImpl() {} @@ -63,7 +63,7 @@ void WindowTreeHostConnectionImpl::OnDisplayInitialized() { connection_manager()->AddHost(this); set_window_tree(connection_manager()->EmbedAtWindow( kInvalidConnectionId, window_tree_host()->root_window()->id(), - mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, client_.Pass())); + mojom::WindowTree::ACCESS_POLICY_EMBED_ROOT, std::move(client_))); } } // namespace ws diff --git a/components/mus/ws/window_tree_host_impl.cc b/components/mus/ws/window_tree_host_impl.cc index 6206e9c..d3100b7 100644 --- a/components/mus/ws/window_tree_host_impl.cc +++ b/components/mus/ws/window_tree_host_impl.cc @@ -39,11 +39,11 @@ WindowTreeHostImpl::WindowTreeHostImpl( mojom::WindowManagerPtr window_manager) : delegate_(nullptr), connection_manager_(connection_manager), - client_(client.Pass()), + client_(std::move(client)), event_dispatcher_(this), display_manager_( DisplayManager::Create(app_impl, gpu_state, surfaces_state)), - window_manager_(window_manager.Pass()), + window_manager_(std::move(window_manager)), tree_awaiting_input_ack_(nullptr), last_cursor_(0) { display_manager_->Init(this); @@ -165,7 +165,7 @@ void WindowTreeHostImpl::AddAccelerator( uint32_t id, mojom::EventMatcherPtr event_matcher, const AddAcceleratorCallback& callback) { - bool success = event_dispatcher_.AddAccelerator(id, event_matcher.Pass()); + bool success = event_dispatcher_.AddAccelerator(id, std::move(event_matcher)); callback.Run(success); } @@ -211,7 +211,7 @@ void WindowTreeHostImpl::OnClientClosed() { // can destroy the corresponding WindowTreeHostConnection, and |this|. So // setting it to nullptr afterwards in reset() ends up writing on free'd // memory. So transfer over to a local scoped_ptr<> before destroying it. - scoped_ptr<DisplayManager> temp = display_manager_.Pass(); + scoped_ptr<DisplayManager> temp = std::move(display_manager_); } void WindowTreeHostImpl::OnEventAck(mojom::WindowTree* tree) { @@ -234,9 +234,9 @@ void WindowTreeHostImpl::OnEventAckTimeout() { void WindowTreeHostImpl::DispatchNextEventFromQueue() { if (event_queue_.empty()) return; - mojom::EventPtr next_event = event_queue_.front().Pass(); + mojom::EventPtr next_event = std::move(event_queue_.front()); event_queue_.pop(); - event_dispatcher_.OnEvent(next_event.Pass()); + event_dispatcher_.OnEvent(std::move(next_event)); } void WindowTreeHostImpl::UpdateNativeCursor(int32_t cursor_id) { @@ -255,10 +255,10 @@ void WindowTreeHostImpl::OnEvent(mojom::EventPtr event) { // queue up the event to be dispatched once the ack is received. if (event_ack_timer_.IsRunning()) { // TODO(sad): Coalesce if possible. - event_queue_.push(event.Pass()); + event_queue_.push(std::move(event)); return; } - event_dispatcher_.OnEvent(event.Pass()); + event_dispatcher_.OnEvent(std::move(event)); } void WindowTreeHostImpl::OnDisplayClosed() { @@ -379,7 +379,7 @@ void WindowTreeHostImpl::OnFocusChanged( void WindowTreeHostImpl::OnAccelerator(uint32_t accelerator_id, mojom::EventPtr event) { - client()->OnAccelerator(accelerator_id, event.Pass()); + client()->OnAccelerator(accelerator_id, std::move(event)); } void WindowTreeHostImpl::SetFocusedWindowFromEventDispatcher( @@ -415,7 +415,7 @@ void WindowTreeHostImpl::DispatchInputEventToWindow(ServerWindow* target, connection = connection_manager_->GetConnection(target->id().connection_id); } tree_awaiting_input_ack_ = connection; - connection->DispatchInputEvent(target, event.Pass()); + connection->DispatchInputEvent(target, std::move(event)); // TOOD(sad): Adjust this delay, possibly make this dynamic. const base::TimeDelta max_delay = base::debug::BeingDebugged() diff --git a/components/mus/ws/window_tree_impl.cc b/components/mus/ws/window_tree_impl.cc index 1d055c7..568cdc8 100644 --- a/components/mus/ws/window_tree_impl.cc +++ b/components/mus/ws/window_tree_impl.cc @@ -102,7 +102,7 @@ void WindowTreeImpl::Init(mojom::WindowTreeClient* client, const Id focused_window_transport_id(WindowIdToTransportId( focused_window ? focused_window->id() : WindowId())); - client->OnEmbed(id_, WindowToWindowData(to_send.front()), tree.Pass(), + client->OnEmbed(id_, WindowToWindowData(to_send.front()), std::move(tree), focused_window_transport_id, is_embed_root_ ? WindowTree::ACCESS_POLICY_EMBED_ROOT : WindowTree::ACCESS_POLICY_DEFAULT); @@ -219,7 +219,7 @@ bool WindowTreeImpl::Embed(const WindowId& window_id, return false; PrepareForEmbed(window_id); WindowTreeImpl* new_connection = connection_manager_->EmbedAtWindow( - id_, window_id, policy_bitmask, client.Pass()); + id_, window_id, policy_bitmask, std::move(client)); if (is_embed_root_) *connection_id = new_connection->id(); return true; @@ -309,7 +309,7 @@ void WindowTreeImpl::ProcessWindowPropertyChanged( data = Array<uint8_t>::From(*new_data); client()->OnWindowSharedPropertyChanged(WindowIdToTransportId(window->id()), - String(name), data.Pass()); + String(name), std::move(data)); } void WindowTreeImpl::ProcessWindowHierarchyChanged( @@ -558,8 +558,8 @@ Array<mojom::WindowDataPtr> WindowTreeImpl::WindowsToWindowDatas( const std::vector<const ServerWindow*>& windows) { Array<mojom::WindowDataPtr> array(windows.size()); for (size_t i = 0; i < windows.size(); ++i) - array[i] = WindowToWindowData(windows[i]).Pass(); - return array.Pass(); + array[i] = WindowToWindowData(windows[i]); + return array; } mojom::WindowDataPtr WindowTreeImpl::WindowToWindowData( @@ -581,7 +581,7 @@ mojom::WindowDataPtr WindowTreeImpl::WindowToWindowData( window_data->drawn = window->IsDrawn(); window_data->viewport_metrics = connection_manager_->GetViewportMetricsForWindow(window); - return window_data.Pass(); + return window_data; } void WindowTreeImpl::GetWindowTreeImpl( @@ -678,7 +678,7 @@ void WindowTreeImpl::DispatchInputEventImpl(ServerWindow* target, event_ack_id_ = 0x1000000 | (reinterpret_cast<uintptr_t>(event.get()) & 0xffffff); client()->OnWindowInputEvent( - event_ack_id_, WindowIdToTransportId(target->id()), event.Pass()); + event_ack_id_, WindowIdToTransportId(target->id()), std::move(event)); } void WindowTreeImpl::NewWindow( @@ -786,7 +786,7 @@ void WindowTreeImpl::SetWindowBounds(uint32_t change_id, const uint32_t wm_change_id = connection_manager_->GenerateWindowManagerChangeId(this, change_id); GetHost()->GetWindowTree()->client_->WmSetBounds(wm_change_id, window_id, - bounds.Pass()); + std::move(bounds)); return; } @@ -816,7 +816,7 @@ void WindowTreeImpl::SetWindowProperty(uint32_t change_id, const uint32_t wm_change_id = connection_manager_->GenerateWindowManagerChangeId(this, change_id); GetHost()->GetWindowTree()->client_->WmSetProperty(wm_change_id, window_id, - name, value.Pass()); + name, std::move(value)); return; } const bool success = window && access_policy_->CanSetWindowProperties(window); @@ -842,7 +842,7 @@ void WindowTreeImpl::AttachSurface( window && access_policy_->CanSetWindowSurface(window, type); if (!success) return; - window->CreateSurface(type, surface.Pass(), client.Pass()); + window->CreateSurface(type, std::move(surface), std::move(client)); } void WindowTreeImpl::SetWindowTextInputState(Id window_id, @@ -913,7 +913,7 @@ void WindowTreeImpl::Embed(Id transport_window_id, const EmbedCallback& callback) { ConnectionSpecificId connection_id = kInvalidConnectionId; const bool result = Embed(WindowIdFromTransportId(transport_window_id), - client.Pass(), policy_bitmask, &connection_id); + std::move(client), policy_bitmask, &connection_id); callback.Run(result, connection_id); } diff --git a/components/mus/ws/window_tree_unittest.cc b/components/mus/ws/window_tree_unittest.cc index 55f578f..153cd86 100644 --- a/components/mus/ws/window_tree_unittest.cc +++ b/components/mus/ws/window_tree_unittest.cc @@ -54,7 +54,7 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { TestChangeTracker* tracker() { return &tracker_; } void Bind(mojo::InterfaceRequest<mojom::WindowTreeClient> request) { - binding_.Bind(request.Pass()); + binding_.Bind(std::move(request)); } private: @@ -65,7 +65,7 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { Id focused_window_id, uint32_t access_policy) override { // TODO(sky): add test coverage of |focused_window_id|. - tracker_.OnEmbed(connection_id, root.Pass()); + tracker_.OnEmbed(connection_id, std::move(root)); } void OnEmbeddedAppDisconnected(uint32_t window) override { tracker_.OnEmbeddedAppDisconnected(window); @@ -74,8 +74,8 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { void OnWindowBoundsChanged(uint32_t window, mojo::RectPtr old_bounds, mojo::RectPtr new_bounds) override { - tracker_.OnWindowBoundsChanged(window, old_bounds.Pass(), - new_bounds.Pass()); + tracker_.OnWindowBoundsChanged(window, std::move(old_bounds), + std::move(new_bounds)); } void OnClientAreaChanged( uint32_t window_id, @@ -88,15 +88,15 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { void OnWindowViewportMetricsChanged( mojom::ViewportMetricsPtr old_metrics, mojom::ViewportMetricsPtr new_metrics) override { - tracker_.OnWindowViewportMetricsChanged(old_metrics.Pass(), - new_metrics.Pass()); + tracker_.OnWindowViewportMetricsChanged(std::move(old_metrics), + std::move(new_metrics)); } void OnWindowHierarchyChanged(uint32_t window, uint32_t new_parent, uint32_t old_parent, Array<WindowDataPtr> windows) override { tracker_.OnWindowHierarchyChanged(window, new_parent, old_parent, - windows.Pass()); + std::move(windows)); } void OnWindowReordered(uint32_t window_id, uint32_t relative_window_id, @@ -115,12 +115,12 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { void OnWindowSharedPropertyChanged(uint32_t window, const String& name, Array<uint8_t> new_data) override { - tracker_.OnWindowSharedPropertyChanged(window, name, new_data.Pass()); + tracker_.OnWindowSharedPropertyChanged(window, name, std::move(new_data)); } void OnWindowInputEvent(uint32_t event_id, uint32_t window, EventPtr event) override { - tracker_.OnWindowInputEvent(window, event.Pass()); + tracker_.OnWindowInputEvent(window, std::move(event)); } void OnWindowFocused(uint32_t focused_window_id) override { tracker_.OnWindowFocused(focused_window_id); @@ -151,7 +151,7 @@ class TestWindowTreeClient : public mus::mojom::WindowTreeClient { class TestClientConnection : public ClientConnection { public: explicit TestClientConnection(scoped_ptr<WindowTreeImpl> service_impl) - : ClientConnection(service_impl.Pass(), &client_) {} + : ClientConnection(std::move(service_impl), &client_) {} TestWindowTreeClient* client() { return &client_; } @@ -191,7 +191,7 @@ class TestConnectionManagerDelegate : public ConnectionManagerDelegate { // Used by ConnectionManager::AddRoot. scoped_ptr<WindowTreeImpl> service(new WindowTreeImpl( connection_manager, creator_id, root_id, policy_bitmask)); - last_connection_ = new TestClientConnection(service.Pass()); + last_connection_ = new TestClientConnection(std::move(service)); return last_connection_; } @@ -206,7 +206,7 @@ class TestWindowTreeHostConnection : public WindowTreeHostConnection { public: TestWindowTreeHostConnection(scoped_ptr<WindowTreeHostImpl> host_impl, ConnectionManager* manager) - : WindowTreeHostConnection(host_impl.Pass(), manager) {} + : WindowTreeHostConnection(std::move(host_impl), manager) {} ~TestWindowTreeHostConnection() override {} private: @@ -287,7 +287,7 @@ EventPtr CreatePointerDownEvent(int x, int y) { event->pointer_data->location->x = x; event->pointer_data->location->y = y; event->pointer_data->kind = mojom::POINTER_KIND_TOUCH; - return event.Pass(); + return event; } EventPtr CreatePointerUpEvent(int x, int y) { @@ -299,7 +299,7 @@ EventPtr CreatePointerUpEvent(int x, int y) { event->pointer_data->location->x = x; event->pointer_data->location->y = y; event->pointer_data->kind = mojom::POINTER_KIND_TOUCH; - return event.Pass(); + return event; } EventPtr CreateMouseMoveEvent(int x, int y) { @@ -311,7 +311,7 @@ EventPtr CreateMouseMoveEvent(int x, int y) { event->pointer_data->location->x = x; event->pointer_data->location->y = y; event->pointer_data->kind = mojom::POINTER_KIND_MOUSE; - return event.Pass(); + return event; } EventPtr CreateMouseDownEvent(int x, int y) { @@ -319,7 +319,7 @@ EventPtr CreateMouseDownEvent(int x, int y) { event->flags = static_cast<mus::mojom::EventFlags>( event->flags | mojom::EVENT_FLAGS_LEFT_MOUSE_BUTTON); event->pointer_data->kind = mojom::POINTER_KIND_MOUSE; - return event.Pass(); + return event; } EventPtr CreateMouseUpEvent(int x, int y) { @@ -327,7 +327,7 @@ EventPtr CreateMouseUpEvent(int x, int y) { event->flags = static_cast<mus::mojom::EventFlags>( event->flags | mojom::EVENT_FLAGS_LEFT_MOUSE_BUTTON); event->pointer_data->kind = mojom::POINTER_KIND_MOUSE; - return event.Pass(); + return event; } } // namespace @@ -363,7 +363,7 @@ class WindowTreeTest : public testing::Test { TestWindowTreeHostConnection* host_connection() { return host_connection_; } void DispatchEventWithoutAck(mojom::EventPtr event) { - host_connection()->window_tree_host()->OnEvent(event.Pass()); + host_connection()->window_tree_host()->OnEvent(std::move(event)); } void AckPreviousEvent() { @@ -373,7 +373,7 @@ class WindowTreeTest : public testing::Test { } void DispatchEventAndAckImmediately(mojom::EventPtr event) { - DispatchEventWithoutAck(event.Pass()); + DispatchEventWithoutAck(std::move(event)); AckPreviousEvent(); } @@ -430,9 +430,9 @@ void WindowTreeTest::SetupEventTargeting( mojom::WindowTreeClientPtr client; mojo::InterfaceRequest<mojom::WindowTreeClient> client_request = GetProxy(&client); - wm_client()->Bind(client_request.Pass()); + wm_client()->Bind(std::move(client_request)); ConnectionSpecificId connection_id = 0; - wm_connection()->Embed(embed_window_id, client.Pass(), + wm_connection()->Embed(embed_window_id, std::move(client), mojom::WindowTree::ACCESS_POLICY_DEFAULT, &connection_id); WindowTreeImpl* connection1 = @@ -477,10 +477,9 @@ TEST_F(WindowTreeTest, FocusOnPointer) { mojom::WindowTreeClientPtr client; mojo::InterfaceRequest<mojom::WindowTreeClient> client_request = GetProxy(&client); - wm_client()->Bind(client_request.Pass()); + wm_client()->Bind(std::move(client_request)); ConnectionSpecificId connection_id = 0; - wm_connection()->Embed(embed_window_id, - client.Pass(), + wm_connection()->Embed(embed_window_id, std::move(client), mojom::WindowTree::ACCESS_POLICY_DEFAULT, &connection_id); WindowTreeImpl* connection1 = |