Swap use of CriticalSectionWrapper with rtc::CriticalSection in voice_engine/
Also remove mischievous tab character!
This is a part of getting rid of CriticalSectionWrapper and makes the code slightly simpler.
BUG=
Review URL: https://codereview.webrtc.org/1607353002
Cr-Commit-Position: refs/heads/master@{#11346}
diff --git a/webrtc/voice_engine/channel_manager.cc b/webrtc/voice_engine/channel_manager.cc
index 8452c8b..eac2e50 100644
--- a/webrtc/voice_engine/channel_manager.cc
+++ b/webrtc/voice_engine/channel_manager.cc
@@ -48,7 +48,6 @@
ChannelManager::ChannelManager(uint32_t instance_id, const Config& config)
: instance_id_(instance_id),
last_channel_id_(-1),
- lock_(CriticalSectionWrapper::CreateCriticalSection()),
config_(config),
event_log_(RtcEventLog::Create()) {}
@@ -66,7 +65,7 @@
event_log_.get(), config);
ChannelOwner channel_owner(channel);
- CriticalSectionScoped crit(lock_.get());
+ rtc::CritScope crit(&lock_);
channels_.push_back(channel_owner);
@@ -74,7 +73,7 @@
}
ChannelOwner ChannelManager::GetChannel(int32_t channel_id) {
- CriticalSectionScoped crit(lock_.get());
+ rtc::CritScope crit(&lock_);
for (size_t i = 0; i < channels_.size(); ++i) {
if (channels_[i].channel()->ChannelId() == channel_id)
@@ -84,7 +83,7 @@
}
void ChannelManager::GetAllChannels(std::vector<ChannelOwner>* channels) {
- CriticalSectionScoped crit(lock_.get());
+ rtc::CritScope crit(&lock_);
*channels = channels_;
}
@@ -95,7 +94,7 @@
// Channels while holding a lock, but rather when the method returns.
ChannelOwner reference(NULL);
{
- CriticalSectionScoped crit(lock_.get());
+ rtc::CritScope crit(&lock_);
std::vector<ChannelOwner>::iterator to_delete = channels_.end();
for (auto it = channels_.begin(); it != channels_.end(); ++it) {
Channel* channel = it->channel();
@@ -119,14 +118,14 @@
// lock, but rather when the method returns.
std::vector<ChannelOwner> references;
{
- CriticalSectionScoped crit(lock_.get());
+ rtc::CritScope crit(&lock_);
references = channels_;
channels_.clear();
}
}
size_t ChannelManager::NumOfChannels() const {
- CriticalSectionScoped crit(lock_.get());
+ rtc::CritScope crit(&lock_);
return channels_.size();
}