зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1287627 - Handle flush TextureHost without composition r=nical
This commit is contained in:
Родитель
d9f4ddd364
Коммит
b1f63863e8
|
@ -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.
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче