Changeset 201432 in webkit
- Timestamp:
- May 26, 2016, 2:57:58 PM (9 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201429 r201432 1 2016-05-26 Jer Noble <jer.noble@apple.com> 2 3 Use std::atomic<> rather than OSAtomicIncrement in CARingBuffer.cpp 4 https://bugs.webkit.org/show_bug.cgi?id=158129 5 6 Reviewed by Eric Carlson. 7 8 std::atomic is a more portable atomic primitive than OSAtomicIncrement. 9 10 * platform/audio/mac/CARingBuffer.cpp: 11 (WebCore::CARingBuffer::setCurrentFrameBounds): 12 (WebCore::CARingBuffer::getCurrentFrameBounds): 13 (WebCore::CARingBuffer::currentStartFrame): 14 (WebCore::CARingBuffer::currentEndFrame): 15 * platform/audio/mac/CARingBuffer.h: 16 1 17 2016-05-26 Ryan Haddad <ryanhaddad@apple.com> 2 18 -
trunk/Source/WebCore/platform/audio/mac/CARingBuffer.cpp
r188169 r201432 30 30 31 31 #include <CoreAudio/CoreAudioTypes.h> 32 #include <libkern/OSAtomic.h>33 32 #include <wtf/MathExtras.h> 34 33 … … 202 201 { 203 202 LockHolder locker(m_currentFrameBoundsLock); 204 uint32_t nextPtr = m_timeBoundsQueuePtr + 1;203 uint32_t nextPtr = m_timeBoundsQueuePtr.load() + 1; 205 204 uint32_t index = nextPtr & kGeneralRingTimeBoundsQueueMask; 206 205 … … 208 207 m_timeBoundsQueue[index].m_endFrame = endTime; 209 208 m_timeBoundsQueue[index].m_updateCounter = nextPtr; 210 OSAtomicIncrement32Barrier(static_cast<int32_t*>(&m_timeBoundsQueuePtr));209 m_timeBoundsQueuePtr++; 211 210 } 212 211 … … 214 213 { 215 214 LockHolder locker(m_currentFrameBoundsLock); 216 uint32_t curPtr = m_timeBoundsQueuePtr ;215 uint32_t curPtr = m_timeBoundsQueuePtr.load(); 217 216 uint32_t index = curPtr & kGeneralRingTimeBoundsQueueMask; 218 217 CARingBuffer::TimeBounds& bounds = m_timeBoundsQueue[index]; … … 241 240 uint64_t CARingBuffer::currentStartFrame() const 242 241 { 243 uint32_t index = m_timeBoundsQueuePtr & kGeneralRingTimeBoundsQueueMask;242 uint32_t index = m_timeBoundsQueuePtr.load() & kGeneralRingTimeBoundsQueueMask; 244 243 return m_timeBoundsQueue[index].m_startFrame; 245 244 } … … 247 246 uint64_t CARingBuffer::currentEndFrame() const 248 247 { 249 uint32_t index = m_timeBoundsQueuePtr & kGeneralRingTimeBoundsQueueMask;248 uint32_t index = m_timeBoundsQueuePtr.load() & kGeneralRingTimeBoundsQueueMask; 250 249 return m_timeBoundsQueue[index].m_endFrame; 251 250 } -
trunk/Source/WebCore/platform/audio/mac/CARingBuffer.h
r188169 r201432 86 86 Vector<TimeBounds> m_timeBoundsQueue; 87 87 Lock m_currentFrameBoundsLock; 88 int32_tm_timeBoundsQueuePtr;88 std::atomic<int32_t> m_timeBoundsQueuePtr; 89 89 }; 90 90
Note:
See TracChangeset
for help on using the changeset viewer.