Index: webrtc/voice_engine/channel_manager.cc |
diff --git a/webrtc/voice_engine/channel_manager.cc b/webrtc/voice_engine/channel_manager.cc |
index 8452c8b63dbb5a259eebe2f210215c079c69266f..5677b511a16435a7e290db4776a45208b9189ad4 100644 |
--- a/webrtc/voice_engine/channel_manager.cc |
+++ b/webrtc/voice_engine/channel_manager.cc |
@@ -10,6 +10,7 @@ |
#include "webrtc/voice_engine/channel_manager.h" |
+#include "webrtc/base/atomicops.h" |
#include "webrtc/common.h" |
#include "webrtc/voice_engine/channel.h" |
@@ -21,11 +22,11 @@ ChannelOwner::ChannelOwner(class Channel* channel) |
ChannelOwner::ChannelOwner(const ChannelOwner& channel_owner) |
: channel_ref_(channel_owner.channel_ref_) { |
- ++channel_ref_->ref_count; |
+ rtc::AtomicOps::Increment(&channel_ref_->ref_count); |
} |
ChannelOwner::~ChannelOwner() { |
- if (--channel_ref_->ref_count == 0) |
+ if (rtc::AtomicOps::Decrement(&channel_ref_->ref_count) == 0) |
delete channel_ref_; |
} |
@@ -33,11 +34,11 @@ ChannelOwner& ChannelOwner::operator=(const ChannelOwner& other) { |
if (other.channel_ref_ == channel_ref_) |
return *this; |
- if (--channel_ref_->ref_count == 0) |
+ if (rtc::AtomicOps::Decrement(&channel_ref_->ref_count) == 0) |
delete channel_ref_; |
channel_ref_ = other.channel_ref_; |
- ++channel_ref_->ref_count; |
+ rtc::AtomicOps::Increment(&channel_ref_->ref_count); |
return *this; |
} |
@@ -62,8 +63,8 @@ ChannelOwner ChannelManager::CreateChannel(const Config& external_config) { |
ChannelOwner ChannelManager::CreateChannelInternal(const Config& config) { |
Channel* channel; |
- Channel::CreateChannel(channel, ++last_channel_id_, instance_id_, |
- event_log_.get(), config); |
+ Channel::CreateChannel(channel, rtc::AtomicOps::Increment(&last_channel_id_), |
+ instance_id_, event_log_.get(), config); |
ChannelOwner channel_owner(channel); |
CriticalSectionScoped crit(lock_.get()); |