| Index: webrtc/p2p/base/dtlstransport.h
|
| diff --git a/webrtc/p2p/base/dtlstransport.h b/webrtc/p2p/base/dtlstransport.h
|
| index 8850cfc29a3ab767ab7fc7a2b0b0a00d87c5951b..8954ee11dce16dd390ad58c89da2d2064946eb2a 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& 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 {
|
| - DCHECK(Base::worker_thread()->IsCurrent());
|
| certificate_ = certificate;
|
| }
|
| - bool GetCertificate_w(
|
| + bool GetLocalCertificate(
|
| 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();
|
|
|
| @@ -98,12 +94,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 {
|
| - 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 +195,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 +214,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_)) {
|
| @@ -245,7 +237,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_;
|
|
|