diff --git a/gfx/layers/composite/ContentHost.cpp b/gfx/layers/composite/ContentHost.cpp index 99b735cd2b6d..2d62d0acf228 100644 --- a/gfx/layers/composite/ContentHost.cpp +++ b/gfx/layers/composite/ContentHost.cpp @@ -495,6 +495,7 @@ ContentHostIncremental::EnsureDeprecatedTextureHostIncremental(ISurfaceAllocator mUpdateList.AppendElement(new TextureCreationRequest(aTextureInfo, aBufferRect)); mDeAllocator = aAllocator; + FlushUpdateQueue(); } void @@ -510,6 +511,20 @@ ContentHostIncremental::UpdateIncremental(TextureIdentifier aTextureId, aUpdated, aBufferRect, aBufferRotation)); + FlushUpdateQueue(); +} + +void +ContentHostIncremental::FlushUpdateQueue() +{ + // If we're not compositing for some reason (the window being minimized + // is one example), then we never process these updates and it can consume + // huge amounts of memory. Instead we forcibly process the updates (during the + // transaction) if the list gets too long. + static const uint32_t kMaxUpdateCount = 6; + if (mUpdateList.Length() >= kMaxUpdateCount) { + ProcessTextureUpdates(); + } } void diff --git a/gfx/layers/composite/ContentHost.h b/gfx/layers/composite/ContentHost.h index ed606400b626..de3bc3e50669 100644 --- a/gfx/layers/composite/ContentHost.h +++ b/gfx/layers/composite/ContentHost.h @@ -296,6 +296,7 @@ public: private: + void FlushUpdateQueue(); void ProcessTextureUpdates(); class Request