/* 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/. */
class MOZ_CAPABILITY("mutex") CacheFile final
: public CacheFileChunkListener, public CacheFileIOListener, public CacheFileMetadataListener { public:
NS_DECL_THREADSAFE_ISUPPORTS
void Lock() MOZ_CAPABILITY_ACQUIRE() { mLock->Lock().Lock(); } void Unlock() MOZ_CAPABILITY_RELEASE() { // move the elements out of mObjsToRelease // so that they can be released after we unlock
nsTArray<RefPtr<nsISupports>> objs = std::move(mObjsToRelease);
bool OutputStreamExists(bool aAlternativeData); // Returns number of bytes that are available and can be read by input stream // without waiting for the data. The amount is counted from the start of // aIndex chunk and it is guaranteed that this data won't be released by // CleanUpCachedChunks().
int64_t BytesFromChunk(uint32_t aIndex, bool aAlternativeData);
nsresult Truncate(int64_t aOffset);
bool mOpeningFile MOZ_GUARDED_BY(this){false}; bool mReady MOZ_GUARDED_BY(this){false}; bool mMemoryOnly MOZ_GUARDED_BY(this){false}; bool mSkipSizeCheck MOZ_GUARDED_BY(this){false}; bool mOpenAsMemoryOnly MOZ_GUARDED_BY(this){false}; bool mPinned MOZ_GUARDED_BY(this){false}; bool mPriority MOZ_GUARDED_BY(this){false}; bool mDataAccessed MOZ_GUARDED_BY(this){false}; bool mDataIsDirty MOZ_GUARDED_BY(this){false}; bool mWritingMetadata MOZ_GUARDED_BY(this){false}; bool mPreloadWithoutInputStreams MOZ_GUARDED_BY(this){true};
uint32_t mPreloadChunkCount MOZ_GUARDED_BY(this){0};
nsresult mStatus MOZ_GUARDED_BY(this){NS_OK}; // Size of the whole data including eventual alternative data represenation.
int64_t mDataSize MOZ_GUARDED_BY(this){-1};
// If there is alternative data present, it contains size of the original // data, i.e. offset where alternative data starts. Otherwise it is -1.
int64_t mAltDataOffset MOZ_GUARDED_BY(this){-1};
nsCString mKey MOZ_GUARDED_BY(this);
nsCString mAltDataType
MOZ_GUARDED_BY(this); // The type of the saved alt-data. May be empty.
nsRefPtrHashtable<nsUint32HashKey, CacheFileChunk> mChunks
MOZ_GUARDED_BY(this);
nsClassHashtable<nsUint32HashKey, ChunkListeners> mChunkListeners
MOZ_GUARDED_BY(this);
nsRefPtrHashtable<nsUint32HashKey, CacheFileChunk> mCachedChunks
MOZ_GUARDED_BY(this); // We can truncate data only if there is no input/output stream beyond the // truncate position, so only unused chunks can be thrown away. But it can // happen that we need to throw away a chunk that is still in mChunks (i.e. // an active chunk) because deactivation happens with a small delay. We cannot // delete such chunk immediately but we need to ensure that such chunk won't // be returned by GetChunkLocked, so we move this chunk into mDiscardedChunks // and mark it as discarded.
nsTArray<RefPtr<CacheFileChunk>> mDiscardedChunks MOZ_GUARDED_BY(this);
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung ist noch experimentell.