Title: [201432] trunk/Source/WebCore
- Revision
- 201432
- Author
- [email protected]
- Date
- 2016-05-26 14:57:58 -0700 (Thu, 26 May 2016)
Log Message
Use std::atomic<> rather than OSAtomicIncrement in CARingBuffer.cpp
https://bugs.webkit.org/show_bug.cgi?id=158129
Reviewed by Eric Carlson.
std::atomic is a more portable atomic primitive than OSAtomicIncrement.
* platform/audio/mac/CARingBuffer.cpp:
(WebCore::CARingBuffer::setCurrentFrameBounds):
(WebCore::CARingBuffer::getCurrentFrameBounds):
(WebCore::CARingBuffer::currentStartFrame):
(WebCore::CARingBuffer::currentEndFrame):
* platform/audio/mac/CARingBuffer.h:
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (201431 => 201432)
--- trunk/Source/WebCore/ChangeLog 2016-05-26 21:24:28 UTC (rev 201431)
+++ trunk/Source/WebCore/ChangeLog 2016-05-26 21:57:58 UTC (rev 201432)
@@ -1,3 +1,19 @@
+2016-05-26 Jer Noble <[email protected]>
+
+ Use std::atomic<> rather than OSAtomicIncrement in CARingBuffer.cpp
+ https://bugs.webkit.org/show_bug.cgi?id=158129
+
+ Reviewed by Eric Carlson.
+
+ std::atomic is a more portable atomic primitive than OSAtomicIncrement.
+
+ * platform/audio/mac/CARingBuffer.cpp:
+ (WebCore::CARingBuffer::setCurrentFrameBounds):
+ (WebCore::CARingBuffer::getCurrentFrameBounds):
+ (WebCore::CARingBuffer::currentStartFrame):
+ (WebCore::CARingBuffer::currentEndFrame):
+ * platform/audio/mac/CARingBuffer.h:
+
2016-05-26 Ryan Haddad <[email protected]>
Rebaseline bindings tests after r201428
Modified: trunk/Source/WebCore/platform/audio/mac/CARingBuffer.cpp (201431 => 201432)
--- trunk/Source/WebCore/platform/audio/mac/CARingBuffer.cpp 2016-05-26 21:24:28 UTC (rev 201431)
+++ trunk/Source/WebCore/platform/audio/mac/CARingBuffer.cpp 2016-05-26 21:57:58 UTC (rev 201432)
@@ -29,7 +29,6 @@
#if ENABLE(WEB_AUDIO) && USE(MEDIATOOLBOX)
#include <CoreAudio/CoreAudioTypes.h>
-#include <libkern/OSAtomic.h>
#include <wtf/MathExtras.h>
const uint32_t kGeneralRingTimeBoundsQueueSize = 32;
@@ -201,19 +200,19 @@
void CARingBuffer::setCurrentFrameBounds(uint64_t startTime, uint64_t endTime)
{
LockHolder locker(m_currentFrameBoundsLock);
- uint32_t nextPtr = m_timeBoundsQueuePtr + 1;
+ uint32_t nextPtr = m_timeBoundsQueuePtr.load() + 1;
uint32_t index = nextPtr & kGeneralRingTimeBoundsQueueMask;
m_timeBoundsQueue[index].m_startFrame = startTime;
m_timeBoundsQueue[index].m_endFrame = endTime;
m_timeBoundsQueue[index].m_updateCounter = nextPtr;
- OSAtomicIncrement32Barrier(static_cast<int32_t*>(&m_timeBoundsQueuePtr));
+ m_timeBoundsQueuePtr++;
}
void CARingBuffer::getCurrentFrameBounds(uint64_t &startTime, uint64_t &endTime)
{
LockHolder locker(m_currentFrameBoundsLock);
- uint32_t curPtr = m_timeBoundsQueuePtr;
+ uint32_t curPtr = m_timeBoundsQueuePtr.load();
uint32_t index = curPtr & kGeneralRingTimeBoundsQueueMask;
CARingBuffer::TimeBounds& bounds = m_timeBoundsQueue[index];
@@ -240,13 +239,13 @@
uint64_t CARingBuffer::currentStartFrame() const
{
- uint32_t index = m_timeBoundsQueuePtr & kGeneralRingTimeBoundsQueueMask;
+ uint32_t index = m_timeBoundsQueuePtr.load() & kGeneralRingTimeBoundsQueueMask;
return m_timeBoundsQueue[index].m_startFrame;
}
uint64_t CARingBuffer::currentEndFrame() const
{
- uint32_t index = m_timeBoundsQueuePtr & kGeneralRingTimeBoundsQueueMask;
+ uint32_t index = m_timeBoundsQueuePtr.load() & kGeneralRingTimeBoundsQueueMask;
return m_timeBoundsQueue[index].m_endFrame;
}
Modified: trunk/Source/WebCore/platform/audio/mac/CARingBuffer.h (201431 => 201432)
--- trunk/Source/WebCore/platform/audio/mac/CARingBuffer.h 2016-05-26 21:24:28 UTC (rev 201431)
+++ trunk/Source/WebCore/platform/audio/mac/CARingBuffer.h 2016-05-26 21:57:58 UTC (rev 201432)
@@ -85,7 +85,7 @@
Vector<TimeBounds> m_timeBoundsQueue;
Lock m_currentFrameBoundsLock;
- int32_t m_timeBoundsQueuePtr;
+ std::atomic<int32_t> m_timeBoundsQueuePtr;
};
}
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes