зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
12c44cad1e
Коммит
c3d3595b50
|
@ -1026,10 +1026,7 @@ LayerManager::StartFrameTimeRecording(int32_t aBufferSize)
|
|||
mRecording.mIsPaused = false;
|
||||
|
||||
if (!mRecording.mIntervals.Length()) { // Initialize recording buffers
|
||||
if (!mRecording.mIntervals.SetLength(aBufferSize)) {
|
||||
mRecording.mIsPaused = true; // OOM
|
||||
mRecording.mIntervals.Clear();
|
||||
}
|
||||
mRecording.mIntervals.SetLength(aBufferSize);
|
||||
}
|
||||
|
||||
// After being paused, recent values got invalid. Update them to now.
|
||||
|
@ -1085,11 +1082,12 @@ LayerManager::StopFrameTimeRecording(uint32_t aStartIndex,
|
|||
length = 0;
|
||||
}
|
||||
|
||||
// Set length in advance to avoid possibly repeated reallocations (and OOM checks).
|
||||
if (!length || !aFrameIntervals.SetLength(length)) {
|
||||
if (!length) {
|
||||
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;
|
||||
for (uint32_t i = 0; i < length; i++, cyclicPos++) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче