mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 969865 - Fix the allocation handling of frame time recording; r=avih
The size of these arrays can be controlled by a pref, but the max size is bound to 216k, therefore we do not need to do a fallible allocation for them.
This commit is contained in:
parent
ac768ae73a
commit
f6735f6300
@ -1026,10 +1026,7 @@ LayerManager::StartFrameTimeRecording(int32_t aBufferSize)
|
|||||||
mRecording.mIsPaused = false;
|
mRecording.mIsPaused = false;
|
||||||
|
|
||||||
if (!mRecording.mIntervals.Length()) { // Initialize recording buffers
|
if (!mRecording.mIntervals.Length()) { // Initialize recording buffers
|
||||||
if (!mRecording.mIntervals.SetLength(aBufferSize)) {
|
mRecording.mIntervals.SetLength(aBufferSize);
|
||||||
mRecording.mIsPaused = true; // OOM
|
|
||||||
mRecording.mIntervals.Clear();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// After being paused, recent values got invalid. Update them to now.
|
// After being paused, recent values got invalid. Update them to now.
|
||||||
@ -1085,11 +1082,12 @@ LayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
|
|||||||
length = 0;
|
length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set length in advance to avoid possibly repeated reallocations (and OOM checks).
|
if (!length) {
|
||||||
if (!length || !aFrameIntervals.SetLength(length)) {
|
|
||||||
aFrameIntervals.Clear();
|
aFrameIntervals.Clear();
|
||||||
return; // empty recording or OOM, return empty arrays.
|
return; // empty recording, return empty arrays.
|
||||||
}
|
}
|
||||||
|
// Set length in advance to avoid possibly repeated reallocations
|
||||||
|
aFrameIntervals.SetLength(length);
|
||||||
|
|
||||||
uint32_t cyclicPos = aStartIndex % bufferSize;
|
uint32_t cyclicPos = aStartIndex % bufferSize;
|
||||||
for (uint32_t i = 0; i < length; i++, cyclicPos++) {
|
for (uint32_t i = 0; i < length; i++, cyclicPos++) {
|
||||||
|
Loading…
Reference in New Issue
Block a user