2013-09-20 02:11:26 -07:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef CacheFileIOManager__h__
|
|
|
|
#define CacheFileIOManager__h__
|
|
|
|
|
|
|
|
#include "CacheIOThread.h"
|
|
|
|
#include "nsIEventTarget.h"
|
2014-01-06 12:27:18 -08:00
|
|
|
#include "nsITimer.h"
|
2013-09-20 02:11:26 -07:00
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "mozilla/SHA1.h"
|
2014-02-19 04:04:06 -08:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-09-20 02:11:26 -07:00
|
|
|
#include "nsTArray.h"
|
|
|
|
#include "nsString.h"
|
2014-01-22 09:54:52 -08:00
|
|
|
#include "nsTHashtable.h"
|
2013-09-20 02:11:26 -07:00
|
|
|
#include "prio.h"
|
|
|
|
|
2014-02-18 07:05:07 -08:00
|
|
|
//#define DEBUG_HANDLES 1
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
class nsIFile;
|
2014-02-19 04:04:06 -08:00
|
|
|
class nsITimer;
|
|
|
|
class nsIDirectoryEnumerator;
|
2014-04-10 03:47:20 -07:00
|
|
|
class nsILoadContextInfo;
|
2013-09-20 02:11:26 -07:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
2014-03-07 03:22:59 -08:00
|
|
|
class CacheFile;
|
2014-02-18 07:05:07 -08:00
|
|
|
#ifdef DEBUG_HANDLES
|
|
|
|
class CacheFileHandlesEntry;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
const char kEntriesDir[] = "entries";
|
|
|
|
const char kDoomedDir[] = "doomed";
|
2014-02-19 04:04:06 -08:00
|
|
|
const char kTrashDir[] = "trash";
|
2014-02-18 07:05:07 -08:00
|
|
|
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
class CacheFileHandle : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2014-01-22 09:54:52 -08:00
|
|
|
bool DispatchRelease();
|
2013-09-20 02:11:26 -07:00
|
|
|
|
|
|
|
CacheFileHandle(const SHA1Sum::Hash *aHash, bool aPriority);
|
2014-02-18 07:05:07 -08:00
|
|
|
CacheFileHandle(const nsACString &aKey, bool aPriority);
|
2014-01-22 09:54:52 -08:00
|
|
|
CacheFileHandle(const CacheFileHandle &aOther);
|
2014-02-18 07:05:07 -08:00
|
|
|
void Log();
|
2014-02-26 15:11:40 -08:00
|
|
|
bool IsDoomed() const { return mIsDoomed; }
|
|
|
|
const SHA1Sum::Hash *Hash() const { return mHash; }
|
|
|
|
int64_t FileSize() const { return mFileSize; }
|
|
|
|
uint32_t FileSizeInK() const;
|
|
|
|
bool IsPriority() const { return mPriority; }
|
|
|
|
bool FileExists() const { return mFileExists; }
|
|
|
|
bool IsClosed() const { return mClosed; }
|
|
|
|
bool IsSpecialFile() const { return !mHash; }
|
2013-09-20 02:11:26 -07:00
|
|
|
nsCString & Key() { return mKey; }
|
|
|
|
|
2014-02-26 15:11:40 -08:00
|
|
|
// Memory reporting
|
|
|
|
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
private:
|
|
|
|
friend class CacheFileIOManager;
|
|
|
|
friend class CacheFileHandles;
|
|
|
|
friend class ReleaseNSPRHandleEvent;
|
|
|
|
|
|
|
|
virtual ~CacheFileHandle();
|
|
|
|
|
|
|
|
const SHA1Sum::Hash *mHash;
|
|
|
|
bool mIsDoomed;
|
|
|
|
bool mPriority;
|
|
|
|
bool mClosed;
|
|
|
|
bool mInvalid;
|
|
|
|
bool mFileExists; // This means that the file should exists,
|
|
|
|
// but it can be still deleted by OS/user
|
|
|
|
// and then a subsequent OpenNSPRFileDesc()
|
|
|
|
// will fail.
|
|
|
|
nsCOMPtr<nsIFile> mFile;
|
|
|
|
int64_t mFileSize;
|
|
|
|
PRFileDesc *mFD; // if null then the file doesn't exists on the disk
|
|
|
|
nsCString mKey;
|
|
|
|
};
|
|
|
|
|
|
|
|
class CacheFileHandles {
|
|
|
|
public:
|
|
|
|
CacheFileHandles();
|
|
|
|
~CacheFileHandles();
|
|
|
|
|
2014-01-08 15:27:32 -08:00
|
|
|
nsresult GetHandle(const SHA1Sum::Hash *aHash, bool aReturnDoomed, CacheFileHandle **_retval);
|
2013-09-20 02:11:26 -07:00
|
|
|
nsresult NewHandle(const SHA1Sum::Hash *aHash, bool aPriority, CacheFileHandle **_retval);
|
|
|
|
void RemoveHandle(CacheFileHandle *aHandlle);
|
|
|
|
void GetAllHandles(nsTArray<nsRefPtr<CacheFileHandle> > *_retval);
|
2014-03-07 03:22:59 -08:00
|
|
|
void GetActiveHandles(nsTArray<nsRefPtr<CacheFileHandle> > *_retval);
|
2014-01-22 09:54:52 -08:00
|
|
|
void ClearAll();
|
2013-09-20 02:11:26 -07:00
|
|
|
uint32_t HandleCount();
|
|
|
|
|
2014-02-18 07:05:07 -08:00
|
|
|
#ifdef DEBUG_HANDLES
|
|
|
|
void Log(CacheFileHandlesEntry *entry);
|
|
|
|
#endif
|
|
|
|
|
2014-02-26 15:11:40 -08:00
|
|
|
// Memory reporting
|
|
|
|
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
|
2014-01-22 09:54:52 -08:00
|
|
|
class HandleHashKey : public PLDHashEntryHdr
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
typedef const SHA1Sum::Hash& KeyType;
|
|
|
|
typedef const SHA1Sum::Hash* KeyTypePointer;
|
|
|
|
|
|
|
|
HandleHashKey(KeyTypePointer aKey)
|
|
|
|
{
|
|
|
|
MOZ_COUNT_CTOR(HandleHashKey);
|
|
|
|
mHash = (SHA1Sum::Hash*)new uint8_t[SHA1Sum::HashSize];
|
|
|
|
memcpy(mHash, aKey, sizeof(SHA1Sum::Hash));
|
|
|
|
}
|
|
|
|
HandleHashKey(const HandleHashKey& aOther)
|
|
|
|
{
|
|
|
|
NS_NOTREACHED("HandleHashKey copy constructor is forbidden!");
|
|
|
|
}
|
|
|
|
~HandleHashKey()
|
|
|
|
{
|
|
|
|
MOZ_COUNT_DTOR(HandleHashKey);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool KeyEquals(KeyTypePointer aKey) const
|
|
|
|
{
|
|
|
|
return memcmp(mHash, aKey, sizeof(SHA1Sum::Hash)) == 0;
|
|
|
|
}
|
|
|
|
static KeyTypePointer KeyToPointer(KeyType aKey)
|
|
|
|
{
|
|
|
|
return &aKey;
|
|
|
|
}
|
|
|
|
static PLDHashNumber HashKey(KeyTypePointer aKey)
|
|
|
|
{
|
|
|
|
return (reinterpret_cast<const uint32_t *>(aKey))[0];
|
|
|
|
}
|
|
|
|
|
|
|
|
void AddHandle(CacheFileHandle* aHandle);
|
|
|
|
void RemoveHandle(CacheFileHandle* aHandle);
|
|
|
|
already_AddRefed<CacheFileHandle> GetNewestHandle();
|
|
|
|
void GetHandles(nsTArray<nsRefPtr<CacheFileHandle> > &aResult);
|
|
|
|
|
2014-02-26 15:11:40 -08:00
|
|
|
SHA1Sum::Hash *Hash() const { return mHash; }
|
|
|
|
bool IsEmpty() const { return mHandles.Length() == 0; }
|
2014-01-22 09:54:52 -08:00
|
|
|
|
|
|
|
enum { ALLOW_MEMMOVE = true };
|
|
|
|
|
|
|
|
#ifdef DEBUG
|
|
|
|
void AssertHandlesState();
|
|
|
|
#endif
|
|
|
|
|
2014-02-26 15:11:40 -08:00
|
|
|
// Memory reporting
|
|
|
|
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
|
2014-01-22 09:54:52 -08:00
|
|
|
private:
|
|
|
|
nsAutoArrayPtr<SHA1Sum::Hash> mHash;
|
|
|
|
// Use weak pointers since the hash table access is on a single thread
|
|
|
|
// only and CacheFileHandle removes itself from this table in its dtor
|
|
|
|
// that may only be called on the same thread as we work with the hashtable
|
|
|
|
// since we dispatch its Release() to this thread.
|
|
|
|
nsTArray<CacheFileHandle*> mHandles;
|
|
|
|
};
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
private:
|
2014-01-22 09:54:52 -08:00
|
|
|
nsTHashtable<HandleHashKey> mTable;
|
2013-09-20 02:11:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
|
|
|
class OpenFileEvent;
|
|
|
|
class CloseFileEvent;
|
|
|
|
class ReadEvent;
|
|
|
|
class WriteEvent;
|
2014-01-06 12:27:18 -08:00
|
|
|
class MetadataWriteScheduleEvent;
|
2014-04-10 03:47:20 -07:00
|
|
|
class CacheFileContextEvictor;
|
2013-09-20 02:11:26 -07:00
|
|
|
|
|
|
|
#define CACHEFILEIOLISTENER_IID \
|
|
|
|
{ /* dcaf2ddc-17cf-4242-bca1-8c86936375a5 */ \
|
|
|
|
0xdcaf2ddc, \
|
|
|
|
0x17cf, \
|
|
|
|
0x4242, \
|
|
|
|
{0xbc, 0xa1, 0x8c, 0x86, 0x93, 0x63, 0x75, 0xa5} \
|
|
|
|
}
|
|
|
|
|
|
|
|
class CacheFileIOListener : public nsISupports
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECLARE_STATIC_IID_ACCESSOR(CACHEFILEIOLISTENER_IID)
|
|
|
|
|
|
|
|
NS_IMETHOD OnFileOpened(CacheFileHandle *aHandle, nsresult aResult) = 0;
|
|
|
|
NS_IMETHOD OnDataWritten(CacheFileHandle *aHandle, const char *aBuf,
|
|
|
|
nsresult aResult) = 0;
|
|
|
|
NS_IMETHOD OnDataRead(CacheFileHandle *aHandle, char *aBuf,
|
|
|
|
nsresult aResult) = 0;
|
|
|
|
NS_IMETHOD OnFileDoomed(CacheFileHandle *aHandle, nsresult aResult) = 0;
|
|
|
|
NS_IMETHOD OnEOFSet(CacheFileHandle *aHandle, nsresult aResult) = 0;
|
2014-02-18 07:05:07 -08:00
|
|
|
NS_IMETHOD OnFileRenamed(CacheFileHandle *aHandle, nsresult aResult) = 0;
|
2013-09-20 02:11:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
NS_DEFINE_STATIC_IID_ACCESSOR(CacheFileIOListener, CACHEFILEIOLISTENER_IID)
|
|
|
|
|
|
|
|
|
2014-01-06 12:27:18 -08:00
|
|
|
class CacheFileIOManager : public nsITimerCallback
|
2013-09-20 02:11:26 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
2014-01-06 12:27:18 -08:00
|
|
|
NS_DECL_NSITIMERCALLBACK
|
2013-09-20 02:11:26 -07:00
|
|
|
|
|
|
|
enum {
|
2014-02-18 07:05:07 -08:00
|
|
|
OPEN = 0U,
|
|
|
|
CREATE = 1U,
|
|
|
|
CREATE_NEW = 2U,
|
|
|
|
PRIORITY = 4U,
|
2014-02-18 09:26:48 -08:00
|
|
|
SPECIAL_FILE = 8U
|
2013-09-20 02:11:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
CacheFileIOManager();
|
|
|
|
|
|
|
|
static nsresult Init();
|
|
|
|
static nsresult Shutdown();
|
|
|
|
static nsresult OnProfile();
|
|
|
|
static already_AddRefed<nsIEventTarget> IOTarget();
|
|
|
|
static already_AddRefed<CacheIOThread> IOThread();
|
2014-02-18 07:05:07 -08:00
|
|
|
static bool IsOnIOThread();
|
2014-01-22 09:54:52 -08:00
|
|
|
static bool IsOnIOThreadOrCeased();
|
|
|
|
static bool IsShutdown();
|
2013-09-20 02:11:26 -07:00
|
|
|
|
2014-01-06 12:27:18 -08:00
|
|
|
// Make aFile's WriteMetadataIfNeeded be called automatically after
|
|
|
|
// a short interval.
|
|
|
|
static nsresult ScheduleMetadataWrite(CacheFile * aFile);
|
|
|
|
// Remove aFile from the scheduling registry array.
|
|
|
|
// WriteMetadataIfNeeded will not be automatically called.
|
|
|
|
static nsresult UnscheduleMetadataWrite(CacheFile * aFile);
|
|
|
|
// Shuts the scheduling off and flushes all pending metadata writes.
|
|
|
|
static nsresult ShutdownMetadataWriteScheduling();
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
static nsresult OpenFile(const nsACString &aKey,
|
|
|
|
uint32_t aFlags,
|
|
|
|
CacheFileIOListener *aCallback);
|
|
|
|
static nsresult Read(CacheFileHandle *aHandle, int64_t aOffset,
|
|
|
|
char *aBuf, int32_t aCount,
|
|
|
|
CacheFileIOListener *aCallback);
|
|
|
|
static nsresult Write(CacheFileHandle *aHandle, int64_t aOffset,
|
|
|
|
const char *aBuf, int32_t aCount, bool aValidate,
|
|
|
|
CacheFileIOListener *aCallback);
|
|
|
|
static nsresult DoomFile(CacheFileHandle *aHandle,
|
|
|
|
CacheFileIOListener *aCallback);
|
|
|
|
static nsresult DoomFileByKey(const nsACString &aKey,
|
|
|
|
CacheFileIOListener *aCallback);
|
|
|
|
static nsresult ReleaseNSPRHandle(CacheFileHandle *aHandle);
|
|
|
|
static nsresult TruncateSeekSetEOF(CacheFileHandle *aHandle,
|
|
|
|
int64_t aTruncatePos, int64_t aEOFPos,
|
|
|
|
CacheFileIOListener *aCallback);
|
2014-02-18 07:05:07 -08:00
|
|
|
static nsresult RenameFile(CacheFileHandle *aHandle,
|
|
|
|
const nsACString &aNewName,
|
|
|
|
CacheFileIOListener *aCallback);
|
2014-02-18 09:26:48 -08:00
|
|
|
static nsresult EvictIfOverLimit();
|
2014-03-07 03:22:59 -08:00
|
|
|
static nsresult EvictAll();
|
2014-04-10 03:47:20 -07:00
|
|
|
static nsresult EvictByContext(nsILoadContextInfo *aLoadContextInfo);
|
2014-02-18 09:26:48 -08:00
|
|
|
|
2014-02-18 07:05:07 -08:00
|
|
|
static nsresult InitIndexEntry(CacheFileHandle *aHandle,
|
|
|
|
uint32_t aAppId,
|
|
|
|
bool aAnonymous,
|
|
|
|
bool aInBrowser);
|
|
|
|
static nsresult UpdateIndexEntry(CacheFileHandle *aHandle,
|
|
|
|
const uint32_t *aFrecency,
|
|
|
|
const uint32_t *aExpirationTime);
|
|
|
|
|
|
|
|
static nsresult UpdateIndexEntry();
|
2013-09-20 02:11:26 -07:00
|
|
|
|
|
|
|
enum EEnumerateMode {
|
|
|
|
ENTRIES,
|
|
|
|
DOOMED
|
|
|
|
};
|
|
|
|
|
2014-02-05 11:29:54 -08:00
|
|
|
static void GetCacheDirectory(nsIFile** result);
|
|
|
|
|
2014-02-26 15:11:40 -08:00
|
|
|
// Memory reporting
|
|
|
|
static size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
|
|
|
static size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf);
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
private:
|
|
|
|
friend class CacheFileHandle;
|
|
|
|
friend class CacheFileChunk;
|
|
|
|
friend class CacheFile;
|
|
|
|
friend class ShutdownEvent;
|
|
|
|
friend class OpenFileEvent;
|
|
|
|
friend class CloseHandleEvent;
|
|
|
|
friend class ReadEvent;
|
|
|
|
friend class WriteEvent;
|
|
|
|
friend class DoomFileEvent;
|
|
|
|
friend class DoomFileByKeyEvent;
|
|
|
|
friend class ReleaseNSPRHandleEvent;
|
|
|
|
friend class TruncateSeekSetEOFEvent;
|
2014-02-18 07:05:07 -08:00
|
|
|
friend class RenameFileEvent;
|
|
|
|
friend class CacheIndex;
|
2014-01-06 12:27:18 -08:00
|
|
|
friend class MetadataWriteScheduleEvent;
|
2014-04-10 03:47:20 -07:00
|
|
|
friend class CacheFileContextEvictor;
|
2013-09-20 02:11:26 -07:00
|
|
|
|
|
|
|
virtual ~CacheFileIOManager();
|
|
|
|
|
|
|
|
nsresult InitInternal();
|
|
|
|
nsresult ShutdownInternal();
|
|
|
|
|
|
|
|
nsresult OpenFileInternal(const SHA1Sum::Hash *aHash,
|
2014-04-10 03:47:20 -07:00
|
|
|
const nsACString &aKey,
|
2013-09-20 02:11:26 -07:00
|
|
|
uint32_t aFlags,
|
|
|
|
CacheFileHandle **_retval);
|
2014-02-18 07:05:07 -08:00
|
|
|
nsresult OpenSpecialFileInternal(const nsACString &aKey,
|
|
|
|
uint32_t aFlags,
|
|
|
|
CacheFileHandle **_retval);
|
2013-09-20 02:11:26 -07:00
|
|
|
nsresult CloseHandleInternal(CacheFileHandle *aHandle);
|
|
|
|
nsresult ReadInternal(CacheFileHandle *aHandle, int64_t aOffset,
|
|
|
|
char *aBuf, int32_t aCount);
|
|
|
|
nsresult WriteInternal(CacheFileHandle *aHandle, int64_t aOffset,
|
|
|
|
const char *aBuf, int32_t aCount, bool aValidate);
|
|
|
|
nsresult DoomFileInternal(CacheFileHandle *aHandle);
|
|
|
|
nsresult DoomFileByKeyInternal(const SHA1Sum::Hash *aHash);
|
|
|
|
nsresult ReleaseNSPRHandleInternal(CacheFileHandle *aHandle);
|
|
|
|
nsresult TruncateSeekSetEOFInternal(CacheFileHandle *aHandle,
|
|
|
|
int64_t aTruncatePos, int64_t aEOFPos);
|
2014-02-18 07:05:07 -08:00
|
|
|
nsresult RenameFileInternal(CacheFileHandle *aHandle,
|
|
|
|
const nsACString &aNewName);
|
2014-02-18 09:26:48 -08:00
|
|
|
nsresult EvictIfOverLimitInternal();
|
|
|
|
nsresult OverLimitEvictionInternal();
|
2014-03-07 03:22:59 -08:00
|
|
|
nsresult EvictAllInternal();
|
2014-04-10 03:47:20 -07:00
|
|
|
nsresult EvictByContextInternal(nsILoadContextInfo *aLoadContextInfo);
|
2013-09-20 02:11:26 -07:00
|
|
|
|
2014-02-19 04:04:06 -08:00
|
|
|
nsresult TrashDirectory(nsIFile *aFile);
|
|
|
|
static void OnTrashTimer(nsITimer *aTimer, void *aClosure);
|
|
|
|
nsresult StartRemovingTrash();
|
|
|
|
nsresult RemoveTrashInternal();
|
|
|
|
nsresult FindTrashDirToRemove();
|
|
|
|
|
2013-09-20 02:11:26 -07:00
|
|
|
nsresult CreateFile(CacheFileHandle *aHandle);
|
2014-02-18 07:05:07 -08:00
|
|
|
static void HashToStr(const SHA1Sum::Hash *aHash, nsACString &_retval);
|
|
|
|
static nsresult StrToHash(const nsACString &aHash, SHA1Sum::Hash *_retval);
|
2013-09-20 02:11:26 -07:00
|
|
|
nsresult GetFile(const SHA1Sum::Hash *aHash, nsIFile **_retval);
|
2014-02-18 07:05:07 -08:00
|
|
|
nsresult GetSpecialFile(const nsACString &aKey, nsIFile **_retval);
|
2013-09-20 02:11:26 -07:00
|
|
|
nsresult GetDoomedFile(nsIFile **_retval);
|
2014-02-19 04:04:06 -08:00
|
|
|
nsresult IsEmptyDirectory(nsIFile *aFile, bool *_retval);
|
|
|
|
nsresult CheckAndCreateDir(nsIFile *aFile, const char *aDir,
|
|
|
|
bool aEnsureEmptyDir);
|
2013-09-20 02:11:26 -07:00
|
|
|
nsresult CreateCacheTree();
|
|
|
|
nsresult OpenNSPRHandle(CacheFileHandle *aHandle, bool aCreate = false);
|
|
|
|
void NSPRHandleUsed(CacheFileHandle *aHandle);
|
|
|
|
|
2014-04-09 01:06:59 -07:00
|
|
|
// Removing all cache files during shutdown
|
|
|
|
nsresult SyncRemoveDir(nsIFile *aFile, const char *aDir);
|
|
|
|
void SyncRemoveAllCacheFiles();
|
|
|
|
|
2014-01-06 12:27:18 -08:00
|
|
|
nsresult ScheduleMetadataWriteInternal(CacheFile * aFile);
|
|
|
|
nsresult UnscheduleMetadataWriteInternal(CacheFile * aFile);
|
|
|
|
nsresult ShutdownMetadataWriteSchedulingInternal();
|
2013-09-20 02:11:26 -07:00
|
|
|
|
2014-04-10 03:47:20 -07:00
|
|
|
static nsresult CacheIndexStateChanged();
|
|
|
|
nsresult CacheIndexStateChangedInternal();
|
|
|
|
|
2014-02-26 15:11:40 -08:00
|
|
|
// Memory reporting (private part)
|
|
|
|
size_t SizeOfExcludingThisInternal(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
|
2014-02-18 07:05:07 -08:00
|
|
|
static CacheFileIOManager *gInstance;
|
2014-02-19 04:04:06 -08:00
|
|
|
TimeStamp mStartTime;
|
2014-02-18 07:05:07 -08:00
|
|
|
bool mShuttingDown;
|
|
|
|
nsRefPtr<CacheIOThread> mIOThread;
|
|
|
|
nsCOMPtr<nsIFile> mCacheDirectory;
|
|
|
|
bool mTreeCreated;
|
|
|
|
CacheFileHandles mHandles;
|
|
|
|
nsTArray<CacheFileHandle *> mHandlesByLastUsed;
|
2014-03-28 04:35:06 -07:00
|
|
|
nsTArray<CacheFileHandle *> mSpecialHandles;
|
2014-02-18 07:05:07 -08:00
|
|
|
nsTArray<nsRefPtr<CacheFile> > mScheduledMetadataWrites;
|
|
|
|
nsCOMPtr<nsITimer> mMetadataWritesTimer;
|
2014-02-18 09:26:48 -08:00
|
|
|
bool mOverLimitEvicting;
|
2014-02-19 04:04:06 -08:00
|
|
|
bool mRemovingTrashDirs;
|
|
|
|
nsCOMPtr<nsITimer> mTrashTimer;
|
|
|
|
nsCOMPtr<nsIFile> mTrashDir;
|
|
|
|
nsCOMPtr<nsIDirectoryEnumerator> mTrashDirEnumerator;
|
|
|
|
nsTArray<nsCString> mFailedTrashDirs;
|
2014-04-10 03:47:20 -07:00
|
|
|
nsRefPtr<CacheFileContextEvictor> mContextEvictor;
|
2013-09-20 02:11:26 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
} // net
|
|
|
|
} // mozilla
|
|
|
|
|
|
|
|
#endif
|