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

Unified Diff: webrtc/test/channel_transport/udp_socket2_manager_win.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/test/channel_transport/udp_socket2_manager_win.cc
diff --git a/webrtc/test/channel_transport/udp_socket2_manager_win.cc b/webrtc/test/channel_transport/udp_socket2_manager_win.cc
index 55ddaee068324953946d595e427700894a504ce1..8ab70d3085ed8e98c0f04251fdad0e1a12e87227 100644
--- a/webrtc/test/channel_transport/udp_socket2_manager_win.cc
+++ b/webrtc/test/channel_transport/udp_socket2_manager_win.cc
@@ -13,6 +13,7 @@
#include <assert.h>
#include <stdio.h>
+#include "webrtc/base/atomicops.h"
#include "webrtc/system_wrappers/interface/aligned_malloc.h"
#include "webrtc/test/channel_transport/udp_socket2_win.h"
@@ -418,7 +419,7 @@ IoContextPool::IoContextPool()
IoContextPool::~IoContextPool()
{
Free();
- assert(_size.Value() == 0);
+ assert(rtc::AtomicOps::AcquireLoad(&_size) == 0);
AlignedFree(_pListHead);
}
@@ -461,9 +462,9 @@ PerIoContext* IoContextPool::PopIoContext()
memset(&item->payload.ioContext,0,sizeof(PerIoContext));
item->payload.base = item;
pListEntry = &(item->itemEntry);
- ++_size;
+ rtc::AtomicOps::Increment(&_size);
}
- ++_inUse;
+ rtc::AtomicOps::Increment(&_inUse);
return &((IoContextPoolItem*)pListEntry)->payload.ioContext;
}
@@ -476,8 +477,8 @@ int32_t IoContextPool::PushIoContext(PerIoContext* pIoContext)
IoContextPoolItem* item = ((IoContextPoolItemPayload*)pIoContext)->base;
- const int32_t usedItems = --_inUse;
- const int32_t totalItems = _size.Value();
+ const int32_t usedItems = rtc::AtomicOps::Decrement(&_inUse);
+ const int32_t totalItems = rtc::AtomicOps::AcquireLoad(&_size);
const int32_t freeItems = totalItems - usedItems;
if(freeItems < 0)
{
@@ -489,7 +490,7 @@ int32_t IoContextPool::PushIoContext(PerIoContext* pIoContext)
overlappedIOCompleted)
{
AlignedFree(item);
- --_size;
+ rtc::AtomicOps::Decrement(&_size);
return 0;
}
InterlockedPushEntrySList(_pListHead, &(item->itemEntry));
@@ -509,7 +510,7 @@ int32_t IoContextPool::Free()
{
IoContextPoolItem* item = ((IoContextPoolItem*)pListEntry);
AlignedFree(item);
- --_size;
+ rtc::AtomicOps::Decrement(&_size);
itemsFreed++;
pListEntry = InterlockedPopEntrySList(_pListHead);
}

Powered by Google App Engine
This is Rietveld 408576698