DtlsTransport::ice_transport is const and can be called off thread
Since the ice_transport element of DtlsTransport is never changed over the lifetime of the object, it's safe to return it on any thread. Added const qualifier to make this obvious. Bug: chromium:907849 Change-Id: Ib180682689a57df5106717b125c626d7ac9e7561 Reviewed-on: https://webrtc-review.googlesource.com/c/123781 Reviewed-by: Henrik Boström <hbos@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#26800}
This commit is contained in:
parent
ee95f3eacd
commit
26451933c1
@ -45,12 +45,12 @@ DtlsTransport::DtlsTransport(
|
||||
std::unique_ptr<cricket::DtlsTransportInternal> internal)
|
||||
: owner_thread_(rtc::Thread::Current()),
|
||||
info_(DtlsTransportState::kNew),
|
||||
internal_dtls_transport_(std::move(internal)) {
|
||||
internal_dtls_transport_(std::move(internal)),
|
||||
ice_transport_(new rtc::RefCountedObject<IceTransportWithPointer>(
|
||||
internal_dtls_transport_->ice_transport())) {
|
||||
RTC_DCHECK(internal_dtls_transport_.get());
|
||||
internal_dtls_transport_->SignalDtlsState.connect(
|
||||
this, &DtlsTransport::OnInternalDtlsState);
|
||||
ice_transport_ = new rtc::RefCountedObject<IceTransportWithPointer>(
|
||||
internal_dtls_transport_->ice_transport());
|
||||
UpdateInformation();
|
||||
}
|
||||
|
||||
@ -77,8 +77,6 @@ void DtlsTransport::UnregisterObserver() {
|
||||
}
|
||||
|
||||
rtc::scoped_refptr<IceTransportInterface> DtlsTransport::ice_transport() {
|
||||
RTC_DCHECK_RUN_ON(owner_thread_);
|
||||
rtc::CritScope scope(&lock_);
|
||||
return ice_transport_;
|
||||
}
|
||||
|
||||
|
||||
@ -66,8 +66,7 @@ class DtlsTransport : public DtlsTransportInterface,
|
||||
DtlsTransportInformation info_ RTC_GUARDED_BY(lock_);
|
||||
std::unique_ptr<cricket::DtlsTransportInternal> internal_dtls_transport_
|
||||
RTC_GUARDED_BY(lock_);
|
||||
rtc::scoped_refptr<IceTransportWithPointer> ice_transport_
|
||||
RTC_GUARDED_BY(lock_);
|
||||
const rtc::scoped_refptr<IceTransportWithPointer> ice_transport_;
|
||||
};
|
||||
|
||||
} // namespace webrtc
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user