This commit is contained in:
gagan%netscape.com 1998-10-07 00:29:52 +00:00
Родитель dc496ff79d
Коммит cf32d55d3e
3 изменённых файлов: 11 добавлений и 5 удалений

5
network/cache/mkcache.c поставляемый
Просмотреть файл

@ -2337,7 +2337,7 @@ NET_ChangeCacheFileLock(URL_Struct *URL_s, XP_Bool set)
#ifdef NU_CACHE #ifdef NU_CACHE
{ {
PR_ASSERT(0); /* Shouldn't be getting called */ PR_ASSERT(0); /* Shouldn't be getting called */
return FALSE; return TRUE;
} }
#else #else
{ {
@ -3283,7 +3283,8 @@ NET_CleanupCacheDirectory(char * dir_name, const char * prefix)
int i; int i;
int number_in_remove_list=0; int number_in_remove_list=0;
#ifdef NU_CACHE #ifdef NU_CACHE
PR_ASSERT(0); /* Shouldn't be getting called */ /* PR_ASSERT(0); Shouldn't be getting called */
return 0;
#endif #endif
#ifdef XP_MAC #ifdef XP_MAC

2
network/cache/nu/src/nsCachePref.cpp поставляемый
Просмотреть файл

@ -141,7 +141,7 @@ nsCachePref::BkgSleepTime(void)
const char* nsCachePref::DiskCacheDBFilename(void) const char* nsCachePref::DiskCacheDBFilename(void)
{ {
return "fat.db"; return "nufat.db";
} }
nsCachePref* nsCachePref::GetInstance() nsCachePref* nsCachePref::GetInstance()

9
network/cache/nu/src/nsDiskModule.cpp поставляемый
Просмотреть файл

@ -63,6 +63,7 @@ static PRCList g_RecentlyUsedList;
static char* g_FullFilename=0; static char* g_FullFilename=0;
const static int MAX_FILENAME_LEN = 512; const static int MAX_FILENAME_LEN = 512;
const static int MAX_OBJECTS_IN_RECENTLY_USED_LIST = 20; // change later TODO.
// Every time we cleanup we cleanup to 75% of the max available size. // Every time we cleanup we cleanup to 75% of the max available size.
// This should ideally change to a more const number than a percentage. // This should ideally change to a more const number than a percentage.
@ -162,7 +163,7 @@ PRBool nsDiskModule::Contains(nsCacheObject* io_pObject) const
nsCacheObject* pTemp = GetObject(io_pObject->Address()); nsCacheObject* pTemp = GetObject(io_pObject->Address());
if (pTemp) if (pTemp)
{ {
PR_ASSERT(io_pObject == pTemp); //PR_ASSERT(io_pObject == pTemp);
// until I do a copyFrom function // until I do a copyFrom function
return PR_TRUE; return PR_TRUE;
} }
@ -193,7 +194,11 @@ void nsDiskModule::GarbageCollect(void)
MonitorLocker ml(this); MonitorLocker ml(this);
ReduceSizeTo((PRUint32)(CLEANUP_FACTOR*m_Size)); ReduceSizeTo((PRUint32)(CLEANUP_FACTOR*m_Size));
// TODO // TODO
// if the recentlyusedlist has grown too big, trim some objects from there as well // if the recentlyusedlist has grown too big, trim some objects from there as well
//if (MAX_OBJECTS_IN_RECENTLY_USED_LIST <= PR_CLIST(g_RecentlyUsedList)
{
}
} }
nsCacheObject* nsDiskModule::GetObject(const PRUint32 i_index) const nsCacheObject* nsDiskModule::GetObject(const PRUint32 i_index) const
@ -296,7 +301,7 @@ PRBool nsDiskModule::InitDB(void)
0}; /* byte order */ 0}; /* byte order */
m_pDB = dbopen( m_pDB = dbopen(
nsCachePref::GetInstance()->DiskCacheDBFilename(), FullFilename(nsCachePref::GetInstance()->DiskCacheDBFilename()),
O_RDWR | O_CREAT, O_RDWR | O_CREAT,
0600, 0600,
DB_HASH, DB_HASH,