Bug 1287627 - Handle flush TextureHost without composition r=nical

This commit is contained in:
Sotaro Ikeda 2016-07-19 05:38:35 -07:00
Родитель d9f4ddd364
Коммит b1f63863e8
2 изменённых файлов: 18 добавлений и 0 удалений

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

@ -55,6 +55,7 @@ void
Compositor::EndFrame()
{
ReadUnlockTextures();
mLastCompositionEndTime = TimeStamp::Now();
}
void
@ -78,6 +79,18 @@ Compositor::NotifyNotUsedAfterComposition(TextureHost* aTextureHost)
MOZ_ASSERT(!mIsDestroyed);
mNotifyNotUsedAfterComposition.AppendElement(aTextureHost);
// If Compositor holds many TextureHosts without compositing,
// the TextureHosts should be flushed to reduce memory consumption.
const int thresholdCount = 5;
const double thresholdSec = 2.0f;
if (mNotifyNotUsedAfterComposition.Length() > thresholdCount) {
TimeDuration duration = TimeStamp::Now() - mLastCompositionEndTime;
// Check if we could flush
if (duration.ToSeconds() > thresholdSec) {
FlushPendingNotifyNotUsed();
}
}
}
void

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

@ -593,6 +593,11 @@ protected:
*/
nsTArray<RefPtr<TextureHost>> mNotifyNotUsedAfterComposition;
/**
* Last Composition end time.
*/
TimeStamp mLastCompositionEndTime;
/**
* Render time for the current composition.
*/