Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(406)

Unified Diff: remoting/protocol/channel_multiplexer.cc

Issue 1534193004: Use std::move() instead of scoped_ptr<>::Pass(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: remoting/protocol/channel_multiplexer.cc
diff --git a/remoting/protocol/channel_multiplexer.cc b/remoting/protocol/channel_multiplexer.cc
index ff5f990184baa42dbd485f18d236d03eafa458d1..efc01a6f2e793dee49fdba004c33d482a2c86455 100644
--- a/remoting/protocol/channel_multiplexer.cc
+++ b/remoting/protocol/channel_multiplexer.cc
@@ -28,7 +28,7 @@ class PendingPacket {
public:
PendingPacket(scoped_ptr<MultiplexPacket> packet,
const base::Closure& done_task)
- : packet(packet.Pass()),
+ : packet(std::move(packet)),
done_task(done_task),
pos(0U) {
}
@@ -156,7 +156,7 @@ scoped_ptr<P2PStreamSocket> ChannelMultiplexer::MuxChannel::CreateSocket() {
DCHECK(!socket_); // Can't create more than one socket per channel.
scoped_ptr<MuxSocket> result(new MuxSocket(this));
socket_ = result.get();
- return result.Pass();
+ return std::move(result);
}
void ChannelMultiplexer::MuxChannel::OnIncomingPacket(
@@ -164,7 +164,7 @@ void ChannelMultiplexer::MuxChannel::OnIncomingPacket(
const base::Closure& done_task) {
DCHECK_EQ(packet->channel_id(), receive_id_);
if (packet->data().size() > 0) {
- pending_packets_.push_back(new PendingPacket(packet.Pass(), done_task));
+ pending_packets_.push_back(new PendingPacket(std::move(packet), done_task));
if (socket_) {
// Notify the socket that we have more data.
socket_->OnPacketReceived();
@@ -190,7 +190,7 @@ void ChannelMultiplexer::MuxChannel::DoWrite(
packet->set_channel_name(name_);
id_sent_ = true;
}
- multiplexer_->DoWrite(packet.Pass(), done_task);
+ multiplexer_->DoWrite(std::move(packet), done_task);
}
int ChannelMultiplexer::MuxChannel::DoRead(
@@ -256,7 +256,7 @@ int ChannelMultiplexer::MuxSocket::Write(
packet->mutable_data()->assign(buffer->data(), size);
write_pending_ = true;
- channel_->DoWrite(packet.Pass(), base::Bind(
+ channel_->DoWrite(std::move(packet), base::Bind(
&ChannelMultiplexer::MuxSocket::OnWriteComplete, AsWeakPtr()));
// OnWriteComplete() might be called above synchronously.
@@ -361,7 +361,7 @@ void ChannelMultiplexer::CancelChannelCreation(const std::string& name) {
void ChannelMultiplexer::OnBaseChannelReady(
scoped_ptr<P2PStreamSocket> socket) {
base_channel_factory_ = nullptr;
- base_channel_ = socket.Pass();
+ base_channel_ = std::move(socket);
if (base_channel_.get()) {
// Initialize reader and writer.
@@ -394,7 +394,7 @@ void ChannelMultiplexer::DoCreatePendingChannels() {
scoped_ptr<P2PStreamSocket> socket;
if (base_channel_.get())
socket = GetOrCreateChannel(c.name)->CreateSocket();
- c.callback.Run(socket.Pass());
+ c.callback.Run(std::move(socket));
}
ChannelMultiplexer::MuxChannel* ChannelMultiplexer::GetOrCreateChannel(
@@ -457,7 +457,7 @@ void ChannelMultiplexer::OnIncomingPacket(scoped_ptr<MultiplexPacket> packet,
channels_by_receive_id_[receive_id] = channel;
}
- channel->OnIncomingPacket(packet.Pass(), done_task);
+ channel->OnIncomingPacket(std::move(packet), done_task);
}
void ChannelMultiplexer::DoWrite(scoped_ptr<MultiplexPacket> packet,

Powered by Google App Engine
This is Rietveld 408576698