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

Side by Side Diff: remoting/protocol/jingle_stream_connector.cc

Issue 9240033: Use scoped_ptr<>.Pass() to pass ownership in the remoting protocol code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 8 years, 11 months 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/jingle_stream_connector.h" 5 #include "remoting/protocol/jingle_stream_connector.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "jingle/glue/channel_socket_adapter.h" 8 #include "jingle/glue/channel_socket_adapter.h"
9 #include "jingle/glue/pseudotcp_adapter.h" 9 #include "jingle/glue/pseudotcp_adapter.h"
10 #include "net/base/cert_status_flags.h" 10 #include "net/base/cert_status_flags.h"
(...skipping 29 matching lines...) Expand all
40 const Session::StreamChannelCallback& callback) 40 const Session::StreamChannelCallback& callback)
41 : session_(session), 41 : session_(session),
42 name_(name), 42 name_(name),
43 callback_(callback), 43 callback_(callback),
44 raw_channel_(NULL) { 44 raw_channel_(NULL) {
45 } 45 }
46 46
47 JingleStreamConnector::~JingleStreamConnector() { 47 JingleStreamConnector::~JingleStreamConnector() {
48 } 48 }
49 49
50 void JingleStreamConnector::Connect(ChannelAuthenticator* authenticator, 50 void JingleStreamConnector::Connect(
51 cricket::TransportChannel* raw_channel) { 51 scoped_ptr<ChannelAuthenticator> authenticator,
52 cricket::TransportChannel* raw_channel) {
52 DCHECK(CalledOnValidThread()); 53 DCHECK(CalledOnValidThread());
53 DCHECK(!raw_channel_); 54 DCHECK(!raw_channel_);
54 55
55 authenticator_.reset(authenticator); 56 authenticator_ = authenticator.Pass();
56 raw_channel_ = raw_channel; 57 raw_channel_ = raw_channel;
57 58
58 net::Socket* socket = 59 net::Socket* socket =
59 new jingle_glue::TransportChannelSocketAdapter(raw_channel_); 60 new jingle_glue::TransportChannelSocketAdapter(raw_channel_);
60 61
61 if (!EstablishTCPConnection(socket)) 62 if (!EstablishTCPConnection(socket))
62 NotifyError(); 63 NotifyError();
63 } 64 }
64 65
65 bool JingleStreamConnector::EstablishTCPConnection(net::Socket* socket) { 66 bool JingleStreamConnector::EstablishTCPConnection(net::Socket* socket) {
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 callback_.Run(socket); 122 callback_.Run(socket);
122 delete this; 123 delete this;
123 } 124 }
124 125
125 void JingleStreamConnector::NotifyError() { 126 void JingleStreamConnector::NotifyError() {
126 NotifyDone(NULL); 127 NotifyDone(NULL);
127 } 128 }
128 129
129 } // namespace protocol 130 } // namespace protocol
130 } // namespace remoting 131 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698