mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Prefs changes. All cache preferences are now read directly by NuCache.
This commit is contained in:
parent
affbb78927
commit
57bcdca26e
52
network/cache/nu/public/nsCacheManager.h
vendored
52
network/cache/nu/public/nsCacheManager.h
vendored
@ -70,12 +70,19 @@ public:
|
||||
/* Singleton */
|
||||
static nsCacheManager* GetInstance();
|
||||
|
||||
nsCacheObject* GetObj(const char* i_url) const;
|
||||
nsDiskModule* GetDiskModule() const;
|
||||
|
||||
nsMemModule* GetMemModule() const;
|
||||
|
||||
nsCacheModule* GetModule(PRInt16 i_index) const;
|
||||
|
||||
nsMemModule* GetMemModule() const;
|
||||
nsDiskModule* GetDiskModule() const;
|
||||
nsCacheObject* GetObj(const char* i_url) const;
|
||||
|
||||
nsCachePref* GetPrefs(void) const;
|
||||
|
||||
// Initialize the cache manager. Constructor doesn't call this.
|
||||
// So you must specify this separately.
|
||||
void Init();
|
||||
|
||||
void InfoAsHTML(char* o_Buffer) const;
|
||||
|
||||
@ -93,8 +100,6 @@ public:
|
||||
protected:
|
||||
|
||||
PRBool ContainsExactly(const char* i_url) const;
|
||||
|
||||
void Init();
|
||||
|
||||
nsCacheModule* LastModule() const;
|
||||
//PRBool Lock(void);
|
||||
@ -112,13 +117,14 @@ protected:
|
||||
*/
|
||||
|
||||
private:
|
||||
nsCacheBkgThd* m_pBkgThd;
|
||||
nsCacheModule* m_pFirstModule;
|
||||
PRMonitor* m_pMonitor;
|
||||
PRBool m_bOffline;
|
||||
nsCachePref* m_pPrefs;
|
||||
|
||||
nsCacheManager(const nsCacheManager& cm);
|
||||
nsCacheManager& operator=(const nsCacheManager& cm);
|
||||
nsCacheBkgThd* m_pBkgThd;
|
||||
PRBool m_bOffline;
|
||||
};
|
||||
|
||||
inline
|
||||
@ -135,41 +141,23 @@ nsMemModule* nsCacheManager::GetMemModule() const
|
||||
return (nsMemModule*) m_pFirstModule;
|
||||
}
|
||||
|
||||
inline
|
||||
nsCachePref* nsCacheManager::GetPrefs(void) const
|
||||
{
|
||||
PR_ASSERT(m_pPrefs);
|
||||
return m_pPrefs;
|
||||
}
|
||||
|
||||
inline
|
||||
PRBool nsCacheManager::IsOffline(void) const
|
||||
{
|
||||
return m_bOffline;
|
||||
}
|
||||
|
||||
/*
|
||||
inline
|
||||
PRBool nsCacheManager::Lock(void)
|
||||
{
|
||||
if (!m_pMonitor)
|
||||
{
|
||||
m_pMonitor = PR_NewMonitor();
|
||||
if (!m_pMonitor)
|
||||
return PR_FALSE;
|
||||
}
|
||||
PR_EnterMonitor(m_pMonitor);
|
||||
return PR_TRUE;
|
||||
}
|
||||
*/
|
||||
|
||||
inline
|
||||
void nsCacheManager::Offline(PRBool i_bSet)
|
||||
{
|
||||
m_bOffline = i_bSet;
|
||||
}
|
||||
|
||||
/*
|
||||
inline
|
||||
void nsCacheManager::Unlock(void)
|
||||
{
|
||||
PR_ASSERT(m_pMonitor);
|
||||
if (m_pMonitor)
|
||||
PR_ExitMonitor(m_pMonitor);
|
||||
}
|
||||
*/
|
||||
|
||||
#endif
|
||||
|
11
network/cache/nu/public/nsCachePref.h
vendored
11
network/cache/nu/public/nsCachePref.h
vendored
@ -41,10 +41,10 @@ public:
|
||||
|
||||
enum Refresh
|
||||
{
|
||||
NEVER,
|
||||
ONCE,
|
||||
ALWAYS
|
||||
} r;
|
||||
ALWAYS,
|
||||
NEVER
|
||||
};
|
||||
|
||||
const PRUint32 BkgSleepTime(void);
|
||||
|
||||
@ -66,7 +66,10 @@ public:
|
||||
/* Revalidating in background, makes IMS calls in the bkg thread to
|
||||
update cache entries. TODO, this should be at a bigger time period
|
||||
than the cache cleanup routine */
|
||||
PRBool RevalidateInBkg(void);
|
||||
PRBool RevalidateInBkg(void);
|
||||
|
||||
/* Setup all prefs */
|
||||
void SetupPrefs(const char* i_Pref);
|
||||
|
||||
/*
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID,
|
||||
|
21
network/cache/nu/public/nsDiskModule.h
vendored
21
network/cache/nu/public/nsDiskModule.h
vendored
@ -39,7 +39,9 @@ public:
|
||||
|
||||
// Cache module interface
|
||||
PRBool AddObject(nsCacheObject* io_pObject);
|
||||
|
||||
|
||||
PRUint32 AverageSize(void) const;
|
||||
|
||||
PRBool Contains(nsCacheObject* io_pObject) const;
|
||||
PRBool Contains(const char* i_url) const;
|
||||
|
||||
@ -50,9 +52,8 @@ public:
|
||||
|
||||
nsStream* GetStreamFor(const nsCacheObject* i_pObject);
|
||||
|
||||
PRBool ReduceSizeTo(const PRUint32 i_NewSize);
|
||||
|
||||
PRBool Remove(const char* i_url);
|
||||
PRBool Remove(nsCacheObject* pObject);
|
||||
PRBool Remove(const PRUint32 i_index);
|
||||
|
||||
// To do cleanup set size to zero. Else initialize disk cache
|
||||
@ -60,6 +61,10 @@ public:
|
||||
|
||||
PRBool Revalidate(void);
|
||||
|
||||
protected:
|
||||
|
||||
PRBool ReduceSizeTo(const PRUint32 i_NewSize);
|
||||
|
||||
private:
|
||||
enum sync_frequency
|
||||
{
|
||||
@ -76,4 +81,14 @@ private:
|
||||
DB* m_pDB;
|
||||
};
|
||||
|
||||
inline
|
||||
PRUint32 nsDiskModule::AverageSize(void) const
|
||||
{
|
||||
MonitorLocker ml((nsDiskModule*)this);
|
||||
if (Entries()>0)
|
||||
{
|
||||
return (PRUint32)(m_SizeInUse/m_Entries);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user