Cache changes, bug fixes, etc.

This commit is contained in:
gagan%netscape.com 1998-12-09 02:43:16 +00:00
Родитель 49cdc38520
Коммит fb7aa22c15
4 изменённых файлов: 21 добавлений и 10 удалений

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

@ -350,8 +350,7 @@ CacheObject_Synch(void* pThis)
if (pThis)
{
nsCacheObject* pObj = (nsCacheObject*) pThis;
PRBool bStatus = CACHEMGR->GetModule(pObj->Module())->AddObject(pObj);
return bStatus;
return CACHEMGR->GetModule(pObj->Module())->AddObject(pObj);
}
return PR_FALSE;
}

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

@ -40,10 +40,12 @@ static const PRUint32 BKG_THREAD_SLEEP = 15*60; /*in seconds, 15 minutes */
static const PRUint16 BUGS_FOUND_SO_FAR = 0;
//Preferences
static const char const* MEM_CACHE_PREF = "browser.cache.memory_cache_size";
static const char const* DISK_CACHE_PREF = "browser.cache.disk_cache_size";
static const char const* CACHE_DIR_PREF = "browser.cache.directory";
static const char const* FREQ_PREF = "browser.cache.check_doc_frequency";
static const char * const MEM_CACHE_PREF = "browser.cache.memory_cache_size";
static const char * const DISK_CACHE_PREF = "browser.cache.disk_cache_size";
static const char * const CACHE_DIR_PREF = "browser.cache.directory";
static const char * const FREQ_PREF = "browser.cache.check_doc_frequency";
//Not implemented as yet...
static const char * const BKG_CLEANUP = "browser.cache.cleanup_period"; //Default for BKG_THREAD_SLEEP
/* Find a bug in NU_CACHE, get these many chocolates */
static const PRUint16 CHOCOLATES_PER_BUG_FOUND = 2^BUGS_FOUND_SO_FAR;
@ -174,7 +176,8 @@ nsCachePref::SetupPrefs(const char* i_Pref)
// Create the dir.
status = PR_MkDir(cacheDir, 0600);
if (PR_SUCCESS != status) {
m_DiskCacheFolder = 0;
m_DiskCacheFolder = new char[1];
*m_DiskCacheFolder = '\0';
return;
}
}

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

@ -138,6 +138,10 @@ PRBool nsDiskModule::AddObject(nsCacheObject* io_pObject)
if (io_pObject->Address())
{
MonitorLocker ml(this);
//Remove the earliar copy- silently handles if not found
Remove(io_pObject->Address());
// TODO optimize these further- make static - Gagan
DBT* key = PR_NEW(DBT);
DBT* data = PR_NEW(DBT);
@ -415,6 +419,11 @@ PRBool nsDiskModule::Remove(nsCacheObject* pObject)
{
--m_Entries;
m_SizeInUse -= pObject->Size();
if (-1 == (*m_pDB->sync)(m_pDB, 0))
{
//Failed to sync database
PR_ASSERT(0);
}
}
//Remove it from the recently used list