Bug 402631 - "Need to clear all images on memory-pressure notification" [p=stuart r+aM9=vlad]
authorreed@reedloden.com
Mon, 05 Nov 2007 19:41:34 -0800
changeset 7356 3f03b15b5927d12a504c33057a421f1dc7854116
parent 7355 3f407d7489099bd8180ef06248a96affa02f75af
child 7357 3445ae4cb6a15bd63fe9f11a4469b7fdadeeea66
push idunknown
push userunknown
push dateunknown
bugs402631
milestone1.9a9pre
Bug 402631 - "Need to clear all images on memory-pressure notification" [p=stuart r+aM9=vlad]
modules/libpr0n/src/imgCache.cpp
--- a/modules/libpr0n/src/imgCache.cpp
+++ b/modules/libpr0n/src/imgCache.cpp
@@ -341,15 +341,17 @@ PRBool imgCache::Remove(nsIURI *aKey)
 
   return PR_TRUE;
 }
 
 
 NS_IMETHODIMP
 imgCache::Observe(nsISupports* aSubject, const char* aTopic, const PRUnichar* aSomeData)
 {
-  if (strcmp(aTopic, "memory-pressure") == 0 ||
-      strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
-      strcmp(aTopic, "chrome-flush-caches") == 0)
+  if (strcmp(aTopic, "memory-pressure") == 0) {
+    ClearCache(PR_FALSE);
     ClearCache(PR_TRUE);
-
+  } else if (strcmp(aTopic, "chrome-flush-skin-caches") == 0 ||
+             strcmp(aTopic, "chrome-flush-caches") == 0) {
+    ClearCache(PR_TRUE);
+  }
   return NS_OK;
 }