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/client/plugin | |
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/client/plugin')
-rw-r--r-- | remoting/client/plugin/chromoting_instance.cc | 56 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_port_allocator.cc | 17 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_video_renderer_2d.cc | 4 | ||||
-rw-r--r-- | remoting/client/plugin/pepper_video_renderer_3d.cc | 12 |
4 files changed, 44 insertions, 45 deletions
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; |