diff options
Diffstat (limited to 'gfx/layers/Layers.cpp')
-rw-r--r-- | gfx/layers/Layers.cpp | 109 |
1 files changed, 0 insertions, 109 deletions
diff --git a/gfx/layers/Layers.cpp b/gfx/layers/Layers.cpp index 991e8ed2f0..724f2c7fdf 100644 --- a/gfx/layers/Layers.cpp +++ b/gfx/layers/Layers.cpp @@ -1545,115 +1545,6 @@ RefLayer::FillSpecificAttributes(SpecificLayerAttributes& aAttrs) aAttrs = RefLayerAttributes(GetReferentId(), mEventRegionsOverride); } -/** - * StartFrameTimeRecording, together with StopFrameTimeRecording - * enable recording of frame intervals. - * - * To allow concurrent consumers, a cyclic array is used which serves all - * consumers, practically stateless with regard to consumers. - * - * To save resources, the buffer is allocated on first call to StartFrameTimeRecording - * and recording is paused if no consumer which called StartFrameTimeRecording is able - * to get valid results (because the cyclic buffer was overwritten since that call). - * - * To determine availability of the data upon StopFrameTimeRecording: - * - mRecording.mNextIndex increases on each PostPresent, and never resets. - * - Cyclic buffer position is realized as mNextIndex % bufferSize. - * - StartFrameTimeRecording returns mNextIndex. When StopFrameTimeRecording is called, - * the required start index is passed as an arg, and we're able to calculate the required - * length. If this length is bigger than bufferSize, it means data was overwritten. - * otherwise, we can return the entire sequence. - * - To determine if we need to pause, mLatestStartIndex is updated to mNextIndex - * on each call to StartFrameTimeRecording. If this index gets overwritten, - * it means that all earlier start indices obtained via StartFrameTimeRecording - * were also overwritten, hence, no point in recording, so pause. - * - mCurrentRunStartIndex indicates the oldest index of the recording after which - * the recording was not paused. If StopFrameTimeRecording is invoked with a start index - * older than this, it means that some frames were not recorded, so data is invalid. - */ -uint32_t -LayerManager::StartFrameTimeRecording(int32_t aBufferSize) -{ - if (mRecording.mIsPaused) { - mRecording.mIsPaused = false; - - if (!mRecording.mIntervals.Length()) { // Initialize recording buffers - mRecording.mIntervals.SetLength(aBufferSize); - } - - // After being paused, recent values got invalid. Update them to now. - mRecording.mLastFrameTime = TimeStamp::Now(); - - // Any recording which started before this is invalid, since we were paused. - mRecording.mCurrentRunStartIndex = mRecording.mNextIndex; - } - - // If we'll overwrite this index, there are no more consumers with aStartIndex - // for which we're able to provide the full recording, so no point in keep recording. - mRecording.mLatestStartIndex = mRecording.mNextIndex; - return mRecording.mNextIndex; -} - -void -LayerManager::RecordFrame() -{ - if (!mRecording.mIsPaused) { - TimeStamp now = TimeStamp::Now(); - uint32_t i = mRecording.mNextIndex % mRecording.mIntervals.Length(); - mRecording.mIntervals[i] = static_cast<float>((now - mRecording.mLastFrameTime) - .ToMilliseconds()); - mRecording.mNextIndex++; - mRecording.mLastFrameTime = now; - - if (mRecording.mNextIndex > (mRecording.mLatestStartIndex + mRecording.mIntervals.Length())) { - // We've just overwritten the most recent recording start -> pause. - mRecording.mIsPaused = true; - } - } -} - -void -LayerManager::PostPresent() -{ - if (!mTabSwitchStart.IsNull()) { - mTabSwitchStart = TimeStamp(); - } -} - -void -LayerManager::StopFrameTimeRecording(uint32_t aStartIndex, - nsTArray<float>& aFrameIntervals) -{ - uint32_t bufferSize = mRecording.mIntervals.Length(); - uint32_t length = mRecording.mNextIndex - aStartIndex; - if (mRecording.mIsPaused || length > bufferSize || aStartIndex < mRecording.mCurrentRunStartIndex) { - // aStartIndex is too old. Also if aStartIndex was issued before mRecordingNextIndex overflowed (uint32_t) - // and stopped after the overflow (would happen once every 828 days of constant 60fps). - length = 0; - } - - if (!length) { - aFrameIntervals.Clear(); - 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++) { - if (cyclicPos == bufferSize) { - cyclicPos = 0; - } - aFrameIntervals[i] = mRecording.mIntervals[cyclicPos]; - } -} - -void -LayerManager::BeginTabSwitch() -{ - mTabSwitchStart = TimeStamp::Now(); -} - static void PrintInfo(std::stringstream& aStream, LayerComposite* aLayerComposite); #ifdef MOZ_DUMP_PAINTING |