зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1362761
- Force file and streams to use smart pointers. r=dimi
MozReview-Commit-ID: GscB9PaaN02 Differential Revision: https://phabricator.services.mozilla.com/D2060 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
2919be8a89
Коммит
3e4ea00c5f
|
@ -67,7 +67,7 @@ void CStringToHexString(const nsACString& aIn, nsACString& aOut)
|
|||
|
||||
LookupCache::LookupCache(const nsACString& aTableName,
|
||||
const nsACString& aProvider,
|
||||
nsIFile* aRootStoreDir)
|
||||
nsCOMPtr<nsIFile>& aRootStoreDir)
|
||||
: mPrimed(false)
|
||||
, mTableName(aTableName)
|
||||
, mProvider(aProvider)
|
||||
|
@ -87,7 +87,7 @@ LookupCache::Open()
|
|||
}
|
||||
|
||||
nsresult
|
||||
LookupCache::UpdateRootDirHandle(nsIFile* aNewRootStoreDirectory)
|
||||
LookupCache::UpdateRootDirHandle(nsCOMPtr<nsIFile>& aNewRootStoreDirectory)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -704,13 +704,13 @@ LookupCacheV2::ClearPrefixes()
|
|||
}
|
||||
|
||||
nsresult
|
||||
LookupCacheV2::StoreToFile(nsIFile* aFile)
|
||||
LookupCacheV2::StoreToFile(nsCOMPtr<nsIFile>& aFile)
|
||||
{
|
||||
return mPrefixSet->StoreToFile(aFile);
|
||||
}
|
||||
|
||||
nsresult
|
||||
LookupCacheV2::LoadFromFile(nsIFile* aFile)
|
||||
LookupCacheV2::LoadFromFile(nsCOMPtr<nsIFile>& aFile)
|
||||
{
|
||||
return mPrefixSet->LoadFromFile(aFile);
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public:
|
|||
|
||||
LookupCache(const nsACString& aTableName,
|
||||
const nsACString& aProvider,
|
||||
nsIFile* aStoreFile);
|
||||
nsCOMPtr<nsIFile>& aStoreFile);
|
||||
|
||||
NS_INLINE_DECL_THREADSAFE_REFCOUNTING(LookupCache);
|
||||
|
||||
|
@ -198,7 +198,7 @@ public:
|
|||
|
||||
// The directory handle where we operate will
|
||||
// be moved away when a backup is made.
|
||||
nsresult UpdateRootDirHandle(nsIFile* aRootStoreDirectory);
|
||||
nsresult UpdateRootDirHandle(nsCOMPtr<nsIFile>& aRootStoreDirectory);
|
||||
|
||||
// Write data stored in lookup cache to disk.
|
||||
nsresult WriteFile();
|
||||
|
@ -248,8 +248,8 @@ public:
|
|||
private:
|
||||
nsresult LoadPrefixSet();
|
||||
|
||||
virtual nsresult StoreToFile(nsIFile* aFile) = 0;
|
||||
virtual nsresult LoadFromFile(nsIFile* aFile) = 0;
|
||||
virtual nsresult StoreToFile(nsCOMPtr<nsIFile>& aFile) = 0;
|
||||
virtual nsresult LoadFromFile(nsCOMPtr<nsIFile>& aFile) = 0;
|
||||
virtual size_t SizeOfPrefixSet() const = 0;
|
||||
|
||||
virtual int Ver() const = 0;
|
||||
|
@ -283,7 +283,7 @@ class LookupCacheV2 final : public LookupCache
|
|||
public:
|
||||
explicit LookupCacheV2(const nsACString& aTableName,
|
||||
const nsACString& aProvider,
|
||||
nsIFile* aStoreFile)
|
||||
nsCOMPtr<nsIFile>& aStoreFile)
|
||||
: LookupCache(aTableName, aProvider, aStoreFile) {}
|
||||
|
||||
virtual nsresult Init() override;
|
||||
|
@ -317,8 +317,8 @@ protected:
|
|||
nsresult ReadCompletions();
|
||||
|
||||
virtual nsresult ClearPrefixes() override;
|
||||
virtual nsresult StoreToFile(nsIFile* aFile) override;
|
||||
virtual nsresult LoadFromFile(nsIFile* aFile) override;
|
||||
virtual nsresult StoreToFile(nsCOMPtr<nsIFile>& aFile) override;
|
||||
virtual nsresult LoadFromFile(nsCOMPtr<nsIFile>& aFile) override;
|
||||
virtual size_t SizeOfPrefixSet() const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -181,13 +181,13 @@ LookupCacheV4::ClearPrefixes()
|
|||
}
|
||||
|
||||
nsresult
|
||||
LookupCacheV4::StoreToFile(nsIFile* aFile)
|
||||
LookupCacheV4::StoreToFile(nsCOMPtr<nsIFile>& aFile)
|
||||
{
|
||||
return mVLPrefixSet->StoreToFile(aFile);
|
||||
}
|
||||
|
||||
nsresult
|
||||
LookupCacheV4::LoadFromFile(nsIFile* aFile)
|
||||
LookupCacheV4::LoadFromFile(nsCOMPtr<nsIFile>& aFile)
|
||||
{
|
||||
nsresult rv = mVLPrefixSet->LoadFromFile(aFile);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
|
|
@ -19,7 +19,7 @@ class LookupCacheV4 final : public LookupCache
|
|||
public:
|
||||
explicit LookupCacheV4(const nsACString& aTableName,
|
||||
const nsACString& aProvider,
|
||||
nsIFile* aStoreFile)
|
||||
nsCOMPtr<nsIFile>& aStoreFile)
|
||||
: LookupCache(aTableName, aProvider, aStoreFile) {}
|
||||
|
||||
virtual nsresult Init() override;
|
||||
|
@ -50,8 +50,8 @@ public:
|
|||
|
||||
protected:
|
||||
virtual nsresult ClearPrefixes() override;
|
||||
virtual nsresult StoreToFile(nsIFile* aFile) override;
|
||||
virtual nsresult LoadFromFile(nsIFile* aFile) override;
|
||||
virtual nsresult StoreToFile(nsCOMPtr<nsIFile>& aFile) override;
|
||||
virtual nsresult LoadFromFile(nsCOMPtr<nsIFile>& aFile) override;
|
||||
virtual size_t SizeOfPrefixSet() const override;
|
||||
|
||||
private:
|
||||
|
|
|
@ -212,7 +212,7 @@ VariableLengthPrefixSet::IsEmpty(bool* aEmpty) const
|
|||
}
|
||||
|
||||
nsresult
|
||||
VariableLengthPrefixSet::LoadFromFile(nsIFile* aFile)
|
||||
VariableLengthPrefixSet::LoadFromFile(nsCOMPtr<nsIFile>& aFile)
|
||||
{
|
||||
MutexAutoLock lock(mLock);
|
||||
|
||||
|
@ -254,7 +254,7 @@ VariableLengthPrefixSet::LoadFromFile(nsIFile* aFile)
|
|||
}
|
||||
|
||||
nsresult
|
||||
VariableLengthPrefixSet::StoreToFile(nsIFile* aFile) const
|
||||
VariableLengthPrefixSet::StoreToFile(nsCOMPtr<nsIFile>& aFile) const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aFile);
|
||||
|
||||
|
@ -293,7 +293,7 @@ VariableLengthPrefixSet::StoreToFile(nsIFile* aFile) const
|
|||
}
|
||||
|
||||
nsresult
|
||||
VariableLengthPrefixSet::LoadPrefixes(nsIInputStream* in)
|
||||
VariableLengthPrefixSet::LoadPrefixes(nsCOMPtr<nsIInputStream>& in)
|
||||
{
|
||||
uint32_t magic;
|
||||
uint32_t read;
|
||||
|
@ -362,7 +362,7 @@ VariableLengthPrefixSet::CalculatePreallocateSize() const
|
|||
}
|
||||
|
||||
nsresult
|
||||
VariableLengthPrefixSet::WritePrefixes(nsIOutputStream* out) const
|
||||
VariableLengthPrefixSet::WritePrefixes(nsCOMPtr<nsIOutputStream>& out) const
|
||||
{
|
||||
uint32_t written;
|
||||
uint32_t writelen = sizeof(uint32_t);
|
||||
|
|
|
@ -31,8 +31,8 @@ public:
|
|||
nsresult GetFixedLengthPrefixes(FallibleTArray<uint32_t>& aPrefixes);
|
||||
nsresult Matches(const nsACString& aFullHash, uint32_t* aLength) const;
|
||||
nsresult IsEmpty(bool* aEmpty) const;
|
||||
nsresult LoadFromFile(nsIFile* aFile);
|
||||
nsresult StoreToFile(nsIFile* aFile) const;
|
||||
nsresult LoadFromFile(nsCOMPtr<nsIFile>& aFile);
|
||||
nsresult StoreToFile(nsCOMPtr<nsIFile>& aFile) const;
|
||||
|
||||
size_t SizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const;
|
||||
|
||||
|
@ -50,8 +50,8 @@ private:
|
|||
uint32_t aPrefixSize) const;
|
||||
|
||||
uint32_t CalculatePreallocateSize() const;
|
||||
nsresult WritePrefixes(nsIOutputStream* out) const;
|
||||
nsresult LoadPrefixes(nsIInputStream* in);
|
||||
nsresult WritePrefixes(nsCOMPtr<nsIOutputStream>& out) const;
|
||||
nsresult LoadPrefixes(nsCOMPtr<nsIInputStream>& in);
|
||||
|
||||
// Lock to prevent races between the url-classifier thread (which does most
|
||||
// of the operations) and the main thread (which does memory reporting).
|
||||
|
|
|
@ -429,7 +429,7 @@ nsUrlClassifierPrefixSet::StoreToFile(nsIFile* aFile)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsUrlClassifierPrefixSet::LoadPrefixes(nsIInputStream* in)
|
||||
nsUrlClassifierPrefixSet::LoadPrefixes(nsCOMPtr<nsIInputStream>& in)
|
||||
{
|
||||
mCanary.Check();
|
||||
|
||||
|
@ -521,7 +521,7 @@ nsUrlClassifierPrefixSet::CalculatePreallocateSize() const
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsUrlClassifierPrefixSet::WritePrefixes(nsIOutputStream* out) const
|
||||
nsUrlClassifierPrefixSet::WritePrefixes(nsCOMPtr<nsIOutputStream>& out) const
|
||||
{
|
||||
mCanary.Check();
|
||||
|
||||
|
|
|
@ -66,8 +66,8 @@ private:
|
|||
uint32_t BinSearch(uint32_t start, uint32_t end, uint32_t target) const;
|
||||
|
||||
uint32_t CalculatePreallocateSize() const;
|
||||
nsresult WritePrefixes(nsIOutputStream* out) const;
|
||||
nsresult LoadPrefixes(nsIInputStream* in);
|
||||
nsresult WritePrefixes(nsCOMPtr<nsIOutputStream>& out) const;
|
||||
nsresult LoadPrefixes(nsCOMPtr<nsIInputStream>& in);
|
||||
|
||||
// Lock to prevent races between the url-classifier thread (which does most
|
||||
// of the operations) and the main thread (which does memory reporting).
|
||||
|
|
|
@ -26,7 +26,7 @@ template<typename T>
|
|||
void VerifyPrivateStorePath(T* target,
|
||||
const nsCString& aTableName,
|
||||
const nsCString& aProvider,
|
||||
nsIFile* aRootDir,
|
||||
nsCOMPtr<nsIFile> aRootDir,
|
||||
bool aUsePerProviderStore)
|
||||
{
|
||||
nsString rootStorePath;
|
||||
|
|
Загрузка…
Ссылка в новой задаче