Deprecating ThreadChecker specific interface.

All changes outside thread_checker.h are by:
s/CalledOnValidThread/IsCurrent/
s/DetachFromThread/Detach/

Bug: webrtc:9883
Change-Id: Idbb1086bff0817db58e770116acf4c9d60fae8b3
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/131023
Commit-Queue: Sebastian Jansson <srte@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#27494}
This commit is contained in:
Sebastian Jansson
2019-04-08 15:20:44 +02:00
committed by Commit Bot
parent e5b94160b5
commit c01367db40
78 changed files with 617 additions and 615 deletions

View File

@ -89,7 +89,7 @@ AudioDeviceLinuxPulse::AudioDeviceLinuxPulse()
AudioDeviceLinuxPulse::~AudioDeviceLinuxPulse() {
RTC_LOG(LS_INFO) << __FUNCTION__ << " destroyed";
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
Terminate();
if (_recBuffer) {
@ -111,7 +111,7 @@ AudioDeviceLinuxPulse::~AudioDeviceLinuxPulse() {
}
void AudioDeviceLinuxPulse::AttachAudioBuffer(AudioDeviceBuffer* audioBuffer) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
_ptrAudioBuffer = audioBuffer;
@ -135,7 +135,7 @@ int32_t AudioDeviceLinuxPulse::ActiveAudioLayer(
}
AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_initialized) {
return InitStatus::OK;
}
@ -177,7 +177,7 @@ AudioDeviceGeneric::InitStatus AudioDeviceLinuxPulse::Init() {
}
int32_t AudioDeviceLinuxPulse::Terminate() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (!_initialized) {
return 0;
}
@ -223,12 +223,12 @@ int32_t AudioDeviceLinuxPulse::Terminate() {
}
bool AudioDeviceLinuxPulse::Initialized() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_initialized);
}
int32_t AudioDeviceLinuxPulse::InitSpeaker() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_playing) {
return -1;
@ -266,7 +266,7 @@ int32_t AudioDeviceLinuxPulse::InitSpeaker() {
}
int32_t AudioDeviceLinuxPulse::InitMicrophone() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_recording) {
return -1;
}
@ -303,17 +303,17 @@ int32_t AudioDeviceLinuxPulse::InitMicrophone() {
}
bool AudioDeviceLinuxPulse::SpeakerIsInitialized() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_mixerManager.SpeakerIsInitialized());
}
bool AudioDeviceLinuxPulse::MicrophoneIsInitialized() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_mixerManager.MicrophoneIsInitialized());
}
int32_t AudioDeviceLinuxPulse::SpeakerVolumeIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
bool wasInitialized = _mixerManager.SpeakerIsInitialized();
// Make an attempt to open up the
@ -337,7 +337,7 @@ int32_t AudioDeviceLinuxPulse::SpeakerVolumeIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::SetSpeakerVolume(uint32_t volume) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (!_playing) {
// Only update the volume if it's been set while we weren't playing.
update_speaker_volume_at_startup_ = true;
@ -346,7 +346,7 @@ int32_t AudioDeviceLinuxPulse::SetSpeakerVolume(uint32_t volume) {
}
int32_t AudioDeviceLinuxPulse::SpeakerVolume(uint32_t& volume) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
uint32_t level(0);
if (_mixerManager.SpeakerVolume(level) == -1) {
@ -359,7 +359,7 @@ int32_t AudioDeviceLinuxPulse::SpeakerVolume(uint32_t& volume) const {
}
int32_t AudioDeviceLinuxPulse::MaxSpeakerVolume(uint32_t& maxVolume) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
uint32_t maxVol(0);
if (_mixerManager.MaxSpeakerVolume(maxVol) == -1) {
@ -372,7 +372,7 @@ int32_t AudioDeviceLinuxPulse::MaxSpeakerVolume(uint32_t& maxVolume) const {
}
int32_t AudioDeviceLinuxPulse::MinSpeakerVolume(uint32_t& minVolume) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
uint32_t minVol(0);
if (_mixerManager.MinSpeakerVolume(minVol) == -1) {
@ -385,7 +385,7 @@ int32_t AudioDeviceLinuxPulse::MinSpeakerVolume(uint32_t& minVolume) const {
}
int32_t AudioDeviceLinuxPulse::SpeakerMuteIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
bool isAvailable(false);
bool wasInitialized = _mixerManager.SpeakerIsInitialized();
@ -414,12 +414,12 @@ int32_t AudioDeviceLinuxPulse::SpeakerMuteIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::SetSpeakerMute(bool enable) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_mixerManager.SetSpeakerMute(enable));
}
int32_t AudioDeviceLinuxPulse::SpeakerMute(bool& enabled) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
bool muted(0);
if (_mixerManager.SpeakerMute(muted) == -1) {
return -1;
@ -430,7 +430,7 @@ int32_t AudioDeviceLinuxPulse::SpeakerMute(bool& enabled) const {
}
int32_t AudioDeviceLinuxPulse::MicrophoneMuteIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
bool isAvailable(false);
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
@ -460,12 +460,12 @@ int32_t AudioDeviceLinuxPulse::MicrophoneMuteIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::SetMicrophoneMute(bool enable) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_mixerManager.SetMicrophoneMute(enable));
}
int32_t AudioDeviceLinuxPulse::MicrophoneMute(bool& enabled) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
bool muted(0);
if (_mixerManager.MicrophoneMute(muted) == -1) {
return -1;
@ -476,7 +476,7 @@ int32_t AudioDeviceLinuxPulse::MicrophoneMute(bool& enabled) const {
}
int32_t AudioDeviceLinuxPulse::StereoRecordingIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_recChannels == 2 && _recording) {
available = true;
return 0;
@ -507,7 +507,7 @@ int32_t AudioDeviceLinuxPulse::StereoRecordingIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::SetStereoRecording(bool enable) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (enable)
_recChannels = 2;
else
@ -517,7 +517,7 @@ int32_t AudioDeviceLinuxPulse::SetStereoRecording(bool enable) {
}
int32_t AudioDeviceLinuxPulse::StereoRecording(bool& enabled) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_recChannels == 2)
enabled = true;
else
@ -527,7 +527,7 @@ int32_t AudioDeviceLinuxPulse::StereoRecording(bool& enabled) const {
}
int32_t AudioDeviceLinuxPulse::StereoPlayoutIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_playChannels == 2 && _playing) {
available = true;
return 0;
@ -557,7 +557,7 @@ int32_t AudioDeviceLinuxPulse::StereoPlayoutIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::SetStereoPlayout(bool enable) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (enable)
_playChannels = 2;
else
@ -567,7 +567,7 @@ int32_t AudioDeviceLinuxPulse::SetStereoPlayout(bool enable) {
}
int32_t AudioDeviceLinuxPulse::StereoPlayout(bool& enabled) const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_playChannels == 2)
enabled = true;
else
@ -577,7 +577,7 @@ int32_t AudioDeviceLinuxPulse::StereoPlayout(bool& enabled) const {
}
int32_t AudioDeviceLinuxPulse::MicrophoneVolumeIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
bool wasInitialized = _mixerManager.MicrophoneIsInitialized();
// Make an attempt to open up the
@ -660,7 +660,7 @@ int16_t AudioDeviceLinuxPulse::PlayoutDevices() {
}
int32_t AudioDeviceLinuxPulse::SetPlayoutDevice(uint16_t index) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_playIsInitialized) {
return -1;
}
@ -691,7 +691,7 @@ int32_t AudioDeviceLinuxPulse::PlayoutDeviceName(
uint16_t index,
char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
const uint16_t nDevices = PlayoutDevices();
if ((index > (nDevices - 1)) || (name == NULL)) {
@ -729,7 +729,7 @@ int32_t AudioDeviceLinuxPulse::RecordingDeviceName(
uint16_t index,
char name[kAdmMaxDeviceNameSize],
char guid[kAdmMaxGuidSize]) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
const uint16_t nDevices(RecordingDevices());
if ((index > (nDevices - 1)) || (name == NULL)) {
@ -781,7 +781,7 @@ int16_t AudioDeviceLinuxPulse::RecordingDevices() {
}
int32_t AudioDeviceLinuxPulse::SetRecordingDevice(uint16_t index) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_recIsInitialized) {
return -1;
}
@ -809,7 +809,7 @@ int32_t AudioDeviceLinuxPulse::SetRecordingDevice(
}
int32_t AudioDeviceLinuxPulse::PlayoutIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
available = false;
// Try to initialize the playout side
@ -826,7 +826,7 @@ int32_t AudioDeviceLinuxPulse::PlayoutIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::RecordingIsAvailable(bool& available) {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
available = false;
// Try to initialize the playout side
@ -843,7 +843,7 @@ int32_t AudioDeviceLinuxPulse::RecordingIsAvailable(bool& available) {
}
int32_t AudioDeviceLinuxPulse::InitPlayout() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_playing) {
return -1;
@ -947,7 +947,7 @@ int32_t AudioDeviceLinuxPulse::InitPlayout() {
}
int32_t AudioDeviceLinuxPulse::InitRecording() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (_recording) {
return -1;
@ -1043,7 +1043,7 @@ int32_t AudioDeviceLinuxPulse::InitRecording() {
}
int32_t AudioDeviceLinuxPulse::StartRecording() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (!_recIsInitialized) {
return -1;
}
@ -1082,7 +1082,7 @@ int32_t AudioDeviceLinuxPulse::StartRecording() {
}
int32_t AudioDeviceLinuxPulse::StopRecording() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
rtc::CritScope lock(&_critSect);
if (!_recIsInitialized) {
@ -1136,22 +1136,22 @@ int32_t AudioDeviceLinuxPulse::StopRecording() {
}
bool AudioDeviceLinuxPulse::RecordingIsInitialized() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_recIsInitialized);
}
bool AudioDeviceLinuxPulse::Recording() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_recording);
}
bool AudioDeviceLinuxPulse::PlayoutIsInitialized() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_playIsInitialized);
}
int32_t AudioDeviceLinuxPulse::StartPlayout() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
if (!_playIsInitialized) {
return -1;
@ -1197,7 +1197,7 @@ int32_t AudioDeviceLinuxPulse::StartPlayout() {
}
int32_t AudioDeviceLinuxPulse::StopPlayout() {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
rtc::CritScope lock(&_critSect);
if (!_playIsInitialized) {
@ -1259,7 +1259,7 @@ int32_t AudioDeviceLinuxPulse::PlayoutDelay(uint16_t& delayMS) const {
}
bool AudioDeviceLinuxPulse::Playing() const {
RTC_DCHECK(thread_checker_.CalledOnValidThread());
RTC_DCHECK(thread_checker_.IsCurrent());
return (_playing);
}