mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-09 11:25:00 +00:00
Cache changes, bug fixes, etc.
This commit is contained in:
parent
49cdc38520
commit
fb7aa22c15
3
network/cache/nu/src/CacheStubs.cpp
vendored
3
network/cache/nu/src/CacheStubs.cpp
vendored
@ -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;
|
||||
}
|
||||
|
6
network/cache/nu/src/makefile.win
vendored
6
network/cache/nu/src/makefile.win
vendored
@ -33,7 +33,7 @@ LLIBS = \
|
||||
$(DIST)\lib\libplc21.lib \
|
||||
$(DIST)\lib\dbm32.lib \
|
||||
$(DIST)\lib\xpcom32.lib \
|
||||
$(DIST)\lib\libpref.lib \
|
||||
$(DIST)\lib\libpref.lib \
|
||||
$(NULL)
|
||||
|
||||
MISCDEP = $(LLIBS)
|
||||
@ -49,7 +49,7 @@ OBJS = \
|
||||
.\$(OBJDIR)\nsCacheManager.obj \
|
||||
.\$(OBJDIR)\nsCachePref.obj \
|
||||
.\$(OBJDIR)\nsMemCacheObject.obj \
|
||||
.\$(OBJDIR)\nsBkgThread.obj \
|
||||
.\$(OBJDIR)\nsBkgThread.obj \
|
||||
.\$(OBJDIR)\nsCacheBkgThd.obj \
|
||||
.\$(OBJDIR)\CacheStubs.obj \
|
||||
.\$(OBJDIR)\nsFileStream.obj \
|
||||
@ -57,7 +57,7 @@ OBJS = \
|
||||
.\$(OBJDIR)\nsMonitorable.obj \
|
||||
$(NULL)
|
||||
|
||||
LINCS = \
|
||||
LINCS = \
|
||||
-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\dbm \
|
||||
-I$(PUBLIC)\pref \
|
||||
|
13
network/cache/nu/src/nsCachePref.cpp
vendored
13
network/cache/nu/src/nsCachePref.cpp
vendored
@ -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
vendored
9
network/cache/nu/src/nsDiskModule.cpp
vendored
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user