From 807fe4e46e2545c8ec5bf2f0045211c49631dc66 Mon Sep 17 00:00:00 2001 From: "neeti%netscape.com" Date: Thu, 13 Apr 2000 13:00:31 +0000 Subject: [PATCH] fix for bug 21329,r=pnunn, Image cache needs to limit number as well as size of the image resources consumed on WIN95/WIN98 git-svn-id: svn://10.0.0.236/trunk@65813 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/modules/libimg/src/ilclient.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mozilla/modules/libimg/src/ilclient.cpp b/mozilla/modules/libimg/src/ilclient.cpp index 1b8732c39a2..0dbf38605ab 100644 --- a/mozilla/modules/libimg/src/ilclient.cpp +++ b/mozilla/modules/libimg/src/ilclient.cpp @@ -36,6 +36,7 @@ #include "xpcompat.h" //temporary, for timers static PRUint32 image_cache_size; +static PRUint32 max_cache_items = 192; PRLogModuleInfo *il_log_module = NULL; ilISystemServices *il_ss = NULL; @@ -775,7 +776,13 @@ void il_reduce_image_cache_size_to(PRUint32 new_size) { int32 last_size = 0; - + int32 last_num_items = 0; + + while ((il_cache.items > (int32)max_cache_items) && (il_cache.items != last_num_items)) { + last_num_items = il_cache.items; + IL_ShrinkCache(); + } + while ((il_cache.bytes > (int32)new_size) && (il_cache.bytes != last_size)) { last_size = il_cache.bytes; IL_ShrinkCache();