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

Unified Diff: webrtc/p2p/base/jseptransport.cc

Issue 2606123002: Remove the dependency of TransportChannel and TransportChannelImpl. (Closed)
Patch Set: Fix the memory leak. Created 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/p2p/base/jseptransport.h ('k') | webrtc/p2p/base/jseptransport_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/jseptransport.cc
diff --git a/webrtc/p2p/base/jseptransport.cc b/webrtc/p2p/base/jseptransport.cc
index c3d6755056706c6215078d71506d26db43984aa1..159c238a7937128f9dc4ce0172019061ab39c2ad 100644
--- a/webrtc/p2p/base/jseptransport.cc
+++ b/webrtc/p2p/base/jseptransport.cc
@@ -8,20 +8,19 @@
* be found in the AUTHORS file in the root of the source tree.
*/
+#include "webrtc/p2p/base/jseptransport.h"
+
#include <memory>
#include <utility> // for std::pair
-#include "webrtc/p2p/base/jseptransport.h"
-
+#include "webrtc/base/bind.h"
+#include "webrtc/base/checks.h"
+#include "webrtc/base/logging.h"
#include "webrtc/p2p/base/candidate.h"
#include "webrtc/p2p/base/dtlstransportchannel.h"
#include "webrtc/p2p/base/p2pconstants.h"
#include "webrtc/p2p/base/p2ptransportchannel.h"
#include "webrtc/p2p/base/port.h"
-#include "webrtc/p2p/base/transportchannelimpl.h"
-#include "webrtc/base/bind.h"
-#include "webrtc/base/checks.h"
-#include "webrtc/base/logging.h"
namespace cricket {
@@ -127,7 +126,7 @@ JsepTransport::JsepTransport(
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate)
: mid_(mid), certificate_(certificate) {}
-bool JsepTransport::AddChannel(TransportChannelImpl* dtls, int component) {
+bool JsepTransport::AddChannel(DtlsTransportInternal* dtls, int component) {
if (channels_.find(component) != channels_.end()) {
LOG(LS_ERROR) << "Adding channel for component " << component << " twice.";
return false;
@@ -286,13 +285,14 @@ bool JsepTransport::GetStats(TransportStats* stats) {
stats->transport_name = mid();
stats->channel_stats.clear();
for (auto& kv : channels_) {
- TransportChannelImpl* channel = kv.second;
+ DtlsTransportInternal* dtls_transport = kv.second;
TransportChannelStats substats;
substats.component = kv.first;
- channel->GetSrtpCryptoSuite(&substats.srtp_crypto_suite);
- channel->GetSslCipherSuite(&substats.ssl_cipher_suite);
- substats.dtls_state = channel->dtls_state();
- if (!channel->GetStats(&substats.connection_infos)) {
+ dtls_transport->GetSrtpCryptoSuite(&substats.srtp_crypto_suite);
+ dtls_transport->GetSslCipherSuite(&substats.ssl_cipher_suite);
+ substats.dtls_state = dtls_transport->dtls_state();
+ if (!dtls_transport->ice_transport()->GetStats(
+ &substats.connection_infos)) {
return false;
}
stats->channel_stats.push_back(substats);
@@ -325,36 +325,39 @@ bool JsepTransport::VerifyCertificateFingerprint(
}
bool JsepTransport::ApplyLocalTransportDescription(
- TransportChannelImpl* channel,
+ DtlsTransportInternal* dtls_transport,
std::string* error_desc) {
- channel->SetIceParameters(local_description_->GetIceParameters());
+ dtls_transport->ice_transport()->SetIceParameters(
+ local_description_->GetIceParameters());
return true;
}
bool JsepTransport::ApplyRemoteTransportDescription(
- TransportChannelImpl* channel,
+ DtlsTransportInternal* dtls_transport,
std::string* error_desc) {
// Currently, all ICE-related calls still go through this DTLS channel. But
// that will change once we get rid of TransportChannelImpl, and the DTLS
// channel interface no longer includes ICE-specific methods. Then this class
// will need to call dtls->ice()->SetIceRole(), for example, assuming the Dtls
// interface will expose its inner ICE channel.
- channel->SetRemoteIceParameters(remote_description_->GetIceParameters());
- channel->SetRemoteIceMode(remote_description_->ice_mode);
+ dtls_transport->ice_transport()->SetRemoteIceParameters(
+ remote_description_->GetIceParameters());
+ dtls_transport->ice_transport()->SetRemoteIceMode(
+ remote_description_->ice_mode);
return true;
}
bool JsepTransport::ApplyNegotiatedTransportDescription(
- TransportChannelImpl* channel,
+ DtlsTransportInternal* dtls_transport,
std::string* error_desc) {
// Set SSL role. Role must be set before fingerprint is applied, which
// initiates DTLS setup.
- if (!channel->SetSslRole(secure_role_)) {
+ if (!dtls_transport->SetSslRole(secure_role_)) {
return BadTransportDescription("Failed to set SSL role for the channel.",
error_desc);
}
// Apply remote fingerprint.
- if (!channel->SetRemoteFingerprint(
+ if (!dtls_transport->SetRemoteFingerprint(
remote_fingerprint_->algorithm,
reinterpret_cast<const uint8_t*>(remote_fingerprint_->digest.data()),
remote_fingerprint_->digest.size())) {
« no previous file with comments | « webrtc/p2p/base/jseptransport.h ('k') | webrtc/p2p/base/jseptransport_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698