diff options
author | dcheng <dcheng@chromium.org> | 2015-12-30 09:11:23 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-30 17:12:34 +0000 |
commit | 34e0e082ff62320a32a56d8b4e61eca1101bb9a5 (patch) | |
tree | 7229e264ba6416088a57bdc59c225a1290b6b373 | |
parent | c13951a2c9f30a13d03a1a0310f9a79b66656c36 (diff) | |
download | chromium_src-34e0e082ff62320a32a56d8b4e61eca1101bb9a5.zip chromium_src-34e0e082ff62320a32a56d8b4e61eca1101bb9a5.tar.gz chromium_src-34e0e082ff62320a32a56d8b4e61eca1101bb9a5.tar.bz2 |
Global conversion of Pass()→std::move(): Linux GN static library edition
😵 There's so many different build configs...
BUG=557422
R=avi@chromium.org
TBR=jam@chromium.org
Review URL: https://codereview.chromium.org/1552763002
Cr-Commit-Position: refs/heads/master@{#367158}
7 files changed, 45 insertions, 33 deletions
diff --git a/components/devtools_service/devtools_agent_host.cc b/components/devtools_service/devtools_agent_host.cc index 30b2287..3f0cae2 100644 --- a/components/devtools_service/devtools_agent_host.cc +++ b/components/devtools_service/devtools_agent_host.cc @@ -4,11 +4,13 @@ #include "components/devtools_service/devtools_agent_host.h" +#include <utility> + namespace devtools_service { DevToolsAgentHost::DevToolsAgentHost(const std::string& id, DevToolsAgentPtr agent) - : id_(id), agent_(agent.Pass()), binding_(this), delegate_(nullptr) {} + : id_(id), agent_(std::move(agent)), binding_(this), delegate_(nullptr) {} DevToolsAgentHost::~DevToolsAgentHost() { if (delegate_) @@ -23,7 +25,7 @@ void DevToolsAgentHost::SetDelegate(Delegate* delegate) { DevToolsAgentClientPtr client; binding_.Bind(&client); - agent_->SetClient(client.Pass()); + agent_->SetClient(std::move(client)); } else { if (!binding_.is_bound()) return; diff --git a/components/devtools_service/devtools_http_server.cc b/components/devtools_service/devtools_http_server.cc index c3848cb..28dff65 100644 --- a/components/devtools_service/devtools_http_server.cc +++ b/components/devtools_service/devtools_http_server.cc @@ -6,8 +6,8 @@ #include <stddef.h> #include <string.h> - #include <string> +#include <utility> #include "base/bind.h" #include "base/json/json_writer.h" @@ -103,13 +103,13 @@ mojo::HttpResponsePtr MakeResponse(uint32_t status_code, options.element_num_bytes = 1; options.capacity_num_bytes = num_bytes; mojo::DataPipe data_pipe(options); - response->body = data_pipe.consumer_handle.Pass(); + response->body = std::move(data_pipe.consumer_handle); MojoResult result = WriteDataRaw(data_pipe.producer_handle.get(), body.data(), &num_bytes, MOJO_WRITE_DATA_FLAG_ALL_OR_NONE); CHECK_EQ(MOJO_RESULT_OK, result); } - return response.Pass(); + return response; } mojo::HttpResponsePtr MakeJsonResponse(uint32_t status_code, @@ -146,9 +146,9 @@ class WebSocketRelayer : public DevToolsAgentHost::Delegate, DCHECK(send_stream.is_valid()); mojo::WebSocketClientPtr web_socket_client; - new WebSocketRelayer(agent_host, web_socket.Pass(), send_stream.Pass(), - &web_socket_client); - return web_socket_client.Pass(); + new WebSocketRelayer(agent_host, std::move(web_socket), + std::move(send_stream), &web_socket_client); + return web_socket_client; } private: @@ -158,8 +158,8 @@ class WebSocketRelayer : public DevToolsAgentHost::Delegate, mojo::WebSocketClientPtr* web_socket_client) : agent_host_(agent_host), binding_(this, web_socket_client), - web_socket_(web_socket.Pass()), - send_stream_(send_stream.Pass()), + web_socket_(std::move(web_socket)), + send_stream_(std::move(send_stream)), write_send_stream_(new mojo::WebSocketWriteQueue(send_stream_.get())), pending_send_count_(0), pending_receive_count_(0) { @@ -208,7 +208,7 @@ class WebSocketRelayer : public DevToolsAgentHost::Delegate, void DidConnect(const mojo::String& selected_subprotocol, const mojo::String& extensions, mojo::ScopedDataPipeConsumerHandle receive_stream) override { - receive_stream_ = receive_stream.Pass(); + receive_stream_ = std::move(receive_stream); read_receive_stream_.reset( new mojo::WebSocketReadQueue(receive_stream_.get())); } @@ -298,8 +298,8 @@ class DevToolsHttpServer::HttpConnectionDelegateImpl mojo::HttpConnectionPtr connection, mojo::InterfaceRequest<HttpConnectionDelegate> delegate_request) : owner_(owner), - connection_(connection.Pass()), - binding_(this, delegate_request.Pass()) { + connection_(std::move(connection)), + binding_(this, std::move(delegate_request)) { DCHECK(owner_); DCHECK(connection_); DCHECK(binding_.is_bound()); @@ -315,13 +315,13 @@ class DevToolsHttpServer::HttpConnectionDelegateImpl // mojo::HttpConnectionDelegate implementation: void OnReceivedRequest(mojo::HttpRequestPtr request, const OnReceivedRequestCallback& callback) override { - owner_->OnReceivedRequest(this, request.Pass(), callback); + owner_->OnReceivedRequest(this, std::move(request), callback); } void OnReceivedWebSocketRequest( mojo::HttpRequestPtr request, const OnReceivedWebSocketRequestCallback& callback) override { - owner_->OnReceivedWebSocketRequest(this, request.Pass(), callback); + owner_->OnReceivedWebSocketRequest(this, std::move(request), callback); } DevToolsHttpServer* const owner_; @@ -354,7 +354,7 @@ DevToolsHttpServer::DevToolsHttpServer(DevToolsService* service, http_server_delegate_binding_.reset( new mojo::Binding<mojo::HttpServerDelegate>(this, &http_server_delegate)); network_service->CreateHttpServer( - local_address.Pass(), http_server_delegate.Pass(), + std::move(local_address), std::move(http_server_delegate), mojo::NetworkService::CreateHttpServerCallback()); } @@ -365,8 +365,8 @@ DevToolsHttpServer::~DevToolsHttpServer() { void DevToolsHttpServer::OnConnected( mojo::HttpConnectionPtr connection, mojo::InterfaceRequest<mojo::HttpConnectionDelegate> delegate) { - connections_.insert( - new HttpConnectionDelegateImpl(this, connection.Pass(), delegate.Pass())); + connections_.insert(new HttpConnectionDelegateImpl( + this, std::move(connection), std::move(delegate))); } void DevToolsHttpServer::OnReceivedRequest( @@ -376,9 +376,9 @@ void DevToolsHttpServer::OnReceivedRequest( DCHECK(connections_.find(connection) != connections_.end()); if (request->url.get().find(kJsonRequestUrlPrefix) == 0) { - mojo::HttpResponsePtr response = ProcessJsonRequest(request.Pass()); + mojo::HttpResponsePtr response = ProcessJsonRequest(std::move(request)); if (response) - callback.Run(response.Pass()); + callback.Run(std::move(response)); else OnConnectionClosed(connection); } else { @@ -421,9 +421,10 @@ void DevToolsHttpServer::OnReceivedWebSocketRequest( mojo::GetProxy(&web_socket); mojo::DataPipe data_pipe; mojo::WebSocketClientPtr web_socket_client = WebSocketRelayer::SetUp( - agent, web_socket.Pass(), data_pipe.producer_handle.Pass()); - callback.Run(web_socket_request.Pass(), data_pipe.consumer_handle.Pass(), - web_socket_client.Pass()); + agent, std::move(web_socket), std::move(data_pipe.producer_handle)); + callback.Run(std::move(web_socket_request), + std::move(data_pipe.consumer_handle), + std::move(web_socket_client)); } void DevToolsHttpServer::OnConnectionClosed( @@ -491,7 +492,7 @@ mojo::HttpResponsePtr DevToolsHttpServer::ProcessJsonRequest( kTargetWebSocketDebuggerUrlField, base::StringPrintf("ws://%s%s%s", host.c_str(), kPageUrlPrefix, iter.value()->id().c_str())); - list_value.Append(dict_value.Pass()); + list_value.Append(std::move(dict_value)); } return MakeJsonResponse(200, &list_value, std::string()); } diff --git a/components/devtools_service/devtools_registry_impl.cc b/components/devtools_service/devtools_registry_impl.cc index 5e402e8..6dfe242 100644 --- a/components/devtools_service/devtools_registry_impl.cc +++ b/components/devtools_service/devtools_registry_impl.cc @@ -4,6 +4,8 @@ #include "components/devtools_service/devtools_registry_impl.h" +#include <utility> + #include "base/logging.h" #include "components/devtools_service/devtools_agent_host.h" @@ -25,7 +27,7 @@ DevToolsRegistryImpl::~DevToolsRegistryImpl() { void DevToolsRegistryImpl::BindToRegistryRequest( mojo::InterfaceRequest<DevToolsRegistry> request) { - bindings_.AddBinding(this, request.Pass()); + bindings_.AddBinding(this, std::move(request)); } DevToolsAgentHost* DevToolsRegistryImpl::GetAgentById(const std::string& id) { @@ -39,7 +41,7 @@ DevToolsAgentHost* DevToolsRegistryImpl::GetAgentById(const std::string& id) { void DevToolsRegistryImpl::RegisterAgent(const mojo::String& id, DevToolsAgentPtr agent) { linked_ptr<DevToolsAgentHost> agent_host( - new DevToolsAgentHost(id, agent.Pass())); + new DevToolsAgentHost(id, std::move(agent))); agent_host->set_agent_connection_error_handler( [this, id]() { OnAgentConnectionError(id); }); diff --git a/components/devtools_service/devtools_service.cc b/components/devtools_service/devtools_service.cc index 36a8309..f2b47046 100644 --- a/components/devtools_service/devtools_service.cc +++ b/components/devtools_service/devtools_service.cc @@ -4,6 +4,8 @@ #include "components/devtools_service/devtools_service.h" +#include <utility> + #include "base/logging.h" #include "components/devtools_service/devtools_http_server.h" #include "mojo/application/public/cpp/application_impl.h" @@ -20,7 +22,7 @@ DevToolsService::~DevToolsService() { void DevToolsService::BindToCoordinatorRequest( mojo::InterfaceRequest<DevToolsCoordinator> request) { - coordinator_bindings_.AddBinding(this, request.Pass()); + coordinator_bindings_.AddBinding(this, std::move(request)); } void DevToolsService::Initialize(uint16_t remote_debugging_port) { diff --git a/components/devtools_service/devtools_service_delegate.cc b/components/devtools_service/devtools_service_delegate.cc index ae96d2c..c59e970a 100644 --- a/components/devtools_service/devtools_service_delegate.cc +++ b/components/devtools_service/devtools_service_delegate.cc @@ -4,6 +4,8 @@ #include "components/devtools_service/devtools_service_delegate.h" +#include <utility> + #include "base/logging.h" #include "components/devtools_service/devtools_registry_impl.h" #include "components/devtools_service/devtools_service.h" @@ -52,13 +54,13 @@ void DevToolsServiceDelegate::Quit() { void DevToolsServiceDelegate::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<DevToolsRegistry> request) { - service_->registry()->BindToRegistryRequest(request.Pass()); + service_->registry()->BindToRegistryRequest(std::move(request)); } void DevToolsServiceDelegate::Create( mojo::ApplicationConnection* connection, mojo::InterfaceRequest<DevToolsCoordinator> request) { - service_->BindToCoordinatorRequest(request.Pass()); + service_->BindToCoordinatorRequest(std::move(request)); } } // namespace devtools_service diff --git a/device/devices_app/devices_apptest.cc b/device/devices_app/devices_apptest.cc index ff41a1a..b6b1503 100644 --- a/device/devices_app/devices_apptest.cc +++ b/device/devices_app/devices_apptest.cc @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/macros.h" @@ -47,7 +49,7 @@ TEST_F(DevicesAppTest, GetUSBDevices) { options->filters = mojo::Array<usb::DeviceFilterPtr>(1); options->filters[0] = usb::DeviceFilter::New(); usb_device_manager()->GetDevices( - options.Pass(), base::Bind(&OnGetDevices, loop.QuitClosure())); + std::move(options), base::Bind(&OnGetDevices, loop.QuitClosure())); loop.Run(); } diff --git a/media/cast/receiver/frame_receiver_unittest.cc b/media/cast/receiver/frame_receiver_unittest.cc index f01b385..c4c5038 100644 --- a/media/cast/receiver/frame_receiver_unittest.cc +++ b/media/cast/receiver/frame_receiver_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 "media/cast/receiver/frame_receiver.h" + #include <stddef.h> #include <stdint.h> - #include <deque> +#include <utility> #include "base/bind.h" #include "base/macros.h" @@ -18,7 +20,6 @@ #include "media/cast/net/mock_cast_transport_sender.h" #include "media/cast/net/rtcp/rtcp_utility.h" #include "media/cast/net/rtcp/test_rtcp_packet_builder.h" -#include "media/cast/receiver/frame_receiver.h" #include "media/cast/test/fake_single_thread_task_runner.h" #include "media/cast/test/utility/default_config.h" #include "testing/gmock/include/gmock/gmock.h" @@ -129,7 +130,7 @@ class FrameReceiverTest : public ::testing::Test { TestRtcpPacketBuilder rtcp_packet; rtcp_packet.AddSrWithNtp(config_.sender_ssrc, ntp_seconds, ntp_fraction, rtp_timestamp.lower_32_bits()); - ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket().Pass())); + ASSERT_TRUE(receiver_->ProcessPacket(rtcp_packet.GetPacket())); } FrameReceiverConfig config_; |