Bug 1061943 - Purge all GradientCache on memory-pressure r=jrmuizel

This commit is contained in:
Sotaro Ikeda 2014-09-04 10:28:43 -07:00
parent 260d99142e
commit 47368e0d0a
3 changed files with 10 additions and 0 deletions

View File

@ -207,6 +207,14 @@ gfxGradientCache::GetOrCreateGradientStops(DrawTarget *aDT, nsTArray<GradientSto
return gs;
}
void
gfxGradientCache::PurgeAllCaches()
{
if (gGradientCache) {
gGradientCache->AgeAllGenerations();
}
}
void
gfxGradientCache::Shutdown()
{

View File

@ -26,6 +26,7 @@ public:
nsTArray<gfx::GradientStop>& aStops,
gfx::ExtendMode aExtend);
static void PurgeAllCaches();
static void Shutdown();
};

View File

@ -220,6 +220,7 @@ MemoryPressureObserver::Observe(nsISupports *aSubject,
{
NS_ASSERTION(strcmp(aTopic, "memory-pressure") == 0, "unexpected event topic");
Factory::PurgeAllCaches();
gfxGradientCache::PurgeAllCaches();
gfxPlatform::GetPlatform()->PurgeSkiaCache();
return NS_OK;