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

Side by Side Diff: remoting/protocol/pepper_stream_channel.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/pepper_stream_channel.h" 5 #include "remoting/protocol/pepper_stream_channel.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "crypto/hmac.h" 8 #include "crypto/hmac.h"
9 #include "jingle/glue/utils.h" 9 #include "jingle/glue/utils.h"
10 #include "net/base/cert_status_flags.h" 10 #include "net/base/cert_status_flags.h"
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
47 channel_(NULL), 47 channel_(NULL),
48 connected_(false) { 48 connected_(false) {
49 } 49 }
50 50
51 PepperStreamChannel::~PepperStreamChannel() { 51 PepperStreamChannel::~PepperStreamChannel() {
52 session_->OnDeleteChannel(this); 52 session_->OnDeleteChannel(this);
53 // Channel should be already destroyed if we were connected. 53 // Channel should be already destroyed if we were connected.
54 DCHECK(!connected_ || channel_ == NULL); 54 DCHECK(!connected_ || channel_ == NULL);
55 } 55 }
56 56
57 void PepperStreamChannel::Connect(pp::Instance* pp_instance, 57 void PepperStreamChannel::Connect(
58 const TransportConfig& transport_config, 58 pp::Instance* pp_instance,
59 ChannelAuthenticator* authenticator) { 59 const TransportConfig& transport_config,
60 scoped_ptr<ChannelAuthenticator> authenticator) {
60 DCHECK(CalledOnValidThread()); 61 DCHECK(CalledOnValidThread());
61 62
62 authenticator_.reset(authenticator); 63 authenticator_ = authenticator.Pass();
63 64
64 pp::Transport_Dev* transport = 65 pp::Transport_Dev* transport =
65 new pp::Transport_Dev(pp_instance, name_.c_str(), 66 new pp::Transport_Dev(pp_instance, name_.c_str(),
66 PP_TRANSPORTTYPE_STREAM); 67 PP_TRANSPORTTYPE_STREAM);
67 68
68 if (transport->SetProperty(PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW, 69 if (transport->SetProperty(PP_TRANSPORTPROPERTY_TCP_RECEIVE_WINDOW,
69 pp::Var(kTcpReceiveBufferSize)) != PP_OK) { 70 pp::Var(kTcpReceiveBufferSize)) != PP_OK) {
70 LOG(ERROR) << "Failed to set TCP receive window"; 71 LOG(ERROR) << "Failed to set TCP receive window";
71 } 72 }
72 if (transport->SetProperty(PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW, 73 if (transport->SetProperty(PP_TRANSPORTPROPERTY_TCP_SEND_WINDOW,
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
192 void PepperStreamChannel::NotifyConnectFailed() { 193 void PepperStreamChannel::NotifyConnectFailed() {
193 channel_ = NULL; 194 channel_ = NULL;
194 owned_channel_.reset(); 195 owned_channel_.reset();
195 authenticator_.reset(); 196 authenticator_.reset();
196 197
197 NotifyConnected(NULL); 198 NotifyConnected(NULL);
198 } 199 }
199 200
200 } // namespace protocol 201 } // namespace protocol
201 } // namespace remoting 202 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698