mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Bug 1830206 - Fix an overly restrictive assertion in the SPSC ringbuffer. r=alwu, a=RyanVM
Differential Revision: https://phabricator.services.mozilla.com/D177770
This commit is contained in:
parent
c841ed68f5
commit
71ce0dc50f
@ -103,13 +103,11 @@ class SPSCRingBufferBase {
|
||||
*/
|
||||
explicit SPSCRingBufferBase(int aCapacity)
|
||||
: mReadIndex(0),
|
||||
mWriteIndex(0)
|
||||
mWriteIndex(0),
|
||||
/* One more element to distinguish from empty and full buffer. */
|
||||
,
|
||||
mCapacity(aCapacity + 1) {
|
||||
MOZ_ASSERT(StorageCapacity() < std::numeric_limits<int>::max() / 2,
|
||||
"buffer too large for the type of index used.");
|
||||
MOZ_ASSERT(mCapacity > 0 && aCapacity != std::numeric_limits<int>::max());
|
||||
MOZ_RELEASE_ASSERT(aCapacity != std::numeric_limits<int>::max());
|
||||
MOZ_RELEASE_ASSERT(mCapacity > 0);
|
||||
|
||||
mData = std::make_unique<T[]>(StorageCapacity());
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user