2013-09-20 13:11:25 +04: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 CacheEntry__h__
|
|
|
|
#define CacheEntry__h__
|
|
|
|
|
|
|
|
#include "nsICacheEntry.h"
|
|
|
|
#include "CacheFile.h"
|
|
|
|
|
|
|
|
#include "nsIRunnable.h"
|
|
|
|
#include "nsIOutputStream.h"
|
|
|
|
#include "nsICacheEntryOpenCallback.h"
|
|
|
|
#include "nsICacheEntryDoomCallback.h"
|
|
|
|
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsRefPtrHashtable.h"
|
|
|
|
#include "nsDataHashtable.h"
|
|
|
|
#include "nsHashKeys.h"
|
|
|
|
#include "nsString.h"
|
|
|
|
#include "nsCOMArray.h"
|
|
|
|
#include "nsThreadUtils.h"
|
2014-07-15 19:37:45 +04:00
|
|
|
#include "mozilla/Attributes.h"
|
2013-09-20 13:11:25 +04:00
|
|
|
#include "mozilla/Mutex.h"
|
2013-09-26 23:37:03 +04:00
|
|
|
#include "mozilla/TimeStamp.h"
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
static inline uint32_t
|
|
|
|
PRTimeToSeconds(PRTime t_usec)
|
|
|
|
{
|
|
|
|
PRTime usec_per_sec = PR_USEC_PER_SEC;
|
|
|
|
return uint32_t(t_usec /= usec_per_sec);
|
|
|
|
}
|
|
|
|
|
|
|
|
#define NowInSeconds() PRTimeToSeconds(PR_Now())
|
|
|
|
|
|
|
|
class nsIOutputStream;
|
|
|
|
class nsIURI;
|
2013-11-21 02:20:17 +04:00
|
|
|
class nsIThread;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace net {
|
|
|
|
|
|
|
|
class CacheStorageService;
|
|
|
|
class CacheStorage;
|
2013-11-21 02:20:17 +04:00
|
|
|
class CacheOutputCloseListener;
|
2014-01-07 00:24:41 +04:00
|
|
|
class CacheEntryHandle;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class CacheEntry final : public nsICacheEntry
|
2015-03-27 21:52:19 +03:00
|
|
|
, public nsIRunnable
|
|
|
|
, public CacheFileListener
|
2013-09-20 13:11:25 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
NS_DECL_NSICACHEENTRY
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
|
|
|
|
CacheEntry(const nsACString& aStorageID, nsIURI* aURI, const nsACString& aEnhanceID,
|
2015-10-22 13:11:00 +03:00
|
|
|
bool aUseDisk, bool aSkipSizeCheck, bool aPin);
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
void AsyncOpen(nsICacheEntryOpenCallback* aCallback, uint32_t aFlags);
|
|
|
|
|
2014-01-07 00:24:41 +04:00
|
|
|
CacheEntryHandle* NewHandle();
|
|
|
|
|
2013-09-20 13:11:25 +04:00
|
|
|
public:
|
|
|
|
uint32_t GetMetadataMemoryConsumption();
|
|
|
|
nsCString const &GetStorageID() const { return mStorageID; }
|
|
|
|
nsCString const &GetEnhanceID() const { return mEnhanceID; }
|
|
|
|
nsIURI* GetURI() const { return mURI; }
|
2014-04-06 22:45:18 +04:00
|
|
|
// Accessible at any time
|
|
|
|
bool IsUsingDisk() const { return mUseDisk; }
|
2014-01-07 00:24:41 +04:00
|
|
|
bool IsReferenced() const;
|
2014-02-18 21:26:48 +04:00
|
|
|
bool IsFileDoomed();
|
2014-07-08 18:48:00 +04:00
|
|
|
bool IsDoomed() const { return mIsDoomed; }
|
2015-10-30 10:12:00 +03:00
|
|
|
bool IsPinned() const { return mPinned; }
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
// Methods for entry management (eviction from memory),
|
|
|
|
// called only on the management thread.
|
|
|
|
|
|
|
|
// TODO make these inline
|
|
|
|
double GetFrecency() const;
|
|
|
|
uint32_t GetExpirationTime() const;
|
2014-07-08 18:48:00 +04:00
|
|
|
uint32_t UseCount() const { return mUseCount; }
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
bool IsRegistered() const;
|
|
|
|
bool CanRegister() const;
|
|
|
|
void SetRegistered(bool aRegistered);
|
|
|
|
|
2014-07-08 18:48:00 +04:00
|
|
|
TimeStamp const& LoadStart() const { return mLoadStart; }
|
|
|
|
|
2013-09-20 13:11:25 +04:00
|
|
|
enum EPurge {
|
|
|
|
PURGE_DATA_ONLY_DISK_BACKED,
|
|
|
|
PURGE_WHOLE_ONLY_DISK_BACKED,
|
|
|
|
PURGE_WHOLE,
|
|
|
|
};
|
|
|
|
|
2015-10-22 13:11:00 +03:00
|
|
|
bool DeferOrBypassRemovalOnPinStatus(bool aPinned);
|
2013-09-20 13:11:25 +04:00
|
|
|
bool Purge(uint32_t aWhat);
|
|
|
|
void PurgeAndDoom();
|
|
|
|
void DoomAlreadyRemoved();
|
|
|
|
|
2014-07-08 18:48:00 +04:00
|
|
|
nsresult HashingKeyWithStorage(nsACString &aResult) const;
|
|
|
|
nsresult HashingKey(nsACString &aResult) const;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
static nsresult HashingKey(nsCSubstring const& aStorageID,
|
|
|
|
nsCSubstring const& aEnhanceID,
|
|
|
|
nsIURI* aURI,
|
|
|
|
nsACString &aResult);
|
|
|
|
|
2014-04-06 22:44:40 +04:00
|
|
|
static nsresult HashingKey(nsCSubstring const& aStorageID,
|
|
|
|
nsCSubstring const& aEnhanceID,
|
|
|
|
nsCSubstring const& aURISpec,
|
|
|
|
nsACString &aResult);
|
|
|
|
|
2013-09-20 13:11:25 +04:00
|
|
|
// Accessed only on the service management thread
|
|
|
|
double mFrecency;
|
2015-02-13 15:59:00 +03:00
|
|
|
::mozilla::Atomic<uint32_t, ::mozilla::Relaxed> mSortingExpirationTime;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
2014-02-27 03:11:40 +04:00
|
|
|
// Memory reporting
|
|
|
|
size_t SizeOfExcludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
|
|
|
|
2013-09-20 13:11:25 +04:00
|
|
|
private:
|
|
|
|
virtual ~CacheEntry();
|
|
|
|
|
|
|
|
// CacheFileListener
|
2015-03-21 19:28:04 +03:00
|
|
|
NS_IMETHOD OnFileReady(nsresult aResult, bool aIsNew) override;
|
|
|
|
NS_IMETHOD OnFileDoomed(nsresult aResult) override;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
// Keep the service alive during life-time of an entry
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheStorageService> mService;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
// We must monitor when a cache entry whose consumer is responsible
|
|
|
|
// for writing it the first time gets released. We must then invoke
|
|
|
|
// waiting callbacks to not break the chain.
|
2013-11-21 02:20:17 +04:00
|
|
|
class Callback
|
|
|
|
{
|
|
|
|
public:
|
2014-01-07 00:24:41 +04:00
|
|
|
Callback(CacheEntry* aEntry,
|
|
|
|
nsICacheEntryOpenCallback *aCallback,
|
2014-09-16 17:51:50 +04:00
|
|
|
bool aReadOnly, bool aCheckOnAnyThread, bool aSecret);
|
2015-10-22 13:11:00 +03:00
|
|
|
// Special constructor for Callback objects added to the chain
|
|
|
|
// just to ensure proper defer dooming (recreation) of this entry.
|
|
|
|
Callback(CacheEntry* aEntry, bool aDoomWhenFoundInPinStatus);
|
2013-11-21 02:20:17 +04:00
|
|
|
Callback(Callback const &aThat);
|
|
|
|
~Callback();
|
|
|
|
|
2014-01-07 00:24:41 +04:00
|
|
|
// Called when this callback record changes it's owning entry,
|
|
|
|
// mainly during recreation.
|
|
|
|
void ExchangeEntry(CacheEntry* aEntry);
|
|
|
|
|
2015-10-22 13:11:00 +03:00
|
|
|
// Returns true when an entry is about to be "defer" doomed and this is
|
|
|
|
// a "defer" callback.
|
|
|
|
bool DeferDoom(bool *aDoom) const;
|
|
|
|
|
2014-01-07 00:24:41 +04:00
|
|
|
// We are raising reference count here to take into account the pending
|
|
|
|
// callback (that virtually holds a ref to this entry before it gets
|
|
|
|
// it's pointer).
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheEntry> mEntry;
|
2013-11-21 02:20:17 +04:00
|
|
|
nsCOMPtr<nsICacheEntryOpenCallback> mCallback;
|
|
|
|
nsCOMPtr<nsIThread> mTargetThread;
|
|
|
|
bool mReadOnly : 1;
|
2015-02-20 14:50:00 +03:00
|
|
|
bool mRevalidating : 1;
|
2013-11-21 02:20:17 +04:00
|
|
|
bool mCheckOnAnyThread : 1;
|
|
|
|
bool mRecheckAfterWrite : 1;
|
|
|
|
bool mNotWanted : 1;
|
2014-09-16 17:51:50 +04:00
|
|
|
bool mSecret : 1;
|
2013-11-21 02:20:17 +04:00
|
|
|
|
2015-10-22 13:11:00 +03:00
|
|
|
// These are set only for the defer-doomer Callback instance inserted
|
|
|
|
// to the callback chain. When any of these is set and also any of
|
|
|
|
// the corressponding flags on the entry is set, this callback will
|
|
|
|
// indicate (via DeferDoom()) the entry have to be recreated/doomed.
|
|
|
|
bool mDoomWhenFoundPinned : 1;
|
|
|
|
bool mDoomWhenFoundNonPinned : 1;
|
|
|
|
|
2014-06-05 21:32:04 +04:00
|
|
|
nsresult OnCheckThread(bool *aOnCheckThread) const;
|
|
|
|
nsresult OnAvailThread(bool *aOnAvailThread) const;
|
2013-11-21 02:20:17 +04:00
|
|
|
};
|
|
|
|
|
2013-09-20 13:11:25 +04:00
|
|
|
// Since OnCacheEntryAvailable must be invoked on the main thread
|
|
|
|
// we need a runnable for it...
|
|
|
|
class AvailableCallbackRunnable : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
AvailableCallbackRunnable(CacheEntry* aEntry,
|
2013-11-21 02:20:17 +04:00
|
|
|
Callback const &aCallback)
|
|
|
|
: mEntry(aEntry)
|
|
|
|
, mCallback(aCallback)
|
|
|
|
{}
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
private:
|
|
|
|
NS_IMETHOD Run()
|
|
|
|
{
|
2013-11-21 02:20:17 +04:00
|
|
|
mEntry->InvokeAvailableCallback(mCallback);
|
2013-09-20 13:11:25 +04:00
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheEntry> mEntry;
|
2013-11-21 02:20:17 +04:00
|
|
|
Callback mCallback;
|
2013-09-20 13:11:25 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
// Since OnCacheEntryDoomed must be invoked on the main thread
|
|
|
|
// we need a runnable for it...
|
|
|
|
class DoomCallbackRunnable : public nsRunnable
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
DoomCallbackRunnable(CacheEntry* aEntry, nsresult aRv)
|
|
|
|
: mEntry(aEntry), mRv(aRv) {}
|
|
|
|
|
|
|
|
private:
|
|
|
|
NS_IMETHOD Run()
|
|
|
|
{
|
|
|
|
nsCOMPtr<nsICacheEntryDoomCallback> callback;
|
|
|
|
{
|
|
|
|
mozilla::MutexAutoLock lock(mEntry->mLock);
|
|
|
|
mEntry->mDoomCallback.swap(callback);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (callback)
|
|
|
|
callback->OnCacheEntryDoomed(mRv);
|
|
|
|
return NS_OK;
|
|
|
|
}
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheEntry> mEntry;
|
2013-09-20 13:11:25 +04:00
|
|
|
nsresult mRv;
|
|
|
|
};
|
|
|
|
|
2014-07-02 20:16:21 +04:00
|
|
|
// Starts the load or just invokes the callback, bypasses (when required)
|
|
|
|
// if busy. Returns true on job done, false on bypass.
|
|
|
|
bool Open(Callback & aCallback, bool aTruncate, bool aPriority, bool aBypassIfBusy);
|
2013-09-20 13:11:25 +04:00
|
|
|
// Loads from disk asynchronously
|
|
|
|
bool Load(bool aTruncate, bool aPriority);
|
|
|
|
void OnLoaded();
|
|
|
|
|
2014-07-02 20:16:21 +04:00
|
|
|
void RememberCallback(Callback & aCallback);
|
2013-11-21 02:20:17 +04:00
|
|
|
void InvokeCallbacksLock();
|
2013-09-20 13:11:25 +04:00
|
|
|
void InvokeCallbacks();
|
2013-11-21 02:20:17 +04:00
|
|
|
bool InvokeCallbacks(bool aReadOnly);
|
|
|
|
bool InvokeCallback(Callback & aCallback);
|
2014-06-05 21:32:04 +04:00
|
|
|
void InvokeAvailableCallback(Callback const & aCallback);
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
nsresult OpenOutputStreamInternal(int64_t offset, nsIOutputStream * *_retval);
|
|
|
|
|
|
|
|
// When this entry is new and recreated w/o a callback, we need to wrap it
|
|
|
|
// with a handle to detect writing consumer is gone.
|
2014-01-07 00:24:41 +04:00
|
|
|
CacheEntryHandle* NewWriteHandle();
|
|
|
|
void OnHandleClosed(CacheEntryHandle const* aHandle);
|
2013-09-20 13:11:25 +04:00
|
|
|
|
2014-04-06 22:45:18 +04:00
|
|
|
private:
|
|
|
|
friend class CacheEntryHandle;
|
|
|
|
// Increment/decrements the number of handles keeping this entry.
|
|
|
|
void AddHandleRef() { ++mHandlesCount; }
|
|
|
|
void ReleaseHandleRef() { --mHandlesCount; }
|
|
|
|
// Current number of handles keeping this entry.
|
|
|
|
uint32_t HandlesCount() const { return mHandlesCount; }
|
|
|
|
|
2013-11-21 02:20:17 +04:00
|
|
|
private:
|
|
|
|
friend class CacheOutputCloseListener;
|
|
|
|
void OnOutputClosed();
|
|
|
|
|
2014-04-06 22:45:18 +04:00
|
|
|
private:
|
2013-09-20 13:11:25 +04:00
|
|
|
// Schedules a background operation on the management thread.
|
|
|
|
// When executed on the management thread directly, the operation(s)
|
|
|
|
// is (are) executed immediately.
|
|
|
|
void BackgroundOp(uint32_t aOperation, bool aForceAsync = false);
|
2015-03-25 21:55:00 +03:00
|
|
|
void StoreFrecency(double aFrecency);
|
2013-09-20 13:11:25 +04:00
|
|
|
|
2014-01-22 21:54:51 +04:00
|
|
|
// Called only from DoomAlreadyRemoved()
|
|
|
|
void DoomFile();
|
|
|
|
|
2014-02-04 04:52:59 +04:00
|
|
|
already_AddRefed<CacheEntryHandle> ReopenTruncated(bool aMemoryOnly,
|
|
|
|
nsICacheEntryOpenCallback* aCallback);
|
2013-11-21 02:20:17 +04:00
|
|
|
void TransferCallbacks(CacheEntry & aFromEntry);
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
mozilla::Mutex mLock;
|
|
|
|
|
2014-01-07 00:24:41 +04:00
|
|
|
// Reflects the number of existing handles for this entry
|
2014-04-06 22:45:18 +04:00
|
|
|
::mozilla::ThreadSafeAutoRefCnt mHandlesCount;
|
2014-01-07 00:24:41 +04:00
|
|
|
|
2013-11-21 02:20:17 +04:00
|
|
|
nsTArray<Callback> mCallbacks;
|
2013-09-20 13:11:25 +04:00
|
|
|
nsCOMPtr<nsICacheEntryDoomCallback> mDoomCallback;
|
|
|
|
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheFile> mFile;
|
2015-02-13 15:55:00 +03:00
|
|
|
|
|
|
|
// Using ReleaseAcquire since we only control access to mFile with this.
|
|
|
|
// When mFileStatus is read and found success it is ensured there is mFile and
|
|
|
|
// that it is after a successful call to Init().
|
|
|
|
::mozilla::Atomic<nsresult, ::mozilla::ReleaseAcquire> mFileStatus;
|
2013-09-20 13:11:25 +04:00
|
|
|
nsCOMPtr<nsIURI> mURI;
|
|
|
|
nsCString mEnhanceID;
|
|
|
|
nsCString mStorageID;
|
|
|
|
|
|
|
|
// Whether it's allowed to persist the data to disk
|
2015-10-22 13:11:00 +03:00
|
|
|
bool const mUseDisk : 1;
|
2015-09-04 02:05:42 +03:00
|
|
|
// Whether it should skip max size check.
|
2015-10-22 13:11:00 +03:00
|
|
|
bool const mSkipSizeCheck : 1;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
// Following flags are all synchronized with the cache entry lock.
|
|
|
|
|
|
|
|
// Whether security info has already been looked up in metadata.
|
|
|
|
bool mSecurityInfoLoaded : 1;
|
|
|
|
// Prevents any callback invocation
|
|
|
|
bool mPreventCallbacks : 1;
|
|
|
|
// true: after load and an existing file, or after output stream has been opened.
|
|
|
|
// note - when opening an input stream, and this flag is false, output stream
|
|
|
|
// is open along ; this makes input streams on new entries behave correctly
|
|
|
|
// when EOF is reached (WOULD_BLOCK is returned).
|
|
|
|
// false: after load and a new file, or dropped to back to false when a writer
|
|
|
|
// fails to open an output stream.
|
|
|
|
bool mHasData : 1;
|
2015-10-22 13:11:00 +03:00
|
|
|
// The indication of pinning this entry was open with
|
|
|
|
bool mPinned : 1;
|
|
|
|
// Whether the pinning state of the entry is known (equals to the actual state
|
|
|
|
// of the cache file)
|
|
|
|
bool mPinningKnown : 1;
|
|
|
|
|
|
|
|
// Set when entry is doomed with AsyncDoom() or DoomAlreadyRemoved().
|
|
|
|
// Left as a standalone flag to not bother with locking (there is no need).
|
|
|
|
bool mIsDoomed;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
static char const * StateString(uint32_t aState);
|
|
|
|
|
|
|
|
enum EState { // transiting to:
|
|
|
|
NOTLOADED = 0, // -> LOADING | EMPTY
|
|
|
|
LOADING = 1, // -> EMPTY | READY
|
|
|
|
EMPTY = 2, // -> WRITING
|
|
|
|
WRITING = 3, // -> EMPTY | READY
|
|
|
|
READY = 4, // -> REVALIDATING
|
|
|
|
REVALIDATING = 5 // -> READY
|
|
|
|
};
|
|
|
|
|
|
|
|
// State of this entry.
|
|
|
|
EState mState;
|
|
|
|
|
2013-10-02 13:30:42 +04:00
|
|
|
enum ERegistration {
|
|
|
|
NEVERREGISTERED = 0, // The entry has never been registered
|
|
|
|
REGISTERED = 1, // The entry is stored in the memory pool index
|
|
|
|
DEREGISTERED = 2 // The entry has been removed from the pool
|
|
|
|
};
|
|
|
|
|
|
|
|
// Accessed only on the management thread. Records the state of registration
|
|
|
|
// this entry in the memory pool intermediate cache.
|
|
|
|
ERegistration mRegistration;
|
|
|
|
|
2013-09-20 13:11:25 +04:00
|
|
|
// If a new (empty) entry is requested to open an input stream before
|
|
|
|
// output stream has been opened, we must open output stream internally
|
|
|
|
// on CacheFile and hold until writer releases the entry or opens the output
|
|
|
|
// stream for read (then we trade him mOutputStream).
|
|
|
|
nsCOMPtr<nsIOutputStream> mOutputStream;
|
|
|
|
|
|
|
|
// Weak reference to the current writter. There can be more then one
|
2014-01-07 00:24:41 +04:00
|
|
|
// writer at a time and OnHandleClosed() must be processed only for the
|
2013-09-20 13:11:25 +04:00
|
|
|
// current one.
|
2014-01-07 00:24:41 +04:00
|
|
|
CacheEntryHandle* mWriter;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
// Background thread scheduled operation. Set (under the lock) one
|
|
|
|
// of this flags to tell the background thread what to do.
|
|
|
|
class Ops {
|
|
|
|
public:
|
|
|
|
static uint32_t const REGISTER = 1 << 0;
|
|
|
|
static uint32_t const FRECENCYUPDATE = 1 << 1;
|
2014-01-22 21:54:51 +04:00
|
|
|
static uint32_t const CALLBACKS = 1 << 2;
|
|
|
|
static uint32_t const UNREGISTER = 1 << 3;
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
Ops() : mFlags(0) { }
|
|
|
|
uint32_t Grab() { uint32_t flags = mFlags; mFlags = 0; return flags; }
|
|
|
|
bool Set(uint32_t aFlags) { if (mFlags & aFlags) return false; mFlags |= aFlags; return true; }
|
|
|
|
private:
|
|
|
|
uint32_t mFlags;
|
|
|
|
} mBackgroundOperations;
|
|
|
|
|
|
|
|
nsCOMPtr<nsISupports> mSecurityInfo;
|
|
|
|
int64_t mPredictedDataSize;
|
2013-09-26 23:37:03 +04:00
|
|
|
mozilla::TimeStamp mLoadStart;
|
2014-07-08 18:48:00 +04:00
|
|
|
uint32_t mUseCount;
|
2013-11-21 02:20:17 +04:00
|
|
|
nsCOMPtr<nsIThread> mReleaseThread;
|
|
|
|
};
|
|
|
|
|
2014-01-07 00:24:41 +04:00
|
|
|
|
|
|
|
class CacheEntryHandle : public nsICacheEntry
|
|
|
|
{
|
|
|
|
public:
|
2014-08-05 17:20:24 +04:00
|
|
|
explicit CacheEntryHandle(CacheEntry* aEntry);
|
2014-01-07 00:24:41 +04:00
|
|
|
CacheEntry* Entry() const { return mEntry; }
|
|
|
|
|
|
|
|
NS_DECL_THREADSAFE_ISUPPORTS
|
|
|
|
NS_FORWARD_NSICACHEENTRY(mEntry->)
|
|
|
|
private:
|
2014-06-24 20:36:44 +04:00
|
|
|
virtual ~CacheEntryHandle();
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheEntry> mEntry;
|
2014-01-07 00:24:41 +04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2015-03-21 19:28:04 +03:00
|
|
|
class CacheOutputCloseListener final : public nsRunnable
|
2013-11-21 02:20:17 +04:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
void OnOutputClosed();
|
|
|
|
|
|
|
|
private:
|
|
|
|
friend class CacheEntry;
|
|
|
|
|
2014-07-15 19:37:45 +04:00
|
|
|
virtual ~CacheOutputCloseListener();
|
|
|
|
|
2013-11-21 02:20:17 +04:00
|
|
|
NS_DECL_NSIRUNNABLE
|
2014-08-05 17:20:24 +04:00
|
|
|
explicit CacheOutputCloseListener(CacheEntry* aEntry);
|
2013-11-21 02:20:17 +04:00
|
|
|
|
|
|
|
private:
|
2015-10-18 08:24:48 +03:00
|
|
|
RefPtr<CacheEntry> mEntry;
|
2013-09-20 13:11:25 +04:00
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace net
|
|
|
|
} // namespace mozilla
|
2013-09-20 13:11:25 +04:00
|
|
|
|
|
|
|
#endif
|