Add thread safety annotations for some more PeerConnection members (part 10)

Plus all the annotations that were necessary to make things compile
again.

Bug: webrtc:9987
Change-Id: I2b08c7db10dda7b18ad4ba036125f2a56ebf80a0
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/130478
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27419}
This commit is contained in:
Karl Wiberg
2019-04-02 13:00:46 +02:00
committed by Commit Bot
parent 62bb47f5f8
commit 7a651c6e58
2 changed files with 14 additions and 10 deletions

View File

@ -6366,7 +6366,7 @@ bool PeerConnection::CreateSctpTransport_n(const std::string& mid) {
}
void PeerConnection::DestroySctpTransport_n() {
RTC_DCHECK(network_thread()->IsCurrent());
RTC_DCHECK_RUN_ON(network_thread());
sctp_transport_->Clear();
sctp_transport_ = nullptr;
sctp_mid_.reset();
@ -6374,8 +6374,8 @@ void PeerConnection::DestroySctpTransport_n() {
}
void PeerConnection::OnSctpTransportReadyToSendData_n() {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
RTC_DCHECK(network_thread()->IsCurrent());
// Note: Cannot use rtc::Bind here because it will grab a reference to
// PeerConnection and potentially cause PeerConnection to live longer than
// expected. It is safe not to grab a reference since the sctp_invoker_ will
@ -6395,8 +6395,8 @@ void PeerConnection::OnSctpTransportReadyToSendData_s(bool ready) {
void PeerConnection::OnSctpTransportDataReceived_n(
const cricket::ReceiveDataParams& params,
const rtc::CopyOnWriteBuffer& payload) {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
RTC_DCHECK(network_thread()->IsCurrent());
// Note: Cannot use rtc::Bind here because it will grab a reference to
// PeerConnection and potentially cause PeerConnection to live longer than
// expected. It is safe not to grab a reference since the sctp_invoker_ will
@ -6418,8 +6418,8 @@ void PeerConnection::OnSctpTransportDataReceived_s(
}
void PeerConnection::OnSctpClosingProcedureStartedRemotely_n(int sid) {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
RTC_DCHECK(network_thread()->IsCurrent());
sctp_invoker_->AsyncInvoke<void>(
RTC_FROM_HERE, signaling_thread(),
rtc::Bind(&sigslot::signal1<int>::operator(),
@ -6427,8 +6427,8 @@ void PeerConnection::OnSctpClosingProcedureStartedRemotely_n(int sid) {
}
void PeerConnection::OnSctpClosingProcedureComplete_n(int sid) {
RTC_DCHECK_RUN_ON(network_thread());
RTC_DCHECK(data_channel_type_ == cricket::DCT_SCTP);
RTC_DCHECK(network_thread()->IsCurrent());
sctp_invoker_->AsyncInvoke<void>(
RTC_FROM_HERE, signaling_thread(),
rtc::Bind(&sigslot::signal1<int>::operator(),

View File

@ -1236,13 +1236,17 @@ class PeerConnection : public PeerConnectionInternal,
// TODO(deadbeef): Use a proxy object to ensure that method calls/signals
// are marshalled to the right thread. Could almost use proxy.h for this,
// but it doesn't have a mechanism for marshalling sigslot::signals
std::unique_ptr<rtc::AsyncInvoker> sctp_invoker_;
sigslot::signal1<bool> SignalSctpReadyToSendData;
std::unique_ptr<rtc::AsyncInvoker> sctp_invoker_
RTC_GUARDED_BY(network_thread());
sigslot::signal1<bool> SignalSctpReadyToSendData
RTC_GUARDED_BY(signaling_thread());
sigslot::signal2<const cricket::ReceiveDataParams&,
const rtc::CopyOnWriteBuffer&>
SignalSctpDataReceived;
sigslot::signal1<int> SignalSctpClosingProcedureStartedRemotely;
sigslot::signal1<int> SignalSctpClosingProcedureComplete;
SignalSctpDataReceived RTC_GUARDED_BY(signaling_thread());
sigslot::signal1<int> SignalSctpClosingProcedureStartedRemotely
RTC_GUARDED_BY(signaling_thread());
sigslot::signal1<int> SignalSctpClosingProcedureComplete
RTC_GUARDED_BY(signaling_thread());
// Whether this peer is the caller. Set when the local description is applied.
absl::optional<bool> is_caller_ RTC_GUARDED_BY(signaling_thread());