Bug 1803109 - Discard blocks of data that are too big for two chunks. r=canaltinova

Currently, `ReserveAndPutRaw` allocates a second span even if the data would be too big for the chunk.
Here a second conditional is added to check if the block of data is too big in this scenario and silently discard the data if so.

Differential Revision: https://phabricator.services.mozilla.com/D167167
This commit is contained in:
Kash Shampur 2023-01-27 17:25:37 +00:00
Родитель 0d60b0b101
Коммит c0d7f950f7
1 изменённых файлов: 6 добавлений и 0 удалений

Просмотреть файл

@ -1108,6 +1108,12 @@ class ProfileChunkedBuffer {
MOZ_ASSERT(maybeEntryWriter->RemainingBytes() == blockBytes);
mRangeEnd += blockBytes;
mPushedBlockCount += aBlockCount;
} else if (blockBytes >= current->BufferBytes()) {
// Currently only two buffer chunks are held at a time and it is not
// possible to write an object that takes up more space than this. In
// this scenario, silently discard this block of data if it is unable
// to fit into the two reserved profiler chunks.
mFailedPutBytes += blockBytes;
} else {
// Block doesn't fit fully in current chunk, it needs to overflow into
// the next one.