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

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

Issue 8573013: Add CancelChannelCreation() in protocol::Session interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 1 month 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
« no previous file with comments | « remoting/protocol/pepper_stream_channel.h ('k') | remoting/protocol/protobuf_video_reader.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 channel_(NULL), 74 channel_(NULL),
75 connected_(false), 75 connected_(false),
76 ssl_client_socket_(NULL), 76 ssl_client_socket_(NULL),
77 ALLOW_THIS_IN_INITIALIZER_LIST(p2p_connect_callback_( 77 ALLOW_THIS_IN_INITIALIZER_LIST(p2p_connect_callback_(
78 this, &PepperStreamChannel::OnP2PConnect)), 78 this, &PepperStreamChannel::OnP2PConnect)),
79 ALLOW_THIS_IN_INITIALIZER_LIST(ssl_connect_callback_( 79 ALLOW_THIS_IN_INITIALIZER_LIST(ssl_connect_callback_(
80 this, &PepperStreamChannel::OnSSLConnect)) { 80 this, &PepperStreamChannel::OnSSLConnect)) {
81 } 81 }
82 82
83 PepperStreamChannel::~PepperStreamChannel() { 83 PepperStreamChannel::~PepperStreamChannel() {
84 session_->OnDeleteChannel(this);
84 // Verify that the |channel_| is ether destroyed or we own it. 85 // Verify that the |channel_| is ether destroyed or we own it.
85 DCHECK_EQ(channel_, owned_channel_.get()); 86 DCHECK_EQ(channel_, owned_channel_.get());
86 // Channel should be already destroyed if we were connected. 87 // Channel should be already destroyed if we were connected.
87 DCHECK(!connected_ || channel_ == NULL); 88 DCHECK(!connected_ || channel_ == NULL);
88 } 89 }
89 90
90 void PepperStreamChannel::Connect(pp::Instance* pp_instance, 91 void PepperStreamChannel::Connect(pp::Instance* pp_instance,
91 const TransportConfig& transport_config, 92 const TransportConfig& transport_config,
92 const std::string& remote_cert) { 93 const std::string& remote_cert) {
93 DCHECK(CalledOnValidThread()); 94 DCHECK(CalledOnValidThread());
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 OnP2PConnect(result); 157 OnP2PConnect(result);
157 } 158 }
158 159
159 void PepperStreamChannel::AddRemoveCandidate( 160 void PepperStreamChannel::AddRemoveCandidate(
160 const cricket::Candidate& candidate) { 161 const cricket::Candidate& candidate) {
161 DCHECK(CalledOnValidThread()); 162 DCHECK(CalledOnValidThread());
162 if (channel_) 163 if (channel_)
163 channel_->AddRemoteCandidate(jingle_glue::SerializeP2PCandidate(candidate)); 164 channel_->AddRemoteCandidate(jingle_glue::SerializeP2PCandidate(candidate));
164 } 165 }
165 166
166 const std::string& PepperStreamChannel::name() { 167 const std::string& PepperStreamChannel::name() const {
167 DCHECK(CalledOnValidThread()); 168 DCHECK(CalledOnValidThread());
168 return name_; 169 return name_;
169 } 170 }
170 171
172 bool PepperStreamChannel::is_connected() const {
173 DCHECK(CalledOnValidThread());
174 return connected_;
175 }
176
171 void PepperStreamChannel::OnChannelDeleted() { 177 void PepperStreamChannel::OnChannelDeleted() {
172 if (connected_) { 178 if (connected_) {
173 channel_ = NULL; 179 channel_ = NULL;
174 // The PepperTransportSocketAdapter is being deleted, so delete the 180 // The PepperTransportSocketAdapter is being deleted, so delete
175 // channel too. 181 // the channel too.
176 session_->OnDeleteChannel(this);
177 delete this; 182 delete this;
178 } 183 }
179 } 184 }
180 185
181 void PepperStreamChannel::OnChannelNewLocalCandidate( 186 void PepperStreamChannel::OnChannelNewLocalCandidate(
182 const std::string& candidate) { 187 const std::string& candidate) {
183 DCHECK(CalledOnValidThread()); 188 DCHECK(CalledOnValidThread());
184 189
185 cricket::Candidate candidate_value; 190 cricket::Candidate candidate_value;
186 if (!jingle_glue::DeserializeP2PCandidate(candidate, &candidate_value)) { 191 if (!jingle_glue::DeserializeP2PCandidate(candidate, &candidate_value)) {
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 void PepperStreamChannel::NotifyConnectFailed() { 271 void PepperStreamChannel::NotifyConnectFailed() {
267 channel_ = NULL; 272 channel_ = NULL;
268 owned_channel_.reset(); 273 owned_channel_.reset();
269 socket_.reset(); 274 socket_.reset();
270 275
271 NotifyConnected(NULL); 276 NotifyConnected(NULL);
272 } 277 }
273 278
274 } // namespace protocol 279 } // namespace protocol
275 } // namespace remoting 280 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/protocol/pepper_stream_channel.h ('k') | remoting/protocol/protobuf_video_reader.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698