Add thread safety annotations for PeerConnection::*_state_

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

Bug: webrtc:9987
Change-Id: If7bbd5a468a8c50ac3cfe03cd2ed4f5b5f461195
Reviewed-on: https://webrtc-review.googlesource.com/c/123047
Commit-Queue: Karl Wiberg <kwiberg@webrtc.org>
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#26727}
This commit is contained in:
Karl Wiberg
2019-02-17 13:00:07 +01:00
committed by Commit Bot
parent e45c688e67
commit 8d2e228991
2 changed files with 16 additions and 7 deletions

View File

@ -1810,26 +1810,31 @@ void PeerConnection::GetStats(
} }
PeerConnectionInterface::SignalingState PeerConnection::signaling_state() { PeerConnectionInterface::SignalingState PeerConnection::signaling_state() {
RTC_DCHECK_RUN_ON(signaling_thread());
return signaling_state_; return signaling_state_;
} }
PeerConnectionInterface::IceConnectionState PeerConnectionInterface::IceConnectionState
PeerConnection::ice_connection_state() { PeerConnection::ice_connection_state() {
RTC_DCHECK_RUN_ON(signaling_thread());
return ice_connection_state_; return ice_connection_state_;
} }
PeerConnectionInterface::IceConnectionState PeerConnectionInterface::IceConnectionState
PeerConnection::standardized_ice_connection_state() { PeerConnection::standardized_ice_connection_state() {
RTC_DCHECK_RUN_ON(signaling_thread());
return standardized_ice_connection_state_; return standardized_ice_connection_state_;
} }
PeerConnectionInterface::PeerConnectionState PeerConnectionInterface::PeerConnectionState
PeerConnection::peer_connection_state() { PeerConnection::peer_connection_state() {
RTC_DCHECK_RUN_ON(signaling_thread());
return connection_state_; return connection_state_;
} }
PeerConnectionInterface::IceGatheringState PeerConnectionInterface::IceGatheringState
PeerConnection::ice_gathering_state() { PeerConnection::ice_gathering_state() {
RTC_DCHECK_RUN_ON(signaling_thread());
return ice_gathering_state_; return ice_gathering_state_;
} }
@ -1975,6 +1980,7 @@ PeerConnection::GetReceivingTransceiversOfType(cricket::MediaType media_type) {
void PeerConnection::CreateAnswer(CreateSessionDescriptionObserver* observer, void PeerConnection::CreateAnswer(CreateSessionDescriptionObserver* observer,
const RTCOfferAnswerOptions& options) { const RTCOfferAnswerOptions& options) {
RTC_DCHECK_RUN_ON(signaling_thread());
TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer"); TRACE_EVENT0("webrtc", "PeerConnection::CreateAnswer");
if (!observer) { if (!observer) {
RTC_LOG(LS_ERROR) << "CreateAnswer - observer is NULL."; RTC_LOG(LS_ERROR) << "CreateAnswer - observer is NULL.";

View File

@ -522,6 +522,7 @@ class PeerConnection : public PeerConnectionInternal,
void OnNegotiationNeeded(); void OnNegotiationNeeded();
bool IsClosed() const { bool IsClosed() const {
RTC_DCHECK_RUN_ON(signaling_thread());
return signaling_state_ == PeerConnectionInterface::kClosed; return signaling_state_ == PeerConnectionInterface::kClosed;
} }
@ -1039,14 +1040,16 @@ class PeerConnection : public PeerConnectionInternal,
// pointer (but not touch the object) from any thread. // pointer (but not touch the object) from any thread.
RtcEventLog* const event_log_ptr_ RTC_PT_GUARDED_BY(worker_thread()); RtcEventLog* const event_log_ptr_ RTC_PT_GUARDED_BY(worker_thread());
SignalingState signaling_state_ = kStable; SignalingState signaling_state_ RTC_GUARDED_BY(signaling_thread()) = kStable;
IceConnectionState ice_connection_state_ = kIceConnectionNew; IceConnectionState ice_connection_state_ RTC_GUARDED_BY(signaling_thread()) =
PeerConnectionInterface::IceConnectionState kIceConnectionNew;
standardized_ice_connection_state_ = kIceConnectionNew; PeerConnectionInterface::IceConnectionState standardized_ice_connection_state_
PeerConnectionInterface::PeerConnectionState connection_state_ = RTC_GUARDED_BY(signaling_thread()) = kIceConnectionNew;
PeerConnectionState::kNew; PeerConnectionInterface::PeerConnectionState connection_state_
RTC_GUARDED_BY(signaling_thread()) = PeerConnectionState::kNew;
IceGatheringState ice_gathering_state_ = kIceGatheringNew; IceGatheringState ice_gathering_state_ RTC_GUARDED_BY(signaling_thread()) =
kIceGatheringNew;
PeerConnectionInterface::RTCConfiguration configuration_; PeerConnectionInterface::RTCConfiguration configuration_;
// TODO(zstein): |async_resolver_factory_| can currently be nullptr if it // TODO(zstein): |async_resolver_factory_| can currently be nullptr if it