From f6735f6300003957bf20ef3f1f83bb9e320bd8b5 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Fri, 14 Feb 2014 12:56:35 -0500 Subject: [PATCH] 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. --- gfx/layers/Layers.cpp | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index b1ffbb2e7eb..239053b707c 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -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++) {