[not part of build] Implemented more of cache visitor support.

git-svn-id: svn://10.0.0.236/trunk@89141 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
beard%netscape.com 2001-03-09 19:01:15 +00:00
parent d90142959d
commit 06a9d85e0d
2 changed files with 28 additions and 10 deletions

View File

@ -248,15 +248,21 @@ private:
NS_IMPL_ISUPPORTS1(nsDiskCacheDeviceInfo, nsICacheDeviceInfo);
/* readonly attribute string description; */
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetDescription(char * *aDescription)
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetDescription(char ** aDescription)
{
return NS_ERROR_NOT_IMPLEMENTED;
char* result = nsCRT::strdup("disk cache device");
if (!result) return NS_ERROR_OUT_OF_MEMORY;
*aDescription = result;
return NS_OK;
}
/* readonly attribute string usageReport; */
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetUsageReport(char * *aUsageReport)
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetUsageReport(char ** aUsageReport)
{
return NS_ERROR_NOT_IMPLEMENTED;
char* result = nsCRT::strdup("disk cache usage report");
if (!result) return NS_ERROR_OUT_OF_MEMORY;
*aUsageReport = result;
return NS_OK;
}
/* readonly attribute unsigned long entryCount; */
@ -268,13 +274,15 @@ NS_IMETHODIMP nsDiskCacheDeviceInfo::GetEntryCount(PRUint32 *aEntryCount)
/* readonly attribute unsigned long totalSize; */
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetTotalSize(PRUint32 *aTotalSize)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aTotalSize = mDevice->getCacheSize();
return NS_OK;
}
/* readonly attribute unsigned long maximumSize; */
NS_IMETHODIMP nsDiskCacheDeviceInfo::GetMaximumSize(PRUint32 *aMaximumSize)
{
return NS_ERROR_NOT_IMPLEMENTED;
*aMaximumSize = mDevice->getCacheCapacity();
return NS_OK;
}
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
@ -496,7 +504,7 @@ NS_IMETHODIMP nsCacheEntryInfo::GetDataSize(PRUint32 *aDataSize)
// XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
nsDiskCacheDevice::nsDiskCacheDevice()
: mScannedEntries(PR_FALSE), mCacheCapacity(0), mCacheSize(0)
: mCacheCapacity(0), mCacheSize(0)
{
}
@ -697,6 +705,16 @@ void nsDiskCacheDevice::setCacheCapacity(PRUint32 capacity)
mCacheCapacity = capacity;
}
PRUint32 nsDiskCacheDevice::getCacheCapacity()
{
return mCacheCapacity;
}
PRUint32 nsDiskCacheDevice::getCacheSize()
{
return mCacheSize;
}
nsresult nsDiskCacheDevice::getFileForKey(const char* key, PRBool meta, nsIFile ** result)
{
if (mCacheDirectory) {

View File

@ -28,8 +28,7 @@
#include "nsILocalFile.h"
#include "nsCacheEntry.h"
class nsDiskCacheDevice : public nsCacheDevice
{
class nsDiskCacheDevice : public nsCacheDevice {
public:
nsDiskCacheDevice();
virtual ~nsDiskCacheDevice();
@ -58,6 +57,8 @@ public:
/* private: */
void setCacheDirectory(nsILocalFile* directory);
void setCacheCapacity(PRUint32 capacity);
PRUint32 getCacheCapacity();
PRUint32 getCacheSize();
private:
nsresult getFileForKey(const char* key, PRBool meta, nsIFile**);
@ -71,7 +72,6 @@ private:
private:
nsCOMPtr<nsILocalFile> mCacheDirectory;
nsCacheEntryHashTable mBoundEntries;
PRBool mScannedEntries;
PRUint32 mCacheCapacity;
PRUint32 mCacheSize;
};