diff options
author | sergeyu <sergeyu@chromium.org> | 2015-12-23 16:20:51 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-12-24 00:22:13 +0000 |
commit | 42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a (patch) | |
tree | 5d69f8f65e9c3b096bb03f0256b155c745925bed /remoting | |
parent | 2e53cb5448df90f11940a2e55ef6c74bd74ac3e7 (diff) | |
download | chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.zip chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.tar.gz chromium_src-42ad7c02c6aacbd7e8427cc062de5b6c4d596e5a.tar.bz2 |
Use std::move() instead of .Pass() in remoting/*
Now there is a presubmit check that doesn't allow Pass() anymore.
See https://www.chromium.org/rvalue-references for information
about std::move in chromium.
Review URL: https://codereview.chromium.org/1545723002
Cr-Commit-Position: refs/heads/master@{#366778}
Diffstat (limited to 'remoting')
46 files changed, 227 insertions, 203 deletions
diff --git a/remoting/base/auto_thread.cc b/remoting/base/auto_thread.cc index dd7cc17..c55a761 100644 --- a/remoting/base/auto_thread.cc +++ b/remoting/base/auto_thread.cc @@ -31,7 +31,7 @@ scoped_ptr<base::win::ScopedCOMInitializer> CreateComInitializer( } else if (type == AutoThread::COM_INIT_STA) { initializer.reset(new base::win::ScopedCOMInitializer()); } - return initializer.Pass(); + return initializer; } #endif diff --git a/remoting/base/buffered_socket_writer.cc b/remoting/base/buffered_socket_writer.cc index 827abca..405e37b 100644 --- a/remoting/base/buffered_socket_writer.cc +++ b/remoting/base/buffered_socket_writer.cc @@ -40,11 +40,10 @@ scoped_ptr<BufferedSocketWriter> BufferedSocketWriter::CreateForSocket( const WriteFailedCallback& write_failed_callback) { scoped_ptr<BufferedSocketWriter> result(new BufferedSocketWriter()); result->Init(base::Bind(&WriteNetSocket, socket), write_failed_callback); - return result.Pass(); + return result; } -BufferedSocketWriter::BufferedSocketWriter() : weak_factory_(this) { -} +BufferedSocketWriter::BufferedSocketWriter() : weak_factory_(this) {} BufferedSocketWriter::~BufferedSocketWriter() { STLDeleteElements(&queue_); diff --git a/remoting/base/rsa_key_pair.cc b/remoting/base/rsa_key_pair.cc index 66688e9..98a153b 100644 --- a/remoting/base/rsa_key_pair.cc +++ b/remoting/base/rsa_key_pair.cc @@ -8,6 +8,7 @@ #include <limits> #include <string> +#include <utility> #include <vector> #include "base/base64.h" @@ -21,7 +22,7 @@ namespace remoting { RsaKeyPair::RsaKeyPair(scoped_ptr<crypto::RSAPrivateKey> key) - : key_(key.Pass()){ + : key_(std::move(key)){ DCHECK(key_); } @@ -34,7 +35,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::Generate() { LOG(ERROR) << "Cannot generate private key."; return NULL; } - return new RsaKeyPair(key.Pass()); + return new RsaKeyPair(std::move(key)); } // static @@ -54,7 +55,7 @@ scoped_refptr<RsaKeyPair> RsaKeyPair::FromString( return NULL; } - return new RsaKeyPair(key.Pass()); + return new RsaKeyPair(std::move(key)); } std::string RsaKeyPair::ToString() const { diff --git a/remoting/base/typed_buffer_unittest.cc b/remoting/base/typed_buffer_unittest.cc index 0c036fb..ae1561c 100644 --- a/remoting/base/typed_buffer_unittest.cc +++ b/remoting/base/typed_buffer_unittest.cc @@ -3,6 +3,9 @@ // found in the LICENSE file. #include "remoting/base/typed_buffer.h" + +#include <utility> + #include "testing/gtest/include/gtest/gtest.h" namespace remoting { @@ -57,7 +60,7 @@ TEST(TypedBufferTest, Pass) { EXPECT_EQ(right.length(), sizeof(int)); Data* raw_ptr = right.get(); - left = right.Pass(); + left = std::move(right); // Verify that passing ownership transfers both the buffer pointer and its // length. diff --git a/remoting/base/url_request_context_getter.cc b/remoting/base/url_request_context_getter.cc index 31aecbb..09780bd 100644 --- a/remoting/base/url_request_context_getter.cc +++ b/remoting/base/url_request_context_getter.cc @@ -4,6 +4,8 @@ #include "remoting/base/url_request_context_getter.h" +#include <utility> + #include "base/single_thread_task_runner.h" #include "net/proxy/proxy_config_service.h" #include "net/url_request/url_request_context.h" @@ -28,8 +30,8 @@ net::URLRequestContext* URLRequestContextGetter::GetURLRequestContext() { net_log_.reset(new VlogNetLog()); builder.set_net_log(net_log_.get()); builder.DisableHttpCache(); - builder.set_proxy_config_service(proxy_config_service_.Pass()); - url_request_context_ = builder.Build().Pass(); + builder.set_proxy_config_service(std::move(proxy_config_service_)); + url_request_context_ = builder.Build(); } return url_request_context_.get(); } diff --git a/remoting/client/audio_decode_scheduler.cc b/remoting/client/audio_decode_scheduler.cc index ac006dd..976d7a4 100644 --- a/remoting/client/audio_decode_scheduler.cc +++ b/remoting/client/audio_decode_scheduler.cc @@ -4,6 +4,8 @@ #include "remoting/client/audio_decode_scheduler.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/macros.h" @@ -53,11 +55,9 @@ AudioDecodeScheduler::Core::Core( scoped_ptr<AudioPlayer> audio_player) : main_task_runner_(main_task_runner), audio_decode_task_runner_(audio_decode_task_runner), - audio_player_(audio_player.Pass()) { -} + audio_player_(std::move(audio_player)) {} -AudioDecodeScheduler::Core::~Core() { -} +AudioDecodeScheduler::Core::~Core() {} void AudioDecodeScheduler::Core::Initialize( const protocol::SessionConfig& config) { @@ -83,7 +83,7 @@ void AudioDecodeScheduler::Core::DecodePacket( scoped_ptr<AudioPacket> packet, const base::Closure& done) { DCHECK(audio_decode_task_runner_->BelongsToCurrentThread()); - scoped_ptr<AudioPacket> decoded_packet = decoder_->Decode(packet.Pass()); + scoped_ptr<AudioPacket> decoded_packet = decoder_->Decode(std::move(packet)); main_task_runner_->PostTask(FROM_HERE, base::Bind( &AudioDecodeScheduler::Core::ProcessDecodedPacket, this, @@ -96,7 +96,7 @@ void AudioDecodeScheduler::Core::ProcessDecodedPacket( DCHECK(main_task_runner_->BelongsToCurrentThread()); // Only process |packet| if it is non-null. if (packet.get() && audio_player_.get()) - audio_player_->ProcessAudioPacket(packet.Pass()); + audio_player_->ProcessAudioPacket(std::move(packet)); done.Run(); } @@ -105,7 +105,7 @@ AudioDecodeScheduler::AudioDecodeScheduler( scoped_refptr<base::SingleThreadTaskRunner> audio_decode_task_runner, scoped_ptr<AudioPlayer> audio_player) : core_(new Core(main_task_runner, audio_decode_task_runner, - audio_player.Pass())) { + std::move(audio_player))) { } AudioDecodeScheduler::~AudioDecodeScheduler() { @@ -118,7 +118,7 @@ void AudioDecodeScheduler::Initialize(const protocol::SessionConfig& config) { void AudioDecodeScheduler::ProcessAudioPacket(scoped_ptr<AudioPacket> packet, const base::Closure& done) { - core_->ProcessAudioPacket(packet.Pass(), done); + core_->ProcessAudioPacket(std::move(packet), done); } } // namespace remoting diff --git a/remoting/client/audio_player_unittest.cc b/remoting/client/audio_player_unittest.cc index 0e5381e..1bfb86f 100644 --- a/remoting/client/audio_player_unittest.cc +++ b/remoting/client/audio_player_unittest.cc @@ -99,7 +99,7 @@ scoped_ptr<AudioPacket> CreatePacketWithSamplingRate( data.resize(samples * kAudioSampleBytes, kDummyAudioData); packet->add_data(data); - return packet.Pass(); + return packet; } scoped_ptr<AudioPacket> CreatePacket44100Hz(int samples) { diff --git a/remoting/client/chromoting_client.cc b/remoting/client/chromoting_client.cc index 2086553..4e5b53e 100644 --- a/remoting/client/chromoting_client.cc +++ b/remoting/client/chromoting_client.cc @@ -4,6 +4,8 @@ #include "remoting/client/chromoting_client.h" +#include <utility> + #include "remoting/base/capabilities.h" #include "remoting/client/audio_decode_scheduler.h" #include "remoting/client/audio_player.h" @@ -32,7 +34,7 @@ ChromotingClient::ChromotingClient(ClientContext* client_context, if (audio_player) { audio_decode_scheduler_.reset(new AudioDecodeScheduler( client_context->main_task_runner(), - client_context->audio_decode_task_runner(), audio_player.Pass())); + client_context->audio_decode_task_runner(), std::move(audio_player))); } } @@ -41,9 +43,14 @@ ChromotingClient::~ChromotingClient() { signal_strategy_->RemoveListener(this); } +void ChromotingClient::set_protocol_config( + scoped_ptr<protocol::CandidateSessionConfig> config) { + protocol_config_ = std::move(config); +} + void ChromotingClient::SetConnectionToHostForTests( scoped_ptr<protocol::ConnectionToHost> connection_to_host) { - connection_ = connection_to_host.Pass(); + connection_ = std::move(connection_to_host); } void ChromotingClient::Start( @@ -71,9 +78,9 @@ void ChromotingClient::Start( protocol_config_ = protocol::CandidateSessionConfig::CreateDefault(); if (!audio_decode_scheduler_) protocol_config_->DisableAudioChannel(); - session_manager_->set_protocol_config(protocol_config_.Pass()); + session_manager_->set_protocol_config(std::move(protocol_config_)); - authenticator_ = authenticator.Pass(); + authenticator_ = std::move(authenticator); signal_strategy_ = signal_strategy; signal_strategy_->AddListener(this); @@ -195,7 +202,7 @@ bool ChromotingClient::OnSignalStrategyIncomingStanza( void ChromotingClient::StartConnection() { DCHECK(thread_checker_.CalledOnValidThread()); connection_->Connect( - session_manager_->Connect(host_jid_, authenticator_.Pass()), this); + session_manager_->Connect(host_jid_, std::move(authenticator_)), this); } void ChromotingClient::OnAuthenticated() { diff --git a/remoting/client/chromoting_client.h b/remoting/client/chromoting_client.h index 1079018..1fe71fa 100644 --- a/remoting/client/chromoting_client.h +++ b/remoting/client/chromoting_client.h @@ -55,10 +55,7 @@ class ChromotingClient : public SignalStrategy::Listener, ~ChromotingClient() override; - void set_protocol_config( - scoped_ptr<protocol::CandidateSessionConfig> config) { - protocol_config_ = config.Pass(); - } + void set_protocol_config(scoped_ptr<protocol::CandidateSessionConfig> config); // Used to set fake/mock objects for tests which use the ChromotingClient. void SetConnectionToHostForTests( diff --git a/remoting/client/jni/chromoting_jni_instance.cc b/remoting/client/jni/chromoting_jni_instance.cc index 02a701f..82c34e9 100644 --- a/remoting/client/jni/chromoting_jni_instance.cc +++ b/remoting/client/jni/chromoting_jni_instance.cc @@ -7,6 +7,8 @@ #include <android/log.h> #include <stdint.h> +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "jingle/glue/thread_wrapper.h" @@ -86,7 +88,7 @@ ChromotingJniInstance::ChromotingJniInstance(ChromotingJniRuntime* jni_runtime, authenticator_.reset(new protocol::NegotiatingClientAuthenticator( pairing_id, pairing_secret, host_id_, base::Bind(&ChromotingJniInstance::FetchSecret, this), - token_fetcher.Pass(), auth_methods)); + std::move(token_fetcher), auth_methods)); // Post a task to start connection jni_runtime_->network_task_runner()->PostTask( @@ -430,10 +432,10 @@ void ChromotingJniInstance::ConnectToHostOnNetworkThread() { scoped_refptr<protocol::TransportContext> transport_context = new protocol::TransportContext( - signaling_.get(), port_allocator_factory.Pass(), network_settings, + signaling_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::CLIENT); - client_->Start(signaling_.get(), authenticator_.Pass(), transport_context, + client_->Start(signaling_.get(), std::move(authenticator_), transport_context, host_jid_, capabilities_); } diff --git a/remoting/client/plugin/chromoting_instance.cc b/remoting/client/plugin/chromoting_instance.cc index 1c23317..e791ce0 100644 --- a/remoting/client/plugin/chromoting_instance.cc +++ b/remoting/client/plugin/chromoting_instance.cc @@ -4,12 +4,13 @@ #include "remoting/client/plugin/chromoting_instance.h" -#include <string> -#include <vector> - #include <nacl_io/nacl_io.h> #include <sys/mount.h> +#include <string> +#include <utility> +#include <vector> + #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" @@ -187,8 +188,7 @@ ChromotingInstance::ChromotingInstance(PP_Instance pp_instance) rtc::InitRandom(random_seed, sizeof(random_seed)); // Send hello message. - scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); - PostLegacyJsonMessage("hello", data.Pass()); + PostLegacyJsonMessage("hello", make_scoped_ptr(new base::DictionaryValue())); } ChromotingInstance::~ChromotingInstance() { @@ -336,8 +336,8 @@ void ChromotingInstance::OnVideoDecodeError() { } void ChromotingInstance::OnVideoFirstFrameReceived() { - scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); - PostLegacyJsonMessage("onFirstFrameReceived", data.Pass()); + PostLegacyJsonMessage("onFirstFrameReceived", + make_scoped_ptr(new base::DictionaryValue())); } void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size, @@ -352,7 +352,7 @@ void ChromotingInstance::OnVideoSize(const webrtc::DesktopSize& size, data->SetInteger("x_dpi", dpi.x()); if (dpi.y()) data->SetInteger("y_dpi", dpi.y()); - PostLegacyJsonMessage("onDesktopSize", data.Pass()); + PostLegacyJsonMessage("onDesktopSize", std::move(data)); } void ChromotingInstance::OnVideoShape(const webrtc::DesktopRegion* shape) { @@ -377,7 +377,7 @@ void ChromotingInstance::OnVideoShape(const webrtc::DesktopRegion* shape) { shape_message->Set("rects", rects_value.release()); } - PostLegacyJsonMessage("onDesktopShape", shape_message.Pass()); + PostLegacyJsonMessage("onDesktopShape", std::move(shape_message)); } void ChromotingInstance::OnVideoFrameDirtyRegion( @@ -396,7 +396,7 @@ void ChromotingInstance::OnVideoFrameDirtyRegion( scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->Set("rects", rects_value.release()); - PostLegacyJsonMessage("onDebugRegion", data.Pass()); + PostLegacyJsonMessage("onDebugRegion", std::move(data)); } void ChromotingInstance::OnConnectionState( @@ -456,7 +456,7 @@ void ChromotingInstance::OnConnectionState( scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("state", protocol::ConnectionToHost::StateToString(state)); data->SetString("error", ConnectionErrorToString(error)); - PostLegacyJsonMessage("onConnectionStatus", data.Pass()); + PostLegacyJsonMessage("onConnectionStatus", std::move(data)); } void ChromotingInstance::FetchThirdPartyToken( @@ -473,13 +473,13 @@ void ChromotingInstance::FetchThirdPartyToken( data->SetString("tokenUrl", token_url.spec()); data->SetString("hostPublicKey", host_public_key); data->SetString("scope", scope); - PostLegacyJsonMessage("fetchThirdPartyToken", data.Pass()); + PostLegacyJsonMessage("fetchThirdPartyToken", std::move(data)); } void ChromotingInstance::OnConnectionReady(bool ready) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetBoolean("ready", ready); - PostLegacyJsonMessage("onConnectionReady", data.Pass()); + PostLegacyJsonMessage("onConnectionReady", std::move(data)); } void ChromotingInstance::OnRouteChanged(const std::string& channel_name, @@ -488,13 +488,13 @@ void ChromotingInstance::OnRouteChanged(const std::string& channel_name, data->SetString("channel", channel_name); data->SetString("connectionType", protocol::TransportRoute::GetTypeString(route.type)); - PostLegacyJsonMessage("onRouteChanged", data.Pass()); + PostLegacyJsonMessage("onRouteChanged", std::move(data)); } void ChromotingInstance::SetCapabilities(const std::string& capabilities) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("capabilities", capabilities); - PostLegacyJsonMessage("setCapabilities", data.Pass()); + PostLegacyJsonMessage("setCapabilities", std::move(data)); } void ChromotingInstance::SetPairingResponse( @@ -502,7 +502,7 @@ void ChromotingInstance::SetPairingResponse( scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("clientId", pairing_response.client_id()); data->SetString("sharedSecret", pairing_response.shared_secret()); - PostLegacyJsonMessage("pairingResponse", data.Pass()); + PostLegacyJsonMessage("pairingResponse", std::move(data)); } void ChromotingInstance::DeliverHostMessage( @@ -510,7 +510,7 @@ void ChromotingInstance::DeliverHostMessage( scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("type", message.type()); data->SetString("data", message.data()); - PostLegacyJsonMessage("extensionMessage", data.Pass()); + PostLegacyJsonMessage("extensionMessage", std::move(data)); } void ChromotingInstance::FetchSecretFromDialog( @@ -523,7 +523,7 @@ void ChromotingInstance::FetchSecretFromDialog( secret_fetched_callback_ = secret_fetched_callback; scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetBoolean("pairingSupported", pairing_supported); - PostLegacyJsonMessage("fetchPin", data.Pass()); + PostLegacyJsonMessage("fetchPin", std::move(data)); } void ChromotingInstance::FetchSecretFromString( @@ -548,7 +548,7 @@ void ChromotingInstance::InjectClipboardEvent( scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("mimeType", event.mime_type()); data->SetString("item", event.data()); - PostLegacyJsonMessage("injectClipboardItem", data.Pass()); + PostLegacyJsonMessage("injectClipboardItem", std::move(data)); } void ChromotingInstance::SetCursorShape( @@ -676,9 +676,9 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { if (!plugin_view_.is_null()) video_renderer_->OnViewChanged(plugin_view_); - scoped_ptr<AudioPlayer> audio_player(new PepperAudioPlayer(this)); - client_.reset(new ChromotingClient(&context_, this, video_renderer_.get(), - audio_player.Pass())); + client_.reset( + new ChromotingClient(&context_, this, video_renderer_.get(), + make_scoped_ptr(new PepperAudioPlayer(this)))); // Connect the input pipeline to the protocol stub & initialize components. mouse_input_filter_.set_input_stub(client_->input_stub()); @@ -721,7 +721,7 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { scoped_ptr<protocol::Authenticator> authenticator( new protocol::NegotiatingClientAuthenticator( client_pairing_id, client_paired_secret, authentication_tag, - fetch_secret_callback, token_fetcher.Pass(), auth_methods)); + fetch_secret_callback, std::move(token_fetcher), auth_methods)); scoped_ptr<protocol::CandidateSessionConfig> config = protocol::CandidateSessionConfig::CreateDefault(); @@ -729,10 +729,10 @@ void ChromotingInstance::HandleConnect(const base::DictionaryValue& data) { experiments_list.end()) { config->set_vp9_experiment_enabled(true); } - client_->set_protocol_config(config.Pass()); + client_->set_protocol_config(std::move(config)); // Kick off the connection. - client_->Start(signal_strategy_.get(), authenticator.Pass(), + client_->Start(signal_strategy_.get(), std::move(authenticator), transport_context, host_jid, capabilities); // Start timer that periodically sends perf stats. @@ -1036,13 +1036,13 @@ void ChromotingInstance::SendTrappedKey(uint32_t usb_keycode, bool pressed) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetInteger("usbKeycode", usb_keycode); data->SetBoolean("pressed", pressed); - PostLegacyJsonMessage("trappedKeyEvent", data.Pass()); + PostLegacyJsonMessage("trappedKeyEvent", std::move(data)); } void ChromotingInstance::SendOutgoingIq(const std::string& iq) { scoped_ptr<base::DictionaryValue> data(new base::DictionaryValue()); data->SetString("iq", iq); - PostLegacyJsonMessage("sendOutgoingIq", data.Pass()); + PostLegacyJsonMessage("sendOutgoingIq", std::move(data)); } void ChromotingInstance::UpdatePerfStatsInUI() { @@ -1056,7 +1056,7 @@ void ChromotingInstance::UpdatePerfStatsInUI() { data->SetDouble("decodeLatency", perf_tracker_.video_decode_ms()); data->SetDouble("renderLatency", perf_tracker_.video_paint_ms()); data->SetDouble("roundtripLatency", perf_tracker_.round_trip_ms()); - PostLegacyJsonMessage("onPerfStats", data.Pass()); + PostLegacyJsonMessage("onPerfStats", std::move(data)); } // static diff --git a/remoting/client/plugin/pepper_port_allocator.cc b/remoting/client/plugin/pepper_port_allocator.cc index 0b24341..0b28e5a 100644 --- a/remoting/client/plugin/pepper_port_allocator.cc +++ b/remoting/client/plugin/pepper_port_allocator.cc @@ -6,6 +6,8 @@ #include <stdint.h> +#include <utility> + #include "base/bind.h" #include "base/macros.h" #include "base/strings/string_number_conversions.h" @@ -209,13 +211,9 @@ void PepperPortAllocatorSession::OnResponseBodyRead(int32_t result) { // static scoped_ptr<PepperPortAllocator> PepperPortAllocator::Create( const pp::InstanceHandle& instance) { - scoped_ptr<rtc::NetworkManager> network_manager( - new PepperNetworkManager(instance)); - scoped_ptr<rtc::PacketSocketFactory> socket_factory( - new PepperPacketSocketFactory(instance)); - scoped_ptr<PepperPortAllocator> result(new PepperPortAllocator( - instance, network_manager.Pass(), socket_factory.Pass())); - return result.Pass(); + return make_scoped_ptr(new PepperPortAllocator( + instance, make_scoped_ptr(new PepperNetworkManager(instance)), + make_scoped_ptr(new PepperPacketSocketFactory(instance)))); } PepperPortAllocator::PepperPortAllocator( @@ -226,9 +224,8 @@ PepperPortAllocator::PepperPortAllocator( socket_factory.get(), std::string()), instance_(instance), - network_manager_(network_manager.Pass()), - socket_factory_(socket_factory.Pass()) { -} + network_manager_(std::move(network_manager)), + socket_factory_(std::move(socket_factory)) {} PepperPortAllocator::~PepperPortAllocator() {} diff --git a/remoting/client/plugin/pepper_video_renderer_2d.cc b/remoting/client/plugin/pepper_video_renderer_2d.cc index 204fdc8..4e6e4ba 100644 --- a/remoting/client/plugin/pepper_video_renderer_2d.cc +++ b/remoting/client/plugin/pepper_video_renderer_2d.cc @@ -6,6 +6,8 @@ #include <stdint.h> +#include <utility> + #include "base/bind.h" #include "base/callback_helpers.h" #include "base/strings/string_util.h" @@ -201,7 +203,7 @@ void PepperVideoRenderer2D::Flush() { // |flushing_frames_done_callbacks_| so the callbacks are called when flush is // finished. DCHECK(flushing_frames_done_callbacks_.empty()); - flushing_frames_done_callbacks_ = pending_frames_done_callbacks_.Pass(); + flushing_frames_done_callbacks_ = std::move(pending_frames_done_callbacks_); // Flush the updated areas to the screen. int error = graphics2d_.Flush( diff --git a/remoting/client/plugin/pepper_video_renderer_3d.cc b/remoting/client/plugin/pepper_video_renderer_3d.cc index 6277f9b..732b77b 100644 --- a/remoting/client/plugin/pepper_video_renderer_3d.cc +++ b/remoting/client/plugin/pepper_video_renderer_3d.cc @@ -6,6 +6,8 @@ #include <math.h> +#include <utility> + #include "base/callback_helpers.h" #include "base/stl_util.h" #include "ppapi/c/pp_codecs.h" @@ -33,9 +35,7 @@ const uint32_t kMinimumPictureCount = 0; // 3 class PepperVideoRenderer3D::PendingPacket { public: PendingPacket(scoped_ptr<VideoPacket> packet, const base::Closure& done) - : packet_(packet.Pass()), - done_runner_(done) { - } + : packet_(std::move(packet)), done_runner_(done) {} ~PendingPacket() {} @@ -224,7 +224,7 @@ void PepperVideoRenderer3D::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, remoting_rect.height())); } if (!frame_shape_ || !frame_shape_->Equals(*shape)) { - frame_shape_ = shape.Pass(); + frame_shape_ = std::move(shape); event_handler_->OnVideoShape(frame_shape_.get()); } } else if (frame_shape_) { @@ -246,7 +246,7 @@ void PepperVideoRenderer3D::ProcessVideoPacket(scoped_ptr<VideoPacket> packet, } pending_packets_.push_back( - new PendingPacket(packet.Pass(), done_runner.Release())); + new PendingPacket(std::move(packet), done_runner.Release())); DecodeNextPacket(); } @@ -340,7 +340,7 @@ void PepperVideoRenderer3D::PaintIfNeeded() { return; if (next_picture_) - current_picture_ = next_picture_.Pass(); + current_picture_ = std::move(next_picture_); force_repaint_ = false; diff --git a/remoting/client/server_log_entry_client.cc b/remoting/client/server_log_entry_client.cc index 61e1d6c..0686159 100644 --- a/remoting/client/server_log_entry_client.cc +++ b/remoting/client/server_log_entry_client.cc @@ -105,7 +105,7 @@ scoped_ptr<ServerLogEntry> MakeLogEntryForSessionStateChange( entry->Set(kKeyConnectionError, GetValueError(error)); } - return entry.Pass(); + return entry; } scoped_ptr<ServerLogEntry> MakeLogEntryForStatistics( @@ -127,7 +127,7 @@ scoped_ptr<ServerLogEntry> MakeLogEntryForStatistics( entry->Set("roundtrip-latency", StringPrintf("%.2f", perf_tracker->round_trip_ms())); - return entry.Pass(); + return entry; } scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld( @@ -136,7 +136,7 @@ scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdOld( entry->AddRoleField(kValueRoleClient); entry->AddEventNameField(kValueEventNameSessionIdOld); AddSessionIdToLogEntry(entry.get(), session_id); - return entry.Pass(); + return entry; } scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdNew( @@ -145,7 +145,7 @@ scoped_ptr<ServerLogEntry> MakeLogEntryForSessionIdNew( entry->AddRoleField(kValueRoleClient); entry->AddEventNameField(kValueEventNameSessionIdNew); AddSessionIdToLogEntry(entry.get(), session_id); - return entry.Pass(); + return entry; } void AddClientFieldsToLogEntry(ServerLogEntry* entry) { diff --git a/remoting/client/software_video_renderer.cc b/remoting/client/software_video_renderer.cc index 8172369..9726cd5 100644 --- a/remoting/client/software_video_renderer.cc +++ b/remoting/client/software_video_renderer.cc @@ -4,6 +4,8 @@ #include "remoting/client/software_video_renderer.h" +#include <utility> + #include "base/bind.h" #include "base/callback.h" #include "base/callback_helpers.h" @@ -35,8 +37,7 @@ namespace { class RgbToBgrVideoDecoderFilter : public VideoDecoder { public: RgbToBgrVideoDecoderFilter(scoped_ptr<VideoDecoder> parent) - : parent_(parent.Pass()) { - } + : parent_(std::move(parent)) {} bool DecodePacket(const VideoPacket& packet, webrtc::DesktopFrame* frame) override { @@ -64,7 +65,7 @@ scoped_ptr<webrtc::DesktopFrame> DoDecodeFrame( scoped_ptr<webrtc::DesktopFrame> frame) { if (!decoder->DecodePacket(*packet, frame.get())) frame.reset(); - return frame.Pass(); + return frame; } } // namespace @@ -100,9 +101,8 @@ void SoftwareVideoRenderer::OnSessionConfig( } if (consumer_->GetPixelFormat() == FrameConsumer::FORMAT_RGBA) { - scoped_ptr<VideoDecoder> wrapper( - new RgbToBgrVideoDecoderFilter(decoder_.Pass())); - decoder_ = wrapper.Pass(); + decoder_ = + make_scoped_ptr(new RgbToBgrVideoDecoderFilter(std::move(decoder_))); } } @@ -173,7 +173,7 @@ void SoftwareVideoRenderer::RenderFrame( return; } - consumer_->DrawFrame(frame.Pass(), + consumer_->DrawFrame(std::move(frame), base::Bind(&SoftwareVideoRenderer::OnFrameRendered, weak_factory_.GetWeakPtr(), frame_id, done)); } diff --git a/remoting/client/software_video_renderer_unittest.cc b/remoting/client/software_video_renderer_unittest.cc index 9a36d72..d57e7b9 100644 --- a/remoting/client/software_video_renderer_unittest.cc +++ b/remoting/client/software_video_renderer_unittest.cc @@ -6,6 +6,7 @@ #include <stdint.h> +#include <utility> #include <vector> #include "base/bind.h" @@ -34,15 +35,14 @@ class TestFrameConsumer : public FrameConsumer { TestFrameConsumer() {} ~TestFrameConsumer() override {} - scoped_ptr<DesktopFrame> WaitForNextFrame( - base::Closure* out_done_callback) { + scoped_ptr<DesktopFrame> WaitForNextFrame(base::Closure* out_done_callback) { EXPECT_TRUE(thread_checker_.CalledOnValidThread()); frame_run_loop_.reset(new base::RunLoop()); frame_run_loop_->Run(); frame_run_loop_.reset(); *out_done_callback = last_frame_done_callback_; last_frame_done_callback_.Reset(); - return last_frame_.Pass(); + return std::move(last_frame_); } // FrameConsumer interface. @@ -55,7 +55,7 @@ class TestFrameConsumer : public FrameConsumer { void DrawFrame(scoped_ptr<DesktopFrame> frame, const base::Closure& done) override { EXPECT_TRUE(thread_checker_.CalledOnValidThread()); - last_frame_ = frame.Pass(); + last_frame_ = std::move(frame); last_frame_done_callback_ = done; frame_run_loop_->Quit(); } @@ -97,7 +97,7 @@ scoped_ptr<DesktopFrame> CreateTestFrame(int index) { webrtc::DesktopRect::MakeWH(index, index)); } - return frame.Pass(); + return frame; } // Returns true when frames a and b are equivalent. diff --git a/remoting/codec/audio_decoder_opus.cc b/remoting/codec/audio_decoder_opus.cc index 0bcabcc..8a57871 100644 --- a/remoting/codec/audio_decoder_opus.cc +++ b/remoting/codec/audio_decoder_opus.cc @@ -74,7 +74,6 @@ bool AudioDecoderOpus::ResetForPacket(AudioPacket* packet) { return decoder_ != nullptr; } - scoped_ptr<AudioPacket> AudioDecoderOpus::Decode( scoped_ptr<AudioPacket> packet) { if (packet->encoding() != AudioPacket::ENCODING_OPUS) { @@ -133,7 +132,7 @@ scoped_ptr<AudioPacket> AudioDecoderOpus::Decode( decoded_data->resize(buffer_pos); - return decoded_packet.Pass(); + return decoded_packet; } } // namespace remoting diff --git a/remoting/codec/audio_decoder_verbatim.cc b/remoting/codec/audio_decoder_verbatim.cc index a04e2a5..6bd115a 100644 --- a/remoting/codec/audio_decoder_verbatim.cc +++ b/remoting/codec/audio_decoder_verbatim.cc @@ -9,11 +9,8 @@ namespace remoting { -AudioDecoderVerbatim::AudioDecoderVerbatim() { -} - -AudioDecoderVerbatim::~AudioDecoderVerbatim() { -} +AudioDecoderVerbatim::AudioDecoderVerbatim() {} +AudioDecoderVerbatim::~AudioDecoderVerbatim() {} scoped_ptr<AudioPacket> AudioDecoderVerbatim::Decode( scoped_ptr<AudioPacket> packet) { @@ -28,7 +25,7 @@ scoped_ptr<AudioPacket> AudioDecoderVerbatim::Decode( LOG(WARNING) << "Verbatim decoder received an invalid packet."; return nullptr; } - return packet.Pass(); + return packet; } } // namespace remoting diff --git a/remoting/codec/audio_encoder_opus.cc b/remoting/codec/audio_encoder_opus.cc index 547ef50..c0b5710 100644 --- a/remoting/codec/audio_encoder_opus.cc +++ b/remoting/codec/audio_encoder_opus.cc @@ -235,7 +235,7 @@ scoped_ptr<AudioPacket> AudioEncoderOpus::Encode( if (encoded_packet->data_size() == 0) return nullptr; - return encoded_packet.Pass(); + return encoded_packet; } } // namespace remoting diff --git a/remoting/codec/audio_encoder_opus_unittest.cc b/remoting/codec/audio_encoder_opus_unittest.cc index db731eb..b67e28a 100644 --- a/remoting/codec/audio_encoder_opus_unittest.cc +++ b/remoting/codec/audio_encoder_opus_unittest.cc @@ -4,11 +4,14 @@ // MSVC++ requires this to get M_PI. #define _USE_MATH_DEFINES + +#include "remoting/codec/audio_encoder_opus.h" + #include <math.h> #include <stddef.h> #include <stdint.h> -#include "remoting/codec/audio_encoder_opus.h" +#include <utility> #include "base/logging.h" #include "remoting/codec/audio_decoder_opus.h" @@ -82,7 +85,7 @@ class OpusAudioEncoderTest : public testing::Test { packet->set_sampling_rate(rate); packet->set_bytes_per_sample(AudioPacket::BYTES_PER_SAMPLE_2); packet->set_channels(AudioPacket::CHANNELS_STEREO); - return packet.Pass(); + return packet; } // Decoded data is normally shifted in phase relative to the original signal. @@ -139,9 +142,10 @@ class OpusAudioEncoderTest : public testing::Test { scoped_ptr<AudioPacket> source_packet = CreatePacket(packet_size, rate, frequency_hz, pos); scoped_ptr<AudioPacket> encoded = - encoder_->Encode(source_packet.Pass()); + encoder_->Encode(std::move(source_packet)); if (encoded.get()) { - scoped_ptr<AudioPacket> decoded = decoder_->Decode(encoded.Pass()); + scoped_ptr<AudioPacket> decoded = + decoder_->Decode(std::move(encoded)); EXPECT_EQ(kDefaultSamplingRate, decoded->sampling_rate()); for (int i = 0; i < decoded->data_size(); ++i) { const int16_t* data = diff --git a/remoting/codec/audio_encoder_verbatim.cc b/remoting/codec/audio_encoder_verbatim.cc index 16b74e8..9241ce0 100644 --- a/remoting/codec/audio_encoder_verbatim.cc +++ b/remoting/codec/audio_encoder_verbatim.cc @@ -20,7 +20,7 @@ scoped_ptr<AudioPacket> AudioEncoderVerbatim::Encode( DCHECK_NE(AudioPacket::SAMPLING_RATE_INVALID, packet->sampling_rate()); DCHECK_NE(AudioPacket::BYTES_PER_SAMPLE_INVALID, packet->bytes_per_sample()); DCHECK_NE(AudioPacket::CHANNELS_INVALID, packet->channels()); - return packet.Pass(); + return packet; } int AudioEncoderVerbatim::GetBitrate() { diff --git a/remoting/codec/codec_test.cc b/remoting/codec/codec_test.cc index bf71b6f..0c4f431 100644 --- a/remoting/codec/codec_test.cc +++ b/remoting/codec/codec_test.cc @@ -5,7 +5,9 @@ #include <stddef.h> #include <stdint.h> #include <stdlib.h> + #include <deque> +#include <utility> #include "base/bind.h" #include "base/logging.h" @@ -184,7 +186,7 @@ class VideoEncoderTester { ++data_available_; // Send the message to the VideoDecoderTester. if (decoder_tester_) { - decoder_tester_->ReceivedPacket(packet.Pass()); + decoder_tester_->ReceivedPacket(std::move(packet)); } } @@ -208,7 +210,7 @@ scoped_ptr<DesktopFrame> PrepareFrame(const DesktopSize& size) { frame->data()[i] = rand() % 256; } - return frame.Pass(); + return frame; } static void TestEncodingRects(VideoEncoder* encoder, @@ -216,8 +218,7 @@ static void TestEncodingRects(VideoEncoder* encoder, DesktopFrame* frame, const DesktopRegion& region) { *frame->mutable_updated_region() = region; - scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); - tester->DataAvailable(packet.Pass()); + tester->DataAvailable(encoder->Encode(*frame)); } void TestVideoEncoder(VideoEncoder* encoder, bool strict) { @@ -286,8 +287,7 @@ static void TestEncodeDecodeRects(VideoEncoder* encoder, } } - scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); - encoder_tester->DataAvailable(packet.Pass()); + encoder_tester->DataAvailable(encoder->Encode(*frame)); decoder_tester->VerifyResults(); decoder_tester->Reset(); } @@ -338,9 +338,7 @@ void TestVideoEncoderDecoderGradient(VideoEncoder* encoder, VideoDecoderTester decoder_tester(decoder, screen_size); decoder_tester.set_expected_frame(frame.get()); decoder_tester.AddRegion(frame->updated_region()); - - scoped_ptr<VideoPacket> packet = encoder->Encode(*frame); - decoder_tester.ReceivedPacket(packet.Pass()); + decoder_tester.ReceivedPacket(encoder->Encode(*frame)); decoder_tester.VerifyResultsApprox(max_error_limit, mean_error_limit); } diff --git a/remoting/codec/video_encoder_helper.cc b/remoting/codec/video_encoder_helper.cc index 288ec72a..b8e8d1e 100644 --- a/remoting/codec/video_encoder_helper.cc +++ b/remoting/codec/video_encoder_helper.cc @@ -63,7 +63,7 @@ VideoEncoderHelper::CreateVideoPacketWithUpdatedRegion( packet->mutable_format()->set_y_dpi(frame.dpi().y()); } - return packet.Pass(); + return packet; } } // namespace remoting diff --git a/remoting/codec/video_encoder_verbatim.cc b/remoting/codec/video_encoder_verbatim.cc index ce65490..9da4850 100644 --- a/remoting/codec/video_encoder_verbatim.cc +++ b/remoting/codec/video_encoder_verbatim.cc @@ -64,7 +64,7 @@ scoped_ptr<VideoPacket> VideoEncoderVerbatim::Encode( } } - return packet.Pass(); + return packet; } } // namespace remoting diff --git a/remoting/codec/video_encoder_vpx.cc b/remoting/codec/video_encoder_vpx.cc index bea9a8a..57a1d5a 100644 --- a/remoting/codec/video_encoder_vpx.cc +++ b/remoting/codec/video_encoder_vpx.cc @@ -4,6 +4,8 @@ #include "remoting/codec/video_encoder_vpx.h" +#include <utility> + #include "base/bind.h" #include "base/logging.h" #include "base/sys_info.h" @@ -222,8 +224,8 @@ void CreateImage(bool use_i444, image->stride[1] = uv_stride; image->stride[2] = uv_stride; - *out_image = image.Pass(); - *out_image_buffer = image_buffer.Pass(); + *out_image = std::move(image); + *out_image_buffer = std::move(image_buffer); } } // namespace @@ -339,7 +341,7 @@ scoped_ptr<VideoPacket> VideoEncoderVpx::Encode( } } - return packet.Pass(); + return packet; } VideoEncoderVpx::VideoEncoderVpx(bool use_vp9) diff --git a/remoting/codec/video_encoder_vpx_unittest.cc b/remoting/codec/video_encoder_vpx_unittest.cc index edca813..61c74d1 100644 --- a/remoting/codec/video_encoder_vpx_unittest.cc +++ b/remoting/codec/video_encoder_vpx_unittest.cc @@ -38,7 +38,7 @@ static scoped_ptr<webrtc::DesktopFrame> CreateTestFrame( } frame->mutable_updated_region()->SetRect( webrtc::DesktopRect::MakeSize(frame_size)); - return frame.Pass(); + return frame; } TEST(VideoEncoderVpxTest, Vp8) { diff --git a/remoting/signaling/fake_signal_strategy.cc b/remoting/signaling/fake_signal_strategy.cc index 996845c..4acb424 100644 --- a/remoting/signaling/fake_signal_strategy.cc +++ b/remoting/signaling/fake_signal_strategy.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/fake_signal_strategy.h" +#include <utility> + #include "base/bind.h" #include "base/location.h" #include "base/logging.h" @@ -107,7 +109,7 @@ bool FakeSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) { FROM_HERE, base::Bind(peer_callback_, base::Passed(&stanza)), send_delay_); } else { - peer_callback_.Run(stanza.Pass()); + peer_callback_.Run(std::move(stanza)); } return true; } else { diff --git a/remoting/signaling/iq_sender.cc b/remoting/signaling/iq_sender.cc index 9e54340..498fdb5 100644 --- a/remoting/signaling/iq_sender.cc +++ b/remoting/signaling/iq_sender.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/iq_sender.h" +#include <utility> + #include "base/bind.h" #include "base/callback_helpers.h" #include "base/location.h" @@ -30,7 +32,7 @@ scoped_ptr<buzz::XmlElement> IqSender::MakeIqStanza( if (!addressee.empty()) stanza->AddAttr(buzz::QN_TO, addressee); stanza->AddElement(iq_body.release()); - return stanza.Pass(); + return stanza; } IqSender::IqSender(SignalStrategy* signal_strategy) @@ -47,21 +49,21 @@ scoped_ptr<IqRequest> IqSender::SendIq(scoped_ptr<buzz::XmlElement> stanza, std::string addressee = stanza->Attr(buzz::QN_TO); std::string id = signal_strategy_->GetNextId(); stanza->AddAttr(buzz::QN_ID, id); - if (!signal_strategy_->SendStanza(stanza.Pass())) { + if (!signal_strategy_->SendStanza(std::move(stanza))) { return nullptr; } DCHECK(requests_.find(id) == requests_.end()); scoped_ptr<IqRequest> request(new IqRequest(this, callback, addressee)); if (!callback.is_null()) requests_[id] = request.get(); - return request.Pass(); + return request; } scoped_ptr<IqRequest> IqSender::SendIq(const std::string& type, const std::string& addressee, scoped_ptr<buzz::XmlElement> iq_body, const ReplyCallback& callback) { - return SendIq(MakeIqStanza(type, addressee, iq_body.Pass()), callback); + return SendIq(MakeIqStanza(type, addressee, std::move(iq_body)), callback); } void IqSender::RemoveRequest(IqRequest* request) { diff --git a/remoting/signaling/iq_sender_unittest.cc b/remoting/signaling/iq_sender_unittest.cc index 6302a29..aa025dc 100644 --- a/remoting/signaling/iq_sender_unittest.cc +++ b/remoting/signaling/iq_sender_unittest.cc @@ -2,12 +2,15 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. +#include "remoting/signaling/iq_sender.h" + +#include <utility> + #include "base/bind.h" #include "base/memory/ref_counted.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" #include "base/strings/stringprintf.h" -#include "remoting/signaling/iq_sender.h" #include "remoting/signaling/mock_signal_strategy.h" #include "testing/gmock/include/gmock/gmock.h" #include "testing/gtest/include/gtest/gtest.h" @@ -64,7 +67,7 @@ class IqSenderTest : public testing::Test { .WillOnce(Return(kStanzaId)); EXPECT_CALL(signal_strategy_, SendStanzaPtr(_)) .WillOnce(DoAll(SaveArg<0>(&sent_stanza), Return(true))); - request_ = sender_->SendIq(kType, kTo, iq_body.Pass(), base::Bind( + request_ = sender_->SendIq(kType, kTo, std::move(iq_body), base::Bind( &MockCallback::OnReply, base::Unretained(&callback_))); std::string expected_xml_string = @@ -93,7 +96,7 @@ class IqSenderTest : public testing::Test { bool result = sender_->OnSignalStrategyIncomingStanza(response.get()); if (response_out) - *response_out = response.Pass(); + *response_out = std::move(response); return result; } diff --git a/remoting/signaling/jingle_info_request.cc b/remoting/signaling/jingle_info_request.cc index be0f75f..0ea7517 100644 --- a/remoting/signaling/jingle_info_request.cc +++ b/remoting/signaling/jingle_info_request.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/jingle_info_request.h" +#include <utility> + #include "base/bind.h" #include "base/message_loop/message_loop.h" #include "base/stl_util.h" @@ -20,8 +22,7 @@ namespace remoting { const int kRequestTimeoutSeconds = 5; JingleInfoRequest::JingleInfoRequest(SignalStrategy* signal_strategy) - : iq_sender_(signal_strategy) { -} + : iq_sender_(signal_strategy) {} JingleInfoRequest::~JingleInfoRequest() {} @@ -30,7 +31,7 @@ void JingleInfoRequest::Send(const OnJingleInfoCallback& callback) { scoped_ptr<buzz::XmlElement> iq_body( new buzz::XmlElement(buzz::QN_JINGLE_INFO_QUERY, true)); request_ = iq_sender_.SendIq( - buzz::STR_GET, buzz::STR_EMPTY, iq_body.Pass(), + buzz::STR_GET, buzz::STR_EMPTY, std::move(iq_body), base::Bind(&JingleInfoRequest::OnResponse, base::Unretained(this))); if (!request_) { // If we failed to send IqRequest it means that SignalStrategy is diff --git a/remoting/signaling/log_to_server.cc b/remoting/signaling/log_to_server.cc index 731dc58..2da454f 100644 --- a/remoting/signaling/log_to_server.cc +++ b/remoting/signaling/log_to_server.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/log_to_server.h" +#include <utility> + #include "remoting/base/constants.h" #include "remoting/signaling/iq_sender.h" #include "remoting/signaling/signal_strategy.h" @@ -63,12 +65,9 @@ void LogToServer::SendPendingEntries() { stanza->AddElement(entry.ToStanza().release()); pending_entries_.pop_front(); } - // Send the stanza to the server. - scoped_ptr<IqRequest> req = iq_sender_->SendIq( - buzz::STR_SET, directory_bot_jid_, stanza.Pass(), - IqSender::ReplyCallback()); - // We ignore any response, so let the IqRequest be destroyed. - return; + // Send the stanza to the server and ignore the response. + iq_sender_->SendIq(buzz::STR_SET, directory_bot_jid_, std::move(stanza), + IqSender::ReplyCallback()); } } // namespace remoting diff --git a/remoting/signaling/server_log_entry.cc b/remoting/signaling/server_log_entry.cc index d91a32a..9eda8931 100644 --- a/remoting/signaling/server_log_entry.cc +++ b/remoting/signaling/server_log_entry.cc @@ -82,7 +82,7 @@ scoped_ptr<XmlElement> ServerLogEntry::ToStanza() const { for (iter = values_map_.begin(); iter != values_map_.end(); ++iter) { stanza->AddAttr(QName(std::string(), iter->first), iter->second); } - return stanza.Pass(); + return stanza; } } // namespace remoting diff --git a/remoting/signaling/xmpp_login_handler.cc b/remoting/signaling/xmpp_login_handler.cc index 448ecbe..dc12382 100644 --- a/remoting/signaling/xmpp_login_handler.cc +++ b/remoting/signaling/xmpp_login_handler.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/xmpp_login_handler.h" +#include <utility> + #include "base/base64.h" #include "base/bind.h" #include "base/logging.h" @@ -182,7 +184,7 @@ void XmppLoginHandler::OnStanza(scoped_ptr<buzz::XmlElement> stanza) { return; } state_ = State::DONE; - delegate_->OnHandshakeDone(jid_, stream_parser_.Pass()); + delegate_->OnHandshakeDone(jid_, std::move(stream_parser_)); break; default: diff --git a/remoting/signaling/xmpp_login_handler_unittest.cc b/remoting/signaling/xmpp_login_handler_unittest.cc index ab9abe0..125a8ac 100644 --- a/remoting/signaling/xmpp_login_handler_unittest.cc +++ b/remoting/signaling/xmpp_login_handler_unittest.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/xmpp_login_handler.h" +#include <utility> + #include "base/base64.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -51,7 +53,7 @@ class XmppLoginHandlerTest : public testing::Test, void OnHandshakeDone(const std::string& jid, scoped_ptr<XmppStreamParser> parser) override { jid_ = jid; - parser_ = parser.Pass(); + parser_ = std::move(parser); if (delete_login_handler_from_delegate_) login_handler_.reset(); } diff --git a/remoting/signaling/xmpp_signal_strategy.cc b/remoting/signaling/xmpp_signal_strategy.cc index 7577df7..fbc5373 100644 --- a/remoting/signaling/xmpp_signal_strategy.cc +++ b/remoting/signaling/xmpp_signal_strategy.cc @@ -4,6 +4,7 @@ #include "remoting/signaling/xmpp_signal_strategy.h" +#include <utility> #include <vector> #include "base/bind.h" @@ -286,7 +287,7 @@ void XmppSignalStrategy::Core::StartTls() { scoped_ptr<net::ClientSocketHandle> socket_handle( new net::ClientSocketHandle()); - socket_handle->SetSocket(socket_.Pass()); + socket_handle->SetSocket(std::move(socket_)); cert_verifier_ = net::CertVerifier::CreateDefault(); transport_security_state_.reset(new net::TransportSecurityState()); @@ -295,7 +296,7 @@ void XmppSignalStrategy::Core::StartTls() { context.transport_security_state = transport_security_state_.get(); socket_ = socket_factory_->CreateSSLClientSocket( - socket_handle.Pass(), + std::move(socket_handle), net::HostPortPair(xmpp_server_config_.host, kDefaultHttpsPort), net::SSLConfig(), context); @@ -311,7 +312,7 @@ void XmppSignalStrategy::Core::OnHandshakeDone( DCHECK(thread_checker_.CalledOnValidThread()); jid_ = jid; - stream_parser_ = parser.Pass(); + stream_parser_ = std::move(parser); stream_parser_->SetCallbacks( base::Bind(&Core::OnStanza, base::Unretained(this)), base::Bind(&Core::OnParserError, base::Unretained(this))); @@ -523,7 +524,7 @@ void XmppSignalStrategy::RemoveListener(Listener* listener) { core_->RemoveListener(listener); } bool XmppSignalStrategy::SendStanza(scoped_ptr<buzz::XmlElement> stanza) { - return core_->SendStanza(stanza.Pass()); + return core_->SendStanza(std::move(stanza)); } std::string XmppSignalStrategy::GetNextId() { diff --git a/remoting/signaling/xmpp_signal_strategy_unittest.cc b/remoting/signaling/xmpp_signal_strategy_unittest.cc index 82a2ed8..fcfdce7 100644 --- a/remoting/signaling/xmpp_signal_strategy_unittest.cc +++ b/remoting/signaling/xmpp_signal_strategy_unittest.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/xmpp_signal_strategy.h" +#include <utility> + #include "base/base64.h" #include "base/message_loop/message_loop.h" #include "base/run_loop.h" @@ -94,7 +96,7 @@ class MockClientSocketFactory : public net::MockClientSocketFactory { const net::SSLClientSocketContext& context) override { ssl_socket_created_ = true; return net::MockClientSocketFactory::CreateSSLClientSocket( - transport_socket.Pass(), host_and_port, ssl_config, context); + std::move(transport_socket), host_and_port, ssl_config, context); } bool ssl_socket_created() const { return ssl_socket_created_; } @@ -115,10 +117,9 @@ class XmppSignalStrategyTest : public testing::Test, XmppSignalStrategyTest() : message_loop_(base::MessageLoop::TYPE_IO) {} void SetUp() override { - scoped_ptr<net::TestURLRequestContext> context( - new net::TestURLRequestContext()); request_context_getter_ = new net::TestURLRequestContextGetter( - message_loop_.task_runner(), context.Pass()); + message_loop_.task_runner(), + make_scoped_ptr(new net::TestURLRequestContext())); } void CreateSignalStrategy(int port) { diff --git a/remoting/signaling/xmpp_stream_parser_unittest.cc b/remoting/signaling/xmpp_stream_parser_unittest.cc index a76e02c..0bd2d31 100644 --- a/remoting/signaling/xmpp_stream_parser_unittest.cc +++ b/remoting/signaling/xmpp_stream_parser_unittest.cc @@ -4,6 +4,8 @@ #include "remoting/signaling/xmpp_stream_parser.h" +#include <utility> + #include "base/bind.h" #include "base/memory/scoped_vector.h" #include "base/message_loop/message_loop.h" @@ -30,7 +32,7 @@ class XmppStreamParserTest : public testing::Test { } void OnStanza(scoped_ptr<buzz::XmlElement> stanza) { - received_stanzas_.push_back(stanza.Pass()); + received_stanzas_.push_back(std::move(stanza)); } void OnError() { diff --git a/remoting/test/app_remoting_connected_client_fixture.cc b/remoting/test/app_remoting_connected_client_fixture.cc index 3660fb4..71ceae6 100644 --- a/remoting/test/app_remoting_connected_client_fixture.cc +++ b/remoting/test/app_remoting_connected_client_fixture.cc @@ -4,6 +4,8 @@ #include "remoting/test/app_remoting_connected_client_fixture.h" +#include <utility> + #include "base/callback_helpers.h" #include "base/json/json_reader.h" #include "base/logging.h" @@ -39,11 +41,9 @@ namespace test { AppRemotingConnectedClientFixture::AppRemotingConnectedClientFixture() : application_details_( AppRemotingSharedData->GetDetailsFromAppName(GetParam())), - timer_(new base::Timer(true, false)) { -} + timer_(new base::Timer(true, false)) {} -AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() { -} +AppRemotingConnectedClientFixture::~AppRemotingConnectedClientFixture() {} void AppRemotingConnectedClientFixture::SetUp() { connection_helper_.reset( @@ -53,7 +53,7 @@ void AppRemotingConnectedClientFixture::SetUp() { test_chromoting_client->AddRemoteConnectionObserver(this); - connection_helper_->Initialize(test_chromoting_client.Pass()); + connection_helper_->Initialize(std::move(test_chromoting_client)); if (!connection_helper_->StartConnection()) { LOG(ERROR) << "Remote host connection could not be established."; FAIL(); diff --git a/remoting/test/app_remoting_connection_helper.cc b/remoting/test/app_remoting_connection_helper.cc index f39b398..215a1a2 100644 --- a/remoting/test/app_remoting_connection_helper.cc +++ b/remoting/test/app_remoting_connection_helper.cc @@ -4,6 +4,8 @@ #include "remoting/test/app_remoting_connection_helper.h" +#include <utility> + #include "base/json/json_reader.h" #include "base/logging.h" #include "base/run_loop.h" @@ -46,7 +48,7 @@ AppRemotingConnectionHelper::~AppRemotingConnectionHelper() { void AppRemotingConnectionHelper::Initialize( scoped_ptr<TestChromotingClient> test_chromoting_client) { - client_ = test_chromoting_client.Pass(); + client_ = std::move(test_chromoting_client); client_->AddRemoteConnectionObserver(this); } diff --git a/remoting/test/app_remoting_latency_test_fixture.cc b/remoting/test/app_remoting_latency_test_fixture.cc index e8692ef..7be94d1 100644 --- a/remoting/test/app_remoting_latency_test_fixture.cc +++ b/remoting/test/app_remoting_latency_test_fixture.cc @@ -4,6 +4,8 @@ #include "remoting/test/app_remoting_latency_test_fixture.h" +#include <utility> + #include "base/logging.h" #include "base/run_loop.h" #include "base/thread_task_runner_handle.h" @@ -24,21 +26,20 @@ AppRemotingLatencyTestFixture::AppRemotingLatencyTestFixture() // NOTE: Derived fixture must initialize application details in constructor. } -AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() { -} +AppRemotingLatencyTestFixture::~AppRemotingLatencyTestFixture() {} void AppRemotingLatencyTestFixture::SetUp() { scoped_ptr<TestVideoRenderer> test_video_renderer(new TestVideoRenderer()); test_video_renderer_ = test_video_renderer->GetWeakPtr(); scoped_ptr<TestChromotingClient> test_chromoting_client( - new TestChromotingClient(test_video_renderer.Pass())); + new TestChromotingClient(std::move(test_video_renderer))); test_chromoting_client->AddRemoteConnectionObserver(this); connection_helper_.reset( new AppRemotingConnectionHelper(GetApplicationDetails())); - connection_helper_->Initialize(test_chromoting_client.Pass()); + connection_helper_->Initialize(std::move(test_chromoting_client)); if (!connection_helper_->StartConnection()) { LOG(ERROR) << "Remote host connection could not be established."; diff --git a/remoting/test/app_remoting_test_driver_environment_unittest.cc b/remoting/test/app_remoting_test_driver_environment_unittest.cc index 3efe396..26546b3 100644 --- a/remoting/test/app_remoting_test_driver_environment_unittest.cc +++ b/remoting/test/app_remoting_test_driver_environment_unittest.cc @@ -7,6 +7,7 @@ #include <stddef.h> #include <algorithm> +#include <utility> #include "base/files/file_path.h" #include "base/macros.h" @@ -83,7 +84,7 @@ void AppRemotingTestDriverEnvironmentTest::Initialize( new FakeAccessTokenFetcher()); fake_access_token_fetcher_ = fake_access_token_fetcher.get(); mock_access_token_fetcher_.SetAccessTokenFetcher( - fake_access_token_fetcher.Pass()); + std::move(fake_access_token_fetcher)); environment_object_->SetAccessTokenFetcherForTest( &mock_access_token_fetcher_); diff --git a/remoting/test/mock_access_token_fetcher.cc b/remoting/test/mock_access_token_fetcher.cc index d5d5201..398f09f 100644 --- a/remoting/test/mock_access_token_fetcher.cc +++ b/remoting/test/mock_access_token_fetcher.cc @@ -4,21 +4,20 @@ #include "remoting/test/mock_access_token_fetcher.h" +#include <utility> + namespace remoting { namespace test { using ::testing::_; using ::testing::Invoke; -MockAccessTokenFetcher::MockAccessTokenFetcher() { -} - -MockAccessTokenFetcher::~MockAccessTokenFetcher() { -} +MockAccessTokenFetcher::MockAccessTokenFetcher() {} +MockAccessTokenFetcher::~MockAccessTokenFetcher() {} void MockAccessTokenFetcher::SetAccessTokenFetcher( scoped_ptr<AccessTokenFetcher> fetcher) { - internal_access_token_fetcher_ = fetcher.Pass(); + internal_access_token_fetcher_ = std::move(fetcher); ON_CALL(*this, GetAccessTokenFromAuthCode(_, _)) .WillByDefault(Invoke(internal_access_token_fetcher_.get(), diff --git a/remoting/test/protocol_perftest.cc b/remoting/test/protocol_perftest.cc index 86cb161..04703db 100644 --- a/remoting/test/protocol_perftest.cc +++ b/remoting/test/protocol_perftest.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/base64.h" #include "base/files/file_util.h" #include "base/macros.h" @@ -132,7 +134,7 @@ class ProtocolPerfTest return; } - last_video_packet_ = video_packet.Pass(); + last_video_packet_ = std::move(video_packet); if (!on_frame_task_.is_null()) on_frame_task_.Run(); @@ -236,7 +238,7 @@ class ProtocolPerfTest GetParam().out_of_order_rate); scoped_refptr<protocol::TransportContext> transport_context( new protocol::TransportContext( - host_signaling_.get(), port_allocator_factory.Pass(), + host_signaling_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::SERVER)); scoped_ptr<protocol::SessionManager> session_manager( @@ -248,14 +250,11 @@ class ProtocolPerfTest // Encoder runs on a separate thread, main thread is used for everything // else. - host_.reset(new ChromotingHost(&desktop_environment_factory_, - session_manager.Pass(), - host_thread_.task_runner(), - host_thread_.task_runner(), - capture_thread_.task_runner(), - encode_thread_.task_runner(), - host_thread_.task_runner(), - host_thread_.task_runner())); + host_.reset(new ChromotingHost( + &desktop_environment_factory_, std::move(session_manager), + host_thread_.task_runner(), host_thread_.task_runner(), + capture_thread_.task_runner(), encode_thread_.task_runner(), + host_thread_.task_runner(), host_thread_.task_runner())); base::FilePath certs_dir(net::GetTestCertsDirectory()); @@ -277,7 +276,7 @@ class ProtocolPerfTest scoped_ptr<protocol::AuthenticatorFactory> auth_factory = protocol::Me2MeHostAuthenticatorFactory::CreateWithSharedSecret( true, kHostOwner, host_cert, key_pair, host_secret, nullptr); - host_->SetAuthenticatorFactory(auth_factory.Pass()); + host_->SetAuthenticatorFactory(std::move(auth_factory)); host_->AddStatusObserver(this); host_->Start(kHostOwner); @@ -307,7 +306,7 @@ class ProtocolPerfTest GetParam().out_of_order_rate); scoped_refptr<protocol::TransportContext> transport_context( new protocol::TransportContext( - host_signaling_.get(), port_allocator_factory.Pass(), + host_signaling_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::SERVER)); std::vector<protocol::AuthenticationMethod> auth_methods; @@ -319,12 +318,11 @@ class ProtocolPerfTest std::string(), // client_pairing_secret std::string(), // authentication_tag base::Bind(&ProtocolPerfTest::FetchPin, base::Unretained(this)), - nullptr, - auth_methods)); + nullptr, auth_methods)); client_.reset( new ChromotingClient(client_context_.get(), this, this, nullptr)); client_->set_protocol_config(protocol_config_->Clone()); - client_->Start(client_signaling_.get(), client_authenticator.Pass(), + client_->Start(client_signaling_.get(), std::move(client_authenticator), transport_context, kHostJid, std::string()); } @@ -448,7 +446,7 @@ class IntermittentChangeFrameGenerator result->mutable_updated_region()->AddRect( webrtc::DesktopRect::MakeXYWH(0, 0, kWidth, kHeight)); } - return result.Pass(); + return result; } private: diff --git a/remoting/test/test_chromoting_client.cc b/remoting/test/test_chromoting_client.cc index 2e678e4..37d6264 100644 --- a/remoting/test/test_chromoting_client.cc +++ b/remoting/test/test_chromoting_client.cc @@ -5,6 +5,7 @@ #include "remoting/test/test_chromoting_client.h" #include <string> +#include <utility> #include <vector> #include "base/logging.h" @@ -72,7 +73,7 @@ TestChromotingClient::TestChromotingClient( scoped_ptr<VideoRenderer> video_renderer) : connection_to_host_state_(protocol::ConnectionToHost::INITIALIZING), connection_error_code_(protocol::OK), - video_renderer_(video_renderer.Pass()) {} + video_renderer_(std::move(video_renderer)) {} TestChromotingClient::~TestChromotingClient() { // Ensure any connections are closed and the members are destroyed in the @@ -104,7 +105,7 @@ void TestChromotingClient::StartConnection( if (test_connection_to_host_) { chromoting_client_->SetConnectionToHostForTests( - test_connection_to_host_.Pass()); + std::move(test_connection_to_host_)); } if (!signal_strategy_) { @@ -129,7 +130,7 @@ void TestChromotingClient::StartConnection( scoped_refptr<protocol::TransportContext> transport_context( new protocol::TransportContext( - signal_strategy_.get(), port_allocator_factory.Pass(), + signal_strategy_.get(), std::move(port_allocator_factory), network_settings, protocol::TransportRole::CLIENT)); scoped_ptr<protocol::ThirdPartyClientAuthenticator::TokenFetcher> @@ -146,15 +147,12 @@ void TestChromotingClient::StartConnection( scoped_ptr<protocol::Authenticator> authenticator( new protocol::NegotiatingClientAuthenticator( - connection_setup_info.pairing_id, - connection_setup_info.shared_secret, - connection_setup_info.host_id, - fetch_secret_callback, - token_fetcher.Pass(), - connection_setup_info.auth_methods)); + connection_setup_info.pairing_id, connection_setup_info.shared_secret, + connection_setup_info.host_id, fetch_secret_callback, + std::move(token_fetcher), connection_setup_info.auth_methods)); chromoting_client_->Start( - signal_strategy_.get(), authenticator.Pass(), transport_context, + signal_strategy_.get(), std::move(authenticator), transport_context, connection_setup_info.host_jid, connection_setup_info.capabilities); } @@ -191,12 +189,12 @@ void TestChromotingClient::RemoveRemoteConnectionObserver( void TestChromotingClient::SetSignalStrategyForTests( scoped_ptr<SignalStrategy> signal_strategy) { - signal_strategy_ = signal_strategy.Pass(); + signal_strategy_ = std::move(signal_strategy); } void TestChromotingClient::SetConnectionToHostForTests( scoped_ptr<protocol::ConnectionToHost> connection_to_host) { - test_connection_to_host_ = connection_to_host.Pass(); + test_connection_to_host_ = std::move(connection_to_host); } void TestChromotingClient::OnConnectionState( diff --git a/remoting/test/test_video_renderer_unittest.cc b/remoting/test/test_video_renderer_unittest.cc index bf55954..9922089 100644 --- a/remoting/test/test_video_renderer_unittest.cc +++ b/remoting/test/test_video_renderer_unittest.cc @@ -7,6 +7,7 @@ #include <stdint.h> #include <cmath> +#include <utility> #include "base/macros.h" #include "base/memory/scoped_vector.h" @@ -150,7 +151,7 @@ void TestVideoRendererTest::TestVideoPacketProcessing(int screen_width, run_loop_->QuitClosure()); // Wait for the video packet to be processed and rendered to buffer. - test_video_renderer_->ProcessVideoPacket(packet.Pass(), + test_video_renderer_->ProcessVideoPacket(std::move(packet), run_loop_->QuitClosure()); run_loop_->Run(); @@ -190,7 +191,7 @@ bool TestVideoRendererTest::SendPacketAndWaitForMatch( scoped_ptr<VideoPacket> packet_copy(new VideoPacket(*packet.get())); // Post first test packet: |packet|. - test_video_renderer_->ProcessVideoPacket(packet.Pass(), + test_video_renderer_->ProcessVideoPacket(std::move(packet), base::Bind(&base::DoNothing)); // Second packet: |packet_copy| is posted, and |second_packet_done_callback| @@ -201,7 +202,7 @@ bool TestVideoRendererTest::SendPacketAndWaitForMatch( base::Bind(&ProcessPacketDoneHandler, run_loop_->QuitClosure(), &second_packet_done_is_called); - test_video_renderer_->ProcessVideoPacket(packet_copy.Pass(), + test_video_renderer_->ProcessVideoPacket(std::move(packet_copy), second_packet_done_callback); run_loop_->Run(); @@ -232,7 +233,7 @@ void TestVideoRendererTest::TestImagePatternMatch( scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame.get()); if (expect_to_match) { - EXPECT_TRUE(SendPacketAndWaitForMatch(packet.Pass(), expected_rect, + EXPECT_TRUE(SendPacketAndWaitForMatch(std::move(packet), expected_rect, expected_average_color)); } else { // Shift each channel by 128. @@ -246,7 +247,7 @@ void TestVideoRendererTest::TestImagePatternMatch( RGBValue expected_average_color_shift = RGBValue(red_shift, green_shift, blue_shift); - EXPECT_FALSE(SendPacketAndWaitForMatch(packet.Pass(), expected_rect, + EXPECT_FALSE(SendPacketAndWaitForMatch(std::move(packet), expected_rect, expected_average_color_shift)); } } @@ -340,7 +341,7 @@ scoped_ptr<webrtc::DesktopFrame> frame->mutable_updated_region()->SetRect( webrtc::DesktopRect::MakeSize(screen_size)); FillFrameWithGradient(frame.get()); - return frame.Pass(); + return frame; } void TestVideoRendererTest::FillFrameWithGradient( @@ -450,8 +451,7 @@ TEST_F(TestVideoRendererTest, VerifySetExpectedImagePattern) { kDefaultExpectedRect, black_color, base::Bind(&base::DoNothing)); // Post test video packet. - scoped_ptr<VideoPacket> packet = encoder_->Encode(*frame.get()); - test_video_renderer_->ProcessVideoPacket(packet.Pass(), + test_video_renderer_->ProcessVideoPacket(encoder_->Encode(*frame.get()), base::Bind(&base::DoNothing)); } |