mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-27 06:43:32 +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)
|
explicit SPSCRingBufferBase(int aCapacity)
|
||||||
: mReadIndex(0),
|
: mReadIndex(0),
|
||||||
mWriteIndex(0)
|
mWriteIndex(0),
|
||||||
/* One more element to distinguish from empty and full buffer. */
|
/* One more element to distinguish from empty and full buffer. */
|
||||||
,
|
|
||||||
mCapacity(aCapacity + 1) {
|
mCapacity(aCapacity + 1) {
|
||||||
MOZ_ASSERT(StorageCapacity() < std::numeric_limits<int>::max() / 2,
|
MOZ_RELEASE_ASSERT(aCapacity != std::numeric_limits<int>::max());
|
||||||
"buffer too large for the type of index used.");
|
MOZ_RELEASE_ASSERT(mCapacity > 0);
|
||||||
MOZ_ASSERT(mCapacity > 0 && aCapacity != std::numeric_limits<int>::max());
|
|
||||||
|
|
||||||
mData = std::make_unique<T[]>(StorageCapacity());
|
mData = std::make_unique<T[]>(StorageCapacity());
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user