зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1682536 - Use references/NotNull with IDBCursor. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D99785
This commit is contained in:
Родитель
0875c1ca88
Коммит
b45e1e2a1a
|
@ -45,14 +45,14 @@ IDBCursor::IDBCursor(BackgroundCursorChildBase* const aBackgroundActor)
|
|||
aBackgroundActor->AssertIsOnOwningThread();
|
||||
MOZ_ASSERT(mRequest);
|
||||
|
||||
mTransaction->RegisterCursor(this);
|
||||
mTransaction->RegisterCursor(*this);
|
||||
}
|
||||
|
||||
template <IDBCursor::Type CursorType>
|
||||
IDBTypedCursor<CursorType>::~IDBTypedCursor() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
mTransaction->UnregisterCursor(this);
|
||||
mTransaction->UnregisterCursor(*this);
|
||||
|
||||
DropJSObjects();
|
||||
|
||||
|
|
|
@ -834,21 +834,21 @@ int64_t IDBTransaction::NextIndexId() {
|
|||
void IDBTransaction::InvalidateCursorCaches() {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
for (auto* const cursor : mCursors) {
|
||||
for (const auto& cursor : mCursors) {
|
||||
cursor->InvalidateCachedResponses();
|
||||
}
|
||||
}
|
||||
|
||||
void IDBTransaction::RegisterCursor(IDBCursor* const aCursor) {
|
||||
void IDBTransaction::RegisterCursor(IDBCursor& aCursor) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
mCursors.AppendElement(aCursor);
|
||||
mCursors.AppendElement(WrapNotNullUnchecked(&aCursor));
|
||||
}
|
||||
|
||||
void IDBTransaction::UnregisterCursor(IDBCursor* const aCursor) {
|
||||
void IDBTransaction::UnregisterCursor(IDBCursor& aCursor) {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
DebugOnly<bool> removed = mCursors.RemoveElement(aCursor);
|
||||
DebugOnly<bool> removed = mCursors.RemoveElement(&aCursor);
|
||||
MOZ_ASSERT(removed);
|
||||
}
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ class IDBTransaction final
|
|||
nsTArray<RefPtr<IDBObjectStore>> mObjectStores;
|
||||
nsTArray<RefPtr<IDBObjectStore>> mDeletedObjectStores;
|
||||
RefPtr<StrongWorkerRef> mWorkerRef;
|
||||
nsTArray<IDBCursor*> mCursors;
|
||||
nsTArray<NotNull<IDBCursor*>> mCursors;
|
||||
|
||||
// Tagged with mMode. If mMode is Mode::VersionChange then mBackgroundActor
|
||||
// will be a BackgroundVersionChangeTransactionChild. Otherwise it will be a
|
||||
|
@ -312,8 +312,8 @@ class IDBTransaction final
|
|||
int64_t NextIndexId();
|
||||
|
||||
void InvalidateCursorCaches();
|
||||
void RegisterCursor(IDBCursor* aCursor);
|
||||
void UnregisterCursor(IDBCursor* aCursor);
|
||||
void RegisterCursor(IDBCursor& aCursor);
|
||||
void UnregisterCursor(IDBCursor& aCursor);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_NSIRUNNABLE
|
||||
|
|
Загрузка…
Ссылка в новой задаче