mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 932119 - convert nsIAtom to nsString in QuotaManager and IndexedDB, r=janv
This commit is contained in:
parent
4b529add5c
commit
787cb94c32
@ -154,7 +154,7 @@ FileService::Enqueue(LockedFile* aLockedFile, FileHelper* aFileHelper)
|
||||
return NS_ERROR_NOT_AVAILABLE;
|
||||
}
|
||||
|
||||
nsIAtom* storageId = fileHandle->mFileStorage->Id();
|
||||
const nsACString& storageId = fileHandle->mFileStorage->Id();
|
||||
const nsAString& fileName = fileHandle->mFileName;
|
||||
bool modeIsWrite = aLockedFile->mMode == FileMode::Readwrite;
|
||||
|
||||
@ -224,7 +224,7 @@ FileService::NotifyLockedFileCompleted(LockedFile* aLockedFile)
|
||||
NS_ASSERTION(aLockedFile, "Null pointer!");
|
||||
|
||||
FileHandle* fileHandle = aLockedFile->mFileHandle;
|
||||
nsIAtom* storageId = fileHandle->mFileStorage->Id();
|
||||
const nsACString& storageId = fileHandle->mFileStorage->Id();
|
||||
|
||||
FileStorageInfo* fileStorageInfo;
|
||||
if (!mFileStorageInfos.Get(storageId, &fileStorageInfo)) {
|
||||
@ -237,11 +237,7 @@ FileService::NotifyLockedFileCompleted(LockedFile* aLockedFile)
|
||||
if (!fileStorageInfo->HasRunningLockedFiles()) {
|
||||
mFileStorageInfos.Remove(storageId);
|
||||
|
||||
#ifdef DEBUG
|
||||
storageId = nullptr;
|
||||
#endif
|
||||
|
||||
// See if we need to fire any complete callbacks.
|
||||
// See if we need to fire any complete callbacks.
|
||||
uint32_t index = 0;
|
||||
while (index < mCompleteCallbacks.Length()) {
|
||||
if (MaybeFireCallback(mCompleteCallbacks[index])) {
|
||||
|
@ -186,7 +186,7 @@ private:
|
||||
MaybeFireCallback(StoragesCompleteCallback& aCallback);
|
||||
|
||||
nsCOMPtr<nsIEventTarget> mStreamTransportTarget;
|
||||
nsClassHashtable<nsISupportsHashKey, FileStorageInfo> mFileStorageInfos;
|
||||
nsClassHashtable<nsCStringHashKey, FileStorageInfo> mFileStorageInfos;
|
||||
nsTArray<StoragesCompleteCallback> mCompleteCallbacks;
|
||||
};
|
||||
|
||||
|
@ -13,14 +13,12 @@
|
||||
{0x6278f453, 0xd557, 0x4a55, \
|
||||
{ 0x99, 0x3e, 0xf4, 0x69, 0xe2, 0xa5, 0xe1, 0xd0 } }
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
class nsIFileStorage : public nsISupports
|
||||
{
|
||||
public:
|
||||
NS_DECLARE_STATIC_IID_ACCESSOR(NS_FILESTORAGE_IID)
|
||||
|
||||
NS_IMETHOD_(nsIAtom*)
|
||||
NS_IMETHOD_(const nsACString&)
|
||||
Id() = 0;
|
||||
|
||||
// Whether or not the storage has been invalidated. If it has then no further
|
||||
@ -41,7 +39,7 @@ public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIFileStorage, NS_FILESTORAGE_IID)
|
||||
|
||||
#define NS_DECL_NSIFILESTORAGE \
|
||||
NS_IMETHOD_(nsIAtom*) \
|
||||
NS_IMETHOD_(const nsACString&) \
|
||||
Id() MOZ_OVERRIDE; \
|
||||
\
|
||||
NS_IMETHOD_(bool) \
|
||||
|
@ -13,7 +13,7 @@ USING_INDEXEDDB_NAMESPACE
|
||||
|
||||
namespace {
|
||||
|
||||
typedef nsDataHashtable<nsISupportsHashKey, DatabaseInfo*>
|
||||
typedef nsDataHashtable<nsCStringHashKey, DatabaseInfo*>
|
||||
DatabaseHash;
|
||||
|
||||
DatabaseHash* gDatabaseHash = nullptr;
|
||||
@ -128,11 +128,11 @@ IndexUpdateInfo::~IndexUpdateInfo()
|
||||
|
||||
// static
|
||||
bool
|
||||
DatabaseInfo::Get(nsIAtom* aId,
|
||||
DatabaseInfo::Get(const nsACString& aId,
|
||||
DatabaseInfo** aInfo)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(aId, "Bad id!");
|
||||
NS_ASSERTION(!aId.IsEmpty(), "Bad id!");
|
||||
|
||||
if (gDatabaseHash &&
|
||||
gDatabaseHash->Get(aId, aInfo)) {
|
||||
@ -166,7 +166,7 @@ DatabaseInfo::Put(DatabaseInfo* aInfo)
|
||||
|
||||
// static
|
||||
void
|
||||
DatabaseInfo::Remove(nsIAtom* aId)
|
||||
DatabaseInfo::Remove(const nsACString& aId)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
||||
|
@ -62,12 +62,12 @@ struct DatabaseInfo : public DatabaseInfoGuts
|
||||
|
||||
~DatabaseInfo();
|
||||
|
||||
static bool Get(nsIAtom* aId,
|
||||
static bool Get(const nsACString& aId,
|
||||
DatabaseInfo** aInfo);
|
||||
|
||||
static bool Put(DatabaseInfo* aInfo);
|
||||
|
||||
static void Remove(nsIAtom* aId);
|
||||
static void Remove(const nsACString& aId);
|
||||
|
||||
bool GetObjectStoreNames(nsTArray<nsString>& aNames);
|
||||
bool ContainsStoreName(const nsAString& aName);
|
||||
@ -80,7 +80,7 @@ struct DatabaseInfo : public DatabaseInfoGuts
|
||||
|
||||
already_AddRefed<DatabaseInfo> Clone();
|
||||
|
||||
nsCOMPtr<nsIAtom> id;
|
||||
nsCString id;
|
||||
nsString filePath;
|
||||
bool cloned;
|
||||
|
||||
|
@ -734,7 +734,7 @@ IDBDatabase::Close()
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP_(nsIAtom*)
|
||||
NS_IMETHODIMP_(const nsACString&)
|
||||
IDBDatabase::Id()
|
||||
{
|
||||
return mDatabaseId;
|
||||
|
@ -245,7 +245,7 @@ private:
|
||||
// Set to a copy of the existing DatabaseInfo when starting a versionchange
|
||||
// transaction.
|
||||
nsRefPtr<DatabaseInfo> mPreviousDatabaseInfo;
|
||||
nsCOMPtr<nsIAtom> mDatabaseId;
|
||||
nsCString mDatabaseId;
|
||||
nsString mName;
|
||||
nsString mFilePath;
|
||||
nsCString mASCIIOrigin;
|
||||
|
@ -384,7 +384,7 @@ IgnoreWhitespace(PRUnichar c)
|
||||
// static
|
||||
nsresult
|
||||
IDBFactory::LoadDatabaseInformation(mozIStorageConnection* aConnection,
|
||||
nsIAtom* aDatabaseId,
|
||||
const nsACString& aDatabaseId,
|
||||
uint64_t* aVersion,
|
||||
ObjectStoreInfoArray& aObjectStores)
|
||||
{
|
||||
@ -647,9 +647,10 @@ IDBFactory::OpenInternal(const nsAString& aName,
|
||||
NS_ENSURE_SUCCESS(rv, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
}
|
||||
else if (aDeleting) {
|
||||
nsCOMPtr<nsIAtom> databaseId =
|
||||
QuotaManager::GetStorageId(aPersistenceType, aASCIIOrigin, aName);
|
||||
NS_ENSURE_TRUE(databaseId, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
nsCString databaseId;
|
||||
QuotaManager::GetStorageId(aPersistenceType, aASCIIOrigin, aName,
|
||||
databaseId);
|
||||
MOZ_ASSERT(!databaseId.IsEmpty());
|
||||
|
||||
IndexedDBDeleteDatabaseRequestChild* actor =
|
||||
new IndexedDBDeleteDatabaseRequestChild(this, request, databaseId);
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class mozIStorageConnection;
|
||||
class nsIAtom;
|
||||
class nsIFile;
|
||||
class nsIFileURL;
|
||||
class nsIPrincipal;
|
||||
@ -97,7 +96,7 @@ public:
|
||||
|
||||
static nsresult
|
||||
LoadDatabaseInformation(mozIStorageConnection* aConnection,
|
||||
nsIAtom* aDatabaseId,
|
||||
const nsACString& aDatabaseId,
|
||||
uint64_t* aVersion,
|
||||
ObjectStoreInfoArray& aObjectStores);
|
||||
|
||||
|
@ -962,7 +962,7 @@ const JSClass IDBObjectStore::sDummyPropJSClass = {
|
||||
already_AddRefed<IDBObjectStore>
|
||||
IDBObjectStore::Create(IDBTransaction* aTransaction,
|
||||
ObjectStoreInfo* aStoreInfo,
|
||||
nsIAtom* aDatabaseId,
|
||||
const nsACString& aDatabaseId,
|
||||
bool aCreating)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
|
@ -60,7 +60,7 @@ public:
|
||||
static already_AddRefed<IDBObjectStore>
|
||||
Create(IDBTransaction* aTransaction,
|
||||
ObjectStoreInfo* aInfo,
|
||||
nsIAtom* aDatabaseId,
|
||||
const nsACString& aDatabaseId,
|
||||
bool aCreating);
|
||||
|
||||
static nsresult
|
||||
@ -402,7 +402,7 @@ private:
|
||||
JS::Heap<JS::Value> mCachedKeyPath;
|
||||
bool mRooted;
|
||||
bool mAutoIncrement;
|
||||
nsCOMPtr<nsIAtom> mDatabaseId;
|
||||
nsCString mDatabaseId;
|
||||
nsRefPtr<ObjectStoreInfo> mInfo;
|
||||
|
||||
nsTArray<nsRefPtr<IDBIndex> > mCreatedIndexes;
|
||||
|
@ -21,7 +21,6 @@
|
||||
|
||||
#define INDEXEDDB_MANAGER_CONTRACTID "@mozilla.org/dom/indexeddb/manager;1"
|
||||
|
||||
class nsIAtom;
|
||||
class nsPIDOMWindow;
|
||||
class nsEventChainPostVisitor;
|
||||
|
||||
|
@ -1717,9 +1717,9 @@ NS_IMPL_ISUPPORTS1(OpenDatabaseHelper, nsIRunnable)
|
||||
nsresult
|
||||
OpenDatabaseHelper::Init()
|
||||
{
|
||||
mDatabaseId =
|
||||
QuotaManager::GetStorageId(mPersistenceType, mASCIIOrigin, mName);
|
||||
NS_ENSURE_TRUE(mDatabaseId, NS_ERROR_FAILURE);
|
||||
QuotaManager::GetStorageId(mPersistenceType, mASCIIOrigin, mName,
|
||||
mDatabaseId);
|
||||
MOZ_ASSERT(!mDatabaseId.IsEmpty());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -2509,7 +2509,6 @@ OpenDatabaseHelper::ReleaseMainThreadObjects()
|
||||
|
||||
mOpenDBRequest = nullptr;
|
||||
mDatabase = nullptr;
|
||||
mDatabaseId = nullptr;
|
||||
|
||||
HelperBase::ReleaseMainThreadObjects();
|
||||
}
|
||||
|
@ -47,7 +47,7 @@ public:
|
||||
: HelperBase(aRequest), mOpenDBRequest(aRequest), mName(aName),
|
||||
mGroup(aGroup), mASCIIOrigin(aASCIIOrigin),
|
||||
mRequestedVersion(aRequestedVersion), mPersistenceType(aPersistenceType),
|
||||
mForDeletion(aForDeletion), mPrivilege(aPrivilege), mDatabaseId(nullptr),
|
||||
mForDeletion(aForDeletion), mPrivilege(aPrivilege),
|
||||
mContentParent(aContentParent), mCurrentVersion(0), mLastObjectStoreId(0),
|
||||
mLastIndexId(0), mState(eCreated), mResultCode(NS_OK),
|
||||
mLoadDBMetadata(false),
|
||||
@ -82,9 +82,9 @@ public:
|
||||
nsresult NotifyDeleteFinished();
|
||||
void BlockDatabase();
|
||||
|
||||
nsIAtom* Id() const
|
||||
const nsACString& Id() const
|
||||
{
|
||||
return mDatabaseId.get();
|
||||
return mDatabaseId;
|
||||
}
|
||||
|
||||
IDBDatabase* Database() const
|
||||
@ -136,7 +136,7 @@ protected:
|
||||
PersistenceType mPersistenceType;
|
||||
bool mForDeletion;
|
||||
StoragePrivilege mPrivilege;
|
||||
nsCOMPtr<nsIAtom> mDatabaseId;
|
||||
nsCString mDatabaseId;
|
||||
mozilla::dom::ContentParent* mContentParent;
|
||||
|
||||
// Out-params.
|
||||
|
@ -212,7 +212,7 @@ TransactionThreadPool::FinishTransaction(IDBTransaction* aTransaction)
|
||||
// AddRef here because removing from the hash will call Release.
|
||||
nsRefPtr<IDBTransaction> transaction(aTransaction);
|
||||
|
||||
nsIAtom* databaseId = aTransaction->mDatabase->Id();
|
||||
const nsACString& databaseId = aTransaction->mDatabase->Id();
|
||||
|
||||
DatabaseTransactionInfo* dbTransactionInfo;
|
||||
if (!mTransactionsInProgress.Get(databaseId, &dbTransactionInfo)) {
|
||||
@ -286,7 +286,8 @@ TransactionThreadPool::GetQueueForTransaction(IDBTransaction* aTransaction)
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(aTransaction, "Null pointer!");
|
||||
|
||||
nsIAtom* databaseId = aTransaction->mDatabase->Id();
|
||||
const nsACString& databaseId = aTransaction->mDatabase->Id();
|
||||
|
||||
const nsTArray<nsString>& objectStoreNames = aTransaction->mObjectStoreNames;
|
||||
const uint16_t mode = aTransaction->mMode;
|
||||
|
||||
@ -509,8 +510,7 @@ TransactionThreadPool::MaybeFireCallback(DatabasesCompleteCallback aCallback)
|
||||
MOZ_CRASH();
|
||||
}
|
||||
|
||||
if (mTransactionsInProgress.Get(database->Id(),
|
||||
nullptr)) {
|
||||
if (mTransactionsInProgress.Get(database->Id(), nullptr)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
@ -171,7 +171,7 @@ protected:
|
||||
|
||||
nsCOMPtr<nsIThreadPool> mThreadPool;
|
||||
|
||||
nsClassHashtable<nsISupportsHashKey, DatabaseTransactionInfo>
|
||||
nsClassHashtable<nsCStringHashKey, DatabaseTransactionInfo>
|
||||
mTransactionsInProgress;
|
||||
|
||||
nsTArray<DatabasesCompleteCallback> mCompleteCallbacks;
|
||||
|
@ -6,7 +6,6 @@
|
||||
|
||||
#include "IndexedDBChild.h"
|
||||
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIInputStream.h"
|
||||
|
||||
#include "mozilla/Assertions.h"
|
||||
@ -284,15 +283,15 @@ IndexedDBDatabaseChild::EnsureDatabase(
|
||||
const DatabaseInfoGuts& aDBInfo,
|
||||
const InfallibleTArray<ObjectStoreInfoGuts>& aOSInfo)
|
||||
{
|
||||
nsCOMPtr<nsIAtom> databaseId;
|
||||
nsCString databaseId;
|
||||
if (mDatabase) {
|
||||
databaseId = mDatabase->Id();
|
||||
}
|
||||
else {
|
||||
databaseId = QuotaManager::GetStorageId(aDBInfo.persistenceType,
|
||||
aDBInfo.origin, aDBInfo.name);
|
||||
QuotaManager::GetStorageId(aDBInfo.persistenceType,
|
||||
aDBInfo.origin, aDBInfo.name, databaseId);
|
||||
}
|
||||
NS_ENSURE_TRUE(databaseId, false);
|
||||
MOZ_ASSERT(!databaseId.IsEmpty());
|
||||
|
||||
nsRefPtr<DatabaseInfo> dbInfo;
|
||||
if (DatabaseInfo::Get(databaseId, getter_AddRefs(dbInfo))) {
|
||||
@ -1232,13 +1231,13 @@ IndexedDBCursorRequestChild::Recv__delete__(const ResponseValue& aResponse)
|
||||
IndexedDBDeleteDatabaseRequestChild::IndexedDBDeleteDatabaseRequestChild(
|
||||
IDBFactory* aFactory,
|
||||
IDBOpenDBRequest* aOpenRequest,
|
||||
nsIAtom* aDatabaseId)
|
||||
const nsACString& aDatabaseId)
|
||||
: mFactory(aFactory), mOpenRequest(aOpenRequest), mDatabaseId(aDatabaseId)
|
||||
{
|
||||
MOZ_COUNT_CTOR(IndexedDBDeleteDatabaseRequestChild);
|
||||
MOZ_ASSERT(aFactory);
|
||||
MOZ_ASSERT(aOpenRequest);
|
||||
MOZ_ASSERT(aDatabaseId);
|
||||
MOZ_ASSERT(!aDatabaseId.IsEmpty());
|
||||
}
|
||||
|
||||
IndexedDBDeleteDatabaseRequestChild::~IndexedDBDeleteDatabaseRequestChild()
|
||||
|
@ -19,8 +19,6 @@
|
||||
#include "mozilla/dom/indexedDB/PIndexedDBRequestChild.h"
|
||||
#include "mozilla/dom/indexedDB/PIndexedDBTransactionChild.h"
|
||||
|
||||
class nsIAtom;
|
||||
|
||||
BEGIN_INDEXEDDB_NAMESPACE
|
||||
|
||||
class AsyncConnectionHelper;
|
||||
@ -415,12 +413,12 @@ class IndexedDBDeleteDatabaseRequestChild :
|
||||
{
|
||||
nsRefPtr<IDBFactory> mFactory;
|
||||
nsRefPtr<IDBOpenDBRequest> mOpenRequest;
|
||||
nsCOMPtr<nsIAtom> mDatabaseId;
|
||||
nsCString mDatabaseId;
|
||||
|
||||
public:
|
||||
IndexedDBDeleteDatabaseRequestChild(IDBFactory* aFactory,
|
||||
IDBOpenDBRequest* aOpenRequest,
|
||||
nsIAtom* aDatabaseId);
|
||||
const nsACString& aDatabaseId);
|
||||
virtual ~IndexedDBDeleteDatabaseRequestChild();
|
||||
|
||||
protected:
|
||||
|
@ -7,7 +7,6 @@
|
||||
#include "QuotaManager.h"
|
||||
|
||||
#include "mozIApplicationClearPrivateDataParams.h"
|
||||
#include "nsIAtom.h"
|
||||
#include "nsIBinaryInputStream.h"
|
||||
#include "nsIBinaryOutputStream.h"
|
||||
#include "nsIFile.h"
|
||||
@ -110,7 +109,7 @@ struct SynchronizedOp
|
||||
{
|
||||
SynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsISupports* aId);
|
||||
const nsACString& aId);
|
||||
|
||||
~SynchronizedOp();
|
||||
|
||||
@ -126,7 +125,7 @@ struct SynchronizedOp
|
||||
|
||||
const OriginOrPatternString mOriginOrPattern;
|
||||
Nullable<PersistenceType> mPersistenceType;
|
||||
nsCOMPtr<nsISupports> mId;
|
||||
nsCString mId;
|
||||
nsRefPtr<AcquireListener> mListener;
|
||||
nsTArray<nsCOMPtr<nsIRunnable> > mDelayedRunnables;
|
||||
ArrayCluster<nsIOfflineStorage*> mStorages;
|
||||
@ -1551,8 +1550,7 @@ QuotaManager::HasOpenTransactions(nsPIDOMWindow* aWindow)
|
||||
nsresult
|
||||
QuotaManager::WaitForOpenAllowed(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsIAtom* aId,
|
||||
nsIRunnable* aRunnable)
|
||||
const nsACString& aId, nsIRunnable* aRunnable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(!aOriginOrPattern.IsEmpty() || aOriginOrPattern.IsNull(),
|
||||
@ -1588,11 +1586,11 @@ QuotaManager::WaitForOpenAllowed(const OriginOrPatternString& aOriginOrPattern,
|
||||
|
||||
void
|
||||
QuotaManager::AddSynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsIAtom* aId)
|
||||
Nullable<PersistenceType> aPersistenceType)
|
||||
{
|
||||
nsAutoPtr<SynchronizedOp> op(new SynchronizedOp(aOriginOrPattern,
|
||||
aPersistenceType, nullptr));
|
||||
aPersistenceType,
|
||||
EmptyCString()));
|
||||
|
||||
#ifdef DEBUG
|
||||
for (uint32_t index = mSynchronizedOps.Length(); index > 0; index--) {
|
||||
@ -1608,7 +1606,7 @@ void
|
||||
QuotaManager::AllowNextSynchronizedOp(
|
||||
const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsIAtom* aId)
|
||||
const nsACString& aId)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(!aOriginOrPattern.IsEmpty() || aOriginOrPattern.IsNull(),
|
||||
@ -1631,7 +1629,8 @@ QuotaManager::AllowNextSynchronizedOp(
|
||||
|
||||
// If one or the other is for an origin clear, we should have matched
|
||||
// solely on origin.
|
||||
NS_ASSERTION(op->mId && aId, "Why didn't we match earlier?");
|
||||
NS_ASSERTION(!op->mId.IsEmpty() && !aId.IsEmpty(),
|
||||
"Why didn't we match earlier?");
|
||||
}
|
||||
}
|
||||
|
||||
@ -2004,10 +2003,11 @@ QuotaManager::GetStorageQuotaMB()
|
||||
}
|
||||
|
||||
// static
|
||||
already_AddRefed<nsIAtom>
|
||||
void
|
||||
QuotaManager::GetStorageId(PersistenceType aPersistenceType,
|
||||
const nsACString& aOrigin,
|
||||
const nsAString& aName)
|
||||
const nsAString& aName,
|
||||
nsACString& aDatabaseId)
|
||||
{
|
||||
nsAutoCString str;
|
||||
str.AppendInt(aPersistenceType);
|
||||
@ -2016,10 +2016,7 @@ QuotaManager::GetStorageId(PersistenceType aPersistenceType,
|
||||
str.Append('*');
|
||||
str.Append(NS_ConvertUTF16toUTF8(aName));
|
||||
|
||||
nsCOMPtr<nsIAtom> atom = do_GetAtom(str);
|
||||
NS_ENSURE_TRUE(atom, nullptr);
|
||||
|
||||
return atom.forget();
|
||||
aDatabaseId = str;
|
||||
}
|
||||
|
||||
// static
|
||||
@ -2218,7 +2215,8 @@ QuotaManager::GetUsageForURI(nsIURI* aURI,
|
||||
aCallback);
|
||||
|
||||
// Put the computation runnable in the queue.
|
||||
rv = WaitForOpenAllowed(oops, Nullable<PersistenceType>(), nullptr, runnable);
|
||||
rv = WaitForOpenAllowed(oops, Nullable<PersistenceType>(), EmptyCString(),
|
||||
runnable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
runnable->AdvanceState();
|
||||
@ -2243,7 +2241,8 @@ QuotaManager::Clear()
|
||||
|
||||
// Put the clear runnable in the queue.
|
||||
nsresult rv =
|
||||
WaitForOpenAllowed(oops, Nullable<PersistenceType>(), nullptr, runnable);
|
||||
WaitForOpenAllowed(oops, Nullable<PersistenceType>(), EmptyCString(),
|
||||
runnable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
runnable->AdvanceState();
|
||||
@ -2301,7 +2300,8 @@ QuotaManager::ClearStoragesForURI(nsIURI* aURI,
|
||||
// Queue up the origin clear runnable.
|
||||
nsRefPtr<OriginClearRunnable> runnable = new OriginClearRunnable(oops);
|
||||
|
||||
rv = WaitForOpenAllowed(oops, Nullable<PersistenceType>(), nullptr, runnable);
|
||||
rv = WaitForOpenAllowed(oops, Nullable<PersistenceType>(), EmptyCString(),
|
||||
runnable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
runnable->AdvanceState();
|
||||
@ -2338,7 +2338,8 @@ QuotaManager::Reset()
|
||||
|
||||
// Put the reset runnable in the queue.
|
||||
nsresult rv =
|
||||
WaitForOpenAllowed(oops, Nullable<PersistenceType>(), nullptr, runnable);
|
||||
WaitForOpenAllowed(oops, Nullable<PersistenceType>(), EmptyCString(),
|
||||
runnable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
runnable->AdvanceState();
|
||||
@ -2642,7 +2643,8 @@ QuotaManager::AcquireExclusiveAccess(const nsACString& aPattern,
|
||||
aStorage->Id());
|
||||
}
|
||||
else {
|
||||
op = FindSynchronizedOp(aPattern, Nullable<PersistenceType>(), nullptr);
|
||||
op = FindSynchronizedOp(aPattern, Nullable<PersistenceType>(),
|
||||
EmptyCString());
|
||||
}
|
||||
|
||||
NS_ASSERTION(op, "We didn't find a SynchronizedOp?");
|
||||
@ -2797,14 +2799,14 @@ QuotaManager::RunSynchronizedOp(nsIOfflineStorage* aStorage,
|
||||
SynchronizedOp*
|
||||
QuotaManager::FindSynchronizedOp(const nsACString& aPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsISupports* aId)
|
||||
const nsACString& aId)
|
||||
{
|
||||
for (uint32_t index = 0; index < mSynchronizedOps.Length(); index++) {
|
||||
const nsAutoPtr<SynchronizedOp>& currentOp = mSynchronizedOps[index];
|
||||
if (PatternMatchesOrigin(aPattern, currentOp->mOriginOrPattern) &&
|
||||
(currentOp->mPersistenceType.IsNull() ||
|
||||
currentOp->mPersistenceType == aPersistenceType) &&
|
||||
(!currentOp->mId || currentOp->mId == aId)) {
|
||||
(currentOp->mId.IsEmpty() || currentOp->mId == aId)) {
|
||||
return currentOp;
|
||||
}
|
||||
}
|
||||
@ -2837,7 +2839,8 @@ QuotaManager::ClearStoragesForApp(uint32_t aAppId, bool aBrowserOnly)
|
||||
nsRefPtr<OriginClearRunnable> runnable = new OriginClearRunnable(oops);
|
||||
|
||||
nsresult rv =
|
||||
WaitForOpenAllowed(oops, Nullable<PersistenceType>(), nullptr, runnable);
|
||||
WaitForOpenAllowed(oops, Nullable<PersistenceType>(), EmptyCString(),
|
||||
runnable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
runnable->AdvanceState();
|
||||
@ -3125,8 +3128,7 @@ QuotaManager::CollectOriginsForEviction(uint64_t aMinSizeToBeFreed,
|
||||
OriginOrPatternString::FromOrigin(inactiveOrigins[index]->mOrigin);
|
||||
|
||||
AddSynchronizedOp(oops,
|
||||
Nullable<PersistenceType>(PERSISTENCE_TYPE_TEMPORARY),
|
||||
nullptr);
|
||||
Nullable<PersistenceType>(PERSISTENCE_TYPE_TEMPORARY));
|
||||
}
|
||||
|
||||
inactiveOrigins.SwapElements(aOriginInfos);
|
||||
@ -3229,7 +3231,7 @@ QuotaManager::GetOriginPatternString(uint32_t aAppId,
|
||||
|
||||
SynchronizedOp::SynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsISupports* aId)
|
||||
const nsACString& aId)
|
||||
: mOriginOrPattern(aOriginOrPattern), mPersistenceType(aPersistenceType),
|
||||
mId(aId)
|
||||
{
|
||||
@ -3288,8 +3290,8 @@ SynchronizedOp::MustWaitFor(const SynchronizedOp& aExistingOp)
|
||||
}
|
||||
|
||||
// Waiting is required if either one corresponds to an origin clearing
|
||||
// (a null Id).
|
||||
if (!aExistingOp.mId || !mId) {
|
||||
// (an empty Id).
|
||||
if (aExistingOp.mId.IsEmpty() || mId.IsEmpty()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -3302,7 +3304,7 @@ void
|
||||
SynchronizedOp::DelayRunnable(nsIRunnable* aRunnable)
|
||||
{
|
||||
NS_ASSERTION(NS_IsMainThread(), "Wrong thread!");
|
||||
NS_ASSERTION(mDelayedRunnables.IsEmpty() || !mId,
|
||||
NS_ASSERTION(mDelayedRunnables.IsEmpty() || mId.IsEmpty(),
|
||||
"Only ClearOrigin operations can delay multiple runnables!");
|
||||
|
||||
mDelayedRunnables.AppendElement(aRunnable);
|
||||
@ -3523,7 +3525,7 @@ OriginClearRunnable::Run()
|
||||
// Tell the QuotaManager that we're done.
|
||||
quotaManager->AllowNextSynchronizedOp(mOriginOrPattern,
|
||||
Nullable<PersistenceType>(),
|
||||
nullptr);
|
||||
EmptyCString());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3633,7 +3635,7 @@ AsyncUsageRunnable::RunInternal()
|
||||
if (mCallbackState == Complete) {
|
||||
quotaManager->AllowNextSynchronizedOp(mOrigin,
|
||||
Nullable<PersistenceType>(),
|
||||
nullptr);
|
||||
EmptyCString());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
@ -3883,7 +3885,7 @@ ResetOrClearRunnable::Run()
|
||||
// Tell the QuotaManager that we're done.
|
||||
quotaManager->AllowNextSynchronizedOp(OriginOrPatternString::FromNull(),
|
||||
Nullable<PersistenceType>(),
|
||||
nullptr);
|
||||
EmptyCString());
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
@ -3950,7 +3952,7 @@ FinalizeOriginEvictionRunnable::Run()
|
||||
quotaManager->AllowNextSynchronizedOp(
|
||||
OriginOrPatternString::FromOrigin(mOrigins[index]),
|
||||
Nullable<PersistenceType>(PERSISTENCE_TYPE_TEMPORARY),
|
||||
nullptr);
|
||||
EmptyCString());
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
@ -25,7 +25,6 @@
|
||||
|
||||
#define QUOTA_MANAGER_CONTRACTID "@mozilla.org/dom/quota/manager;1"
|
||||
|
||||
class nsIAtom;
|
||||
class nsIOfflineStorage;
|
||||
class nsIPrincipal;
|
||||
class nsIThread;
|
||||
@ -191,8 +190,7 @@ public:
|
||||
nsresult
|
||||
WaitForOpenAllowed(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsIAtom* aId,
|
||||
nsIRunnable* aRunnable);
|
||||
const nsACString& aId, nsIRunnable* aRunnable);
|
||||
|
||||
// Acquire exclusive access to the storage given (waits for all others to
|
||||
// close). If storages need to close first, the callback will be invoked
|
||||
@ -222,12 +220,13 @@ public:
|
||||
void
|
||||
AllowNextSynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsIAtom* aId);
|
||||
const nsACString& aId);
|
||||
|
||||
bool
|
||||
IsClearOriginPending(const nsACString& aPattern)
|
||||
{
|
||||
return !!FindSynchronizedOp(aPattern, Nullable<PersistenceType>(), nullptr);
|
||||
return !!FindSynchronizedOp(aPattern, Nullable<PersistenceType>(),
|
||||
EmptyCString());
|
||||
}
|
||||
|
||||
nsresult
|
||||
@ -286,10 +285,11 @@ public:
|
||||
static uint32_t
|
||||
GetStorageQuotaMB();
|
||||
|
||||
static already_AddRefed<nsIAtom>
|
||||
static void
|
||||
GetStorageId(PersistenceType aPersistenceType,
|
||||
const nsACString& aOrigin,
|
||||
const nsAString& aName);
|
||||
const nsAString& aName,
|
||||
nsACString& aDatabaseId);
|
||||
|
||||
static nsresult
|
||||
GetInfoFromURI(nsIURI* aURI,
|
||||
@ -375,8 +375,7 @@ private:
|
||||
|
||||
void
|
||||
AddSynchronizedOp(const OriginOrPatternString& aOriginOrPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsIAtom* aId);
|
||||
Nullable<PersistenceType> aPersistenceType);
|
||||
|
||||
nsresult
|
||||
RunSynchronizedOp(nsIOfflineStorage* aStorage,
|
||||
@ -385,7 +384,7 @@ private:
|
||||
SynchronizedOp*
|
||||
FindSynchronizedOp(const nsACString& aPattern,
|
||||
Nullable<PersistenceType> aPersistenceType,
|
||||
nsISupports* aId);
|
||||
const nsACString& aId);
|
||||
|
||||
nsresult
|
||||
MaybeUpgradeIndexedDBDirectory();
|
||||
|
Loading…
Reference in New Issue
Block a user