| Index: webrtc/p2p/base/dtlstransport.h
|
| diff --git a/webrtc/p2p/base/dtlstransport.h b/webrtc/p2p/base/dtlstransport.h
|
| index 9559c1e6d2ec729984c2e1ca946a60094477e7bb..c448eb16fc773ee8e014fbb9e700469f1ec4c189 100644
|
| --- a/webrtc/p2p/base/dtlstransport.h
|
| +++ b/webrtc/p2p/base/dtlstransport.h
|
| @@ -11,7 +11,6 @@
|
| #ifndef WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
|
| #define WEBRTC_P2P_BASE_DTLSTRANSPORT_H_
|
|
|
| -#include "webrtc/base/checks.h"
|
| #include "webrtc/p2p/base/dtlstransportchannel.h"
|
| #include "webrtc/p2p/base/transport.h"
|
|
|
| @@ -23,33 +22,31 @@ namespace cricket {
|
|
|
| class PortAllocator;
|
|
|
| -// Base should be a descendant of cricket::Transport
|
| -// TODO(hbos): Add appropriate RTC_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& name,
|
| PortAllocator* allocator,
|
| const rtc::scoped_refptr<rtc::RTCCertificate>& certificate)
|
| - : Base(signaling_thread, worker_thread, content_name, allocator),
|
| + : Base(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 SetLocalCertificate(
|
| const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) override {
|
| - RTC_DCHECK(Base::worker_thread()->IsCurrent());
|
| certificate_ = certificate;
|
| }
|
| - bool GetCertificate_w(
|
| + bool GetLocalCertificate(
|
| rtc::scoped_refptr<rtc::RTCCertificate>* certificate) override {
|
| - RTC_DCHECK(Base::worker_thread()->IsCurrent());
|
| if (!certificate_)
|
| return false;
|
|
|
| @@ -57,15 +54,13 @@ class DtlsTransport : public Base {
|
| return true;
|
| }
|
|
|
| - bool SetSslMaxProtocolVersion_w(rtc::SSLProtocolVersion version) override {
|
| - RTC_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 {
|
| - RTC_DCHECK(Base::worker_thread()->IsCurrent());
|
| + bool ApplyLocalTransportDescription(TransportChannelImpl* channel,
|
| + std::string* error_desc) override {
|
| rtc::SSLFingerprint* local_fp =
|
| Base::local_description()->identity_fingerprint.get();
|
|
|
| @@ -98,12 +93,11 @@ class DtlsTransport : public Base {
|
| }
|
|
|
| // 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 {
|
| - RTC_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";
|
| @@ -200,7 +194,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 {
|
| @@ -219,18 +213,15 @@ class DtlsTransport : public Base {
|
| Base::DestroyTransportChannel(base_channel);
|
| }
|
|
|
| - bool GetSslRole_w(rtc::SSLRole* ssl_role) const override {
|
| - RTC_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 {
|
| - RTC_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_)) {
|
| @@ -245,7 +236,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_;
|
|
|