OLD | NEW |
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/jingle_session.h" | 5 #include "remoting/protocol/jingle_session.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/rand_util.h" | 8 #include "base/rand_util.h" |
9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 weak_factory_(this) { | 78 weak_factory_(this) { |
79 } | 79 } |
80 | 80 |
81 JingleSession::~JingleSession() { | 81 JingleSession::~JingleSession() { |
82 channel_multiplexer_.reset(); | 82 channel_multiplexer_.reset(); |
83 STLDeleteContainerPointers(pending_requests_.begin(), | 83 STLDeleteContainerPointers(pending_requests_.begin(), |
84 pending_requests_.end()); | 84 pending_requests_.end()); |
85 STLDeleteContainerPointers(transport_info_requests_.begin(), | 85 STLDeleteContainerPointers(transport_info_requests_.begin(), |
86 transport_info_requests_.end()); | 86 transport_info_requests_.end()); |
87 | 87 |
88 channel_multiplexer_.reset(); | |
89 DCHECK(channels_.empty()); | 88 DCHECK(channels_.empty()); |
90 | 89 |
91 session_manager_->SessionDestroyed(this); | 90 session_manager_->SessionDestroyed(this); |
92 } | 91 } |
93 | 92 |
94 void JingleSession::SetEventHandler(Session::EventHandler* event_handler) { | 93 void JingleSession::SetEventHandler(Session::EventHandler* event_handler) { |
95 DCHECK(CalledOnValidThread()); | 94 DCHECK(CalledOnValidThread()); |
96 DCHECK(event_handler); | 95 DCHECK(event_handler); |
97 event_handler_ = event_handler; | 96 event_handler_ = event_handler; |
98 } | 97 } |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
267 channel->Connect(name, this, callback); | 266 channel->Connect(name, this, callback); |
268 AddPendingRemoteCandidates(channel.get(), name); | 267 AddPendingRemoteCandidates(channel.get(), name); |
269 channels_[name] = channel.release(); | 268 channels_[name] = channel.release(); |
270 } | 269 } |
271 | 270 |
272 void JingleSession::CancelChannelCreation(const std::string& name) { | 271 void JingleSession::CancelChannelCreation(const std::string& name) { |
273 ChannelsMap::iterator it = channels_.find(name); | 272 ChannelsMap::iterator it = channels_.find(name); |
274 if (it != channels_.end()) { | 273 if (it != channels_.end()) { |
275 DCHECK(!it->second->is_connected()); | 274 DCHECK(!it->second->is_connected()); |
276 delete it->second; | 275 delete it->second; |
277 DCHECK(!channels_[name]); | 276 DCHECK(channels_.find(name) == channels_.end()); |
278 } | 277 } |
279 } | 278 } |
280 | 279 |
281 void JingleSession::OnTransportCandidate(Transport* transport, | 280 void JingleSession::OnTransportCandidate(Transport* transport, |
282 const cricket::Candidate& candidate) { | 281 const cricket::Candidate& candidate) { |
283 pending_candidates_.push_back(JingleMessage::NamedCandidate( | 282 pending_candidates_.push_back(JingleMessage::NamedCandidate( |
284 transport->name(), candidate)); | 283 transport->name(), candidate)); |
285 | 284 |
286 if (!transport_infos_timer_.IsRunning()) { | 285 if (!transport_infos_timer_.IsRunning()) { |
287 // Delay sending the new candidates in case we get more candidates | 286 // Delay sending the new candidates in case we get more candidates |
(...skipping 386 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
674 } | 673 } |
675 } | 674 } |
676 | 675 |
677 bool JingleSession::is_session_active() { | 676 bool JingleSession::is_session_active() { |
678 return state_ == CONNECTING || state_ == ACCEPTING || state_ == CONNECTED || | 677 return state_ == CONNECTING || state_ == ACCEPTING || state_ == CONNECTED || |
679 state_ == AUTHENTICATING || state_ == AUTHENTICATED; | 678 state_ == AUTHENTICATING || state_ == AUTHENTICATED; |
680 } | 679 } |
681 | 680 |
682 } // namespace protocol | 681 } // namespace protocol |
683 } // namespace remoting | 682 } // namespace remoting |
OLD | NEW |