зеркало из https://github.com/mozilla/gecko-dev.git
Cache changes, bug fixes, etc.
This commit is contained in:
Родитель
49cdc38520
Коммит
fb7aa22c15
|
@ -350,8 +350,7 @@ CacheObject_Synch(void* pThis)
|
||||||
if (pThis)
|
if (pThis)
|
||||||
{
|
{
|
||||||
nsCacheObject* pObj = (nsCacheObject*) pThis;
|
nsCacheObject* pObj = (nsCacheObject*) pThis;
|
||||||
PRBool bStatus = CACHEMGR->GetModule(pObj->Module())->AddObject(pObj);
|
return CACHEMGR->GetModule(pObj->Module())->AddObject(pObj);
|
||||||
return bStatus;
|
|
||||||
}
|
}
|
||||||
return PR_FALSE;
|
return PR_FALSE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,7 +33,7 @@ LLIBS = \
|
||||||
$(DIST)\lib\libplc21.lib \
|
$(DIST)\lib\libplc21.lib \
|
||||||
$(DIST)\lib\dbm32.lib \
|
$(DIST)\lib\dbm32.lib \
|
||||||
$(DIST)\lib\xpcom32.lib \
|
$(DIST)\lib\xpcom32.lib \
|
||||||
$(DIST)\lib\libpref.lib \
|
$(DIST)\lib\libpref.lib \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
MISCDEP = $(LLIBS)
|
MISCDEP = $(LLIBS)
|
||||||
|
@ -49,7 +49,7 @@ OBJS = \
|
||||||
.\$(OBJDIR)\nsCacheManager.obj \
|
.\$(OBJDIR)\nsCacheManager.obj \
|
||||||
.\$(OBJDIR)\nsCachePref.obj \
|
.\$(OBJDIR)\nsCachePref.obj \
|
||||||
.\$(OBJDIR)\nsMemCacheObject.obj \
|
.\$(OBJDIR)\nsMemCacheObject.obj \
|
||||||
.\$(OBJDIR)\nsBkgThread.obj \
|
.\$(OBJDIR)\nsBkgThread.obj \
|
||||||
.\$(OBJDIR)\nsCacheBkgThd.obj \
|
.\$(OBJDIR)\nsCacheBkgThd.obj \
|
||||||
.\$(OBJDIR)\CacheStubs.obj \
|
.\$(OBJDIR)\CacheStubs.obj \
|
||||||
.\$(OBJDIR)\nsFileStream.obj \
|
.\$(OBJDIR)\nsFileStream.obj \
|
||||||
|
@ -57,7 +57,7 @@ OBJS = \
|
||||||
.\$(OBJDIR)\nsMonitorable.obj \
|
.\$(OBJDIR)\nsMonitorable.obj \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
LINCS = \
|
LINCS = \
|
||||||
-I$(PUBLIC)\xpcom \
|
-I$(PUBLIC)\xpcom \
|
||||||
-I$(PUBLIC)\dbm \
|
-I$(PUBLIC)\dbm \
|
||||||
-I$(PUBLIC)\pref \
|
-I$(PUBLIC)\pref \
|
||||||
|
|
|
@ -40,10 +40,12 @@ static const PRUint32 BKG_THREAD_SLEEP = 15*60; /*in seconds, 15 minutes */
|
||||||
static const PRUint16 BUGS_FOUND_SO_FAR = 0;
|
static const PRUint16 BUGS_FOUND_SO_FAR = 0;
|
||||||
|
|
||||||
//Preferences
|
//Preferences
|
||||||
static const char const* MEM_CACHE_PREF = "browser.cache.memory_cache_size";
|
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 DISK_CACHE_PREF = "browser.cache.disk_cache_size";
|
||||||
static const char const* CACHE_DIR_PREF = "browser.cache.directory";
|
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 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 */
|
/* Find a bug in NU_CACHE, get these many chocolates */
|
||||||
static const PRUint16 CHOCOLATES_PER_BUG_FOUND = 2^BUGS_FOUND_SO_FAR;
|
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.
|
// Create the dir.
|
||||||
status = PR_MkDir(cacheDir, 0600);
|
status = PR_MkDir(cacheDir, 0600);
|
||||||
if (PR_SUCCESS != status) {
|
if (PR_SUCCESS != status) {
|
||||||
m_DiskCacheFolder = 0;
|
m_DiskCacheFolder = new char[1];
|
||||||
|
*m_DiskCacheFolder = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,6 +138,10 @@ PRBool nsDiskModule::AddObject(nsCacheObject* io_pObject)
|
||||||
if (io_pObject->Address())
|
if (io_pObject->Address())
|
||||||
{
|
{
|
||||||
MonitorLocker ml(this);
|
MonitorLocker ml(this);
|
||||||
|
|
||||||
|
//Remove the earliar copy- silently handles if not found
|
||||||
|
Remove(io_pObject->Address());
|
||||||
|
|
||||||
// TODO optimize these further- make static - Gagan
|
// TODO optimize these further- make static - Gagan
|
||||||
DBT* key = PR_NEW(DBT);
|
DBT* key = PR_NEW(DBT);
|
||||||
DBT* data = PR_NEW(DBT);
|
DBT* data = PR_NEW(DBT);
|
||||||
|
@ -415,6 +419,11 @@ PRBool nsDiskModule::Remove(nsCacheObject* pObject)
|
||||||
{
|
{
|
||||||
--m_Entries;
|
--m_Entries;
|
||||||
m_SizeInUse -= pObject->Size();
|
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
|
//Remove it from the recently used list
|
||||||
|
|
Загрузка…
Ссылка в новой задаче