From 79d583db148c692e2d47188192f44a4ff95dfd1e Mon Sep 17 00:00:00 2001 From: Sotaro Ikeda Date: Thu, 4 Sep 2014 10:28:43 -0700 Subject: [PATCH] Bug 1061943 - Purge all GradientCache on memory-pressure r=jrmuizel --- gfx/thebes/gfxGradientCache.cpp | 8 ++++++++ gfx/thebes/gfxGradientCache.h | 1 + gfx/thebes/gfxPlatform.cpp | 1 + 3 files changed, 10 insertions(+) diff --git a/gfx/thebes/gfxGradientCache.cpp b/gfx/thebes/gfxGradientCache.cpp index 5676bef09523..5bfbb71c2c9e 100644 --- a/gfx/thebes/gfxGradientCache.cpp +++ b/gfx/thebes/gfxGradientCache.cpp @@ -207,6 +207,14 @@ gfxGradientCache::GetOrCreateGradientStops(DrawTarget *aDT, nsTArrayAgeAllGenerations(); + } +} + void gfxGradientCache::Shutdown() { diff --git a/gfx/thebes/gfxGradientCache.h b/gfx/thebes/gfxGradientCache.h index 1453610e6cb5..b783d15ff83d 100644 --- a/gfx/thebes/gfxGradientCache.h +++ b/gfx/thebes/gfxGradientCache.h @@ -26,6 +26,7 @@ public: nsTArray& aStops, gfx::ExtendMode aExtend); + static void PurgeAllCaches(); static void Shutdown(); }; diff --git a/gfx/thebes/gfxPlatform.cpp b/gfx/thebes/gfxPlatform.cpp index df3aacefa09e..ac800edd5238 100644 --- a/gfx/thebes/gfxPlatform.cpp +++ b/gfx/thebes/gfxPlatform.cpp @@ -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;