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

Side by Side Diff: remoting/protocol/channel_dispatcher_base.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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "remoting/protocol/channel_dispatcher_base.h" 5 #include "remoting/protocol/channel_dispatcher_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "remoting/protocol/p2p_stream_socket.h" 8 #include "remoting/protocol/p2p_stream_socket.h"
9 #include "remoting/protocol/stream_channel_factory.h" 9 #include "remoting/protocol/stream_channel_factory.h"
10 10
(...skipping 21 matching lines...) Expand all
32 } 32 }
33 33
34 void ChannelDispatcherBase::OnChannelReady( 34 void ChannelDispatcherBase::OnChannelReady(
35 scoped_ptr<P2PStreamSocket> socket) { 35 scoped_ptr<P2PStreamSocket> socket) {
36 if (!socket.get()) { 36 if (!socket.get()) {
37 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR); 37 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
38 return; 38 return;
39 } 39 }
40 40
41 channel_factory_ = nullptr; 41 channel_factory_ = nullptr;
42 channel_ = socket.Pass(); 42 channel_ = std::move(socket);
43 writer_.Init( 43 writer_.Init(
44 base::Bind(&P2PStreamSocket::Write, base::Unretained(channel_.get())), 44 base::Bind(&P2PStreamSocket::Write, base::Unretained(channel_.get())),
45 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed, 45 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed,
46 base::Unretained(this))); 46 base::Unretained(this)));
47 reader_.StartReading(channel_.get(), 47 reader_.StartReading(channel_.get(),
48 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed, 48 base::Bind(&ChannelDispatcherBase::OnReadWriteFailed,
49 base::Unretained(this))); 49 base::Unretained(this)));
50 50
51 event_handler_->OnChannelInitialized(this); 51 event_handler_->OnChannelInitialized(this);
52 } 52 }
53 53
54 void ChannelDispatcherBase::OnReadWriteFailed(int error) { 54 void ChannelDispatcherBase::OnReadWriteFailed(int error) {
55 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR); 55 event_handler_->OnChannelError(this, CHANNEL_CONNECTION_ERROR);
56 } 56 }
57 57
58 } // namespace protocol 58 } // namespace protocol
59 } // namespace remoting 59 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698