Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1318)

Unified Diff: webrtc/voice_engine/channel_manager.cc

Issue 1347793005: Replace Atomic32 with webrtc/base/atomicops.h. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: fix typo Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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());

Powered by Google App Engine
This is Rietveld 408576698