Index: webrtc/p2p/base/dtlstransport.h |
diff --git a/webrtc/p2p/base/dtlstransport.h b/webrtc/p2p/base/dtlstransport.h |
index 9fd3ba3274ad585e3196bfc36989f763510f650e..b0684559e6a1c0b535094414e274ace05d0c93ac 100644 |
--- a/webrtc/p2p/base/dtlstransport.h |
+++ b/webrtc/p2p/base/dtlstransport.h |
@@ -23,33 +23,31 @@ namespace cricket { |
class PortAllocator; |
-// Base should be a descendant of cricket::Transport |
-// TODO(hbos): Add appropriate DCHECK thread checks to all methods. |
+// Base should be a descendant of cricket::Transport and have a constructor |
+// that takes a transport name and PortAllocator. |
+// |
+// Everything in this class should be called on the worker thread. |
template<class Base> |
class DtlsTransport : public Base { |
public: |
- DtlsTransport(rtc::Thread* signaling_thread, |
- rtc::Thread* worker_thread, |
- const std::string& content_name, |
+ DtlsTransport(const std::string& content_name, |
PortAllocator* allocator, |
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) |
- : Base(signaling_thread, worker_thread, content_name, allocator), |
+ : Base(content_name, allocator), |
certificate_(certificate), |
secure_role_(rtc::SSL_CLIENT), |
- ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) { |
- } |
+ ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) {} |
~DtlsTransport() { |
Base::DestroyAllChannels(); |
} |
- void SetCertificate_w( |
+ |
+ void SetCertificate( |
const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
certificate_ = certificate; |
} |
- bool GetCertificate_w( |
+ bool GetCertificate( |
rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
if (!certificate_) |
return false; |
@@ -57,15 +55,13 @@ class DtlsTransport : public Base { |
return true; |
} |
- bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version) override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
+ bool SetSslMaxProtocolVersion(rtc::SSLProtocolVersion version) override { |
ssl_max_version_ = version; |
return true; |
} |
- bool ApplyLocalTransportDescription_w(TransportChannelImpl* channel, |
- std::string* error_desc) override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
+ bool ApplyLocalTransportDescription(TransportChannelImpl* channel, |
+ std::string* error_desc) override { |
rtc::SSLFingerprint* local_fp = |
Base::local_description()->identity_fingerprint.get(); |
@@ -93,19 +89,18 @@ class DtlsTransport : public Base { |
} |
// TODO(hbos): SetLocalCertificate |
- if (!channel->SetLocalIdentity( |
- certificate_ ? certificate_->identity() : nullptr)) { |
+ if (!channel->SetLocalIdentity(certificate_ ? certificate_->identity() |
+ : nullptr)) { |
return BadTransportDescription("Failed to set local identity.", |
error_desc); |
} |
// Apply the description in the base class. |
- return Base::ApplyLocalTransportDescription_w(channel, error_desc); |
+ return Base::ApplyLocalTransportDescription(channel, error_desc); |
} |
- bool NegotiateTransportDescription_w(ContentAction local_role, |
- std::string* error_desc) override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
+ bool NegotiateTransportDescription(ContentAction local_role, |
+ std::string* error_desc) override { |
if (!Base::local_description() || !Base::remote_description()) { |
const std::string msg = "Local and Remote description must be set before " |
"transport descriptions are negotiated"; |
@@ -202,7 +197,7 @@ class DtlsTransport : public Base { |
} |
// Now run the negotiation for the base class. |
- return Base::NegotiateTransportDescription_w(local_role, error_desc); |
+ return Base::NegotiateTransportDescription(local_role, error_desc); |
} |
DtlsTransportChannelWrapper* CreateTransportChannel(int component) override { |
@@ -221,18 +216,15 @@ class DtlsTransport : public Base { |
Base::DestroyTransportChannel(base_channel); |
} |
- bool GetSslRole_w(rtc::SSLRole* ssl_role) const override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
+ bool GetSslRole(rtc::SSLRole* ssl_role) const override { |
ASSERT(ssl_role != NULL); |
*ssl_role = secure_role_; |
return true; |
} |
private: |
- bool ApplyNegotiatedTransportDescription_w( |
- TransportChannelImpl* channel, |
- std::string* error_desc) override { |
- DCHECK(Base::worker_thread()->IsCurrent()); |
+ bool ApplyNegotiatedTransportDescription(TransportChannelImpl* channel, |
+ std::string* error_desc) override { |
// Set ssl role. Role must be set before fingerprint is applied, which |
// initiates DTLS setup. |
if (!channel->SetSslRole(secure_role_)) { |
@@ -247,7 +239,7 @@ class DtlsTransport : public Base { |
return BadTransportDescription("Failed to apply remote fingerprint.", |
error_desc); |
} |
- return Base::ApplyNegotiatedTransportDescription_w(channel, error_desc); |
+ return Base::ApplyNegotiatedTransportDescription(channel, error_desc); |
} |
rtc::scoped_refptr<rtc::RTCCertificate> certificate_; |