mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-01-27 07:34:20 +00:00
Bug 1682536 - Use references/NotNull in Manager. r=dom-workers-and-storage-reviewers,asuth
Differential Revision: https://phabricator.services.mozilla.com/D99776
This commit is contained in:
parent
4756746f18
commit
641ad4b8f6
10
dom/cache/Manager.cpp
vendored
10
dom/cache/Manager.cpp
vendored
@ -1804,16 +1804,14 @@ void Manager::ReleaseBodyId(const nsID& aBodyId) {
|
||||
|
||||
const ManagerId& Manager::GetManagerId() const { return *mManagerId; }
|
||||
|
||||
void Manager::AddStreamList(StreamList* aStreamList) {
|
||||
void Manager::AddStreamList(StreamList& aStreamList) {
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamList);
|
||||
mStreamLists.AppendElement(aStreamList);
|
||||
mStreamLists.AppendElement(WrapNotNullUnchecked(&aStreamList));
|
||||
}
|
||||
|
||||
void Manager::RemoveStreamList(StreamList* aStreamList) {
|
||||
void Manager::RemoveStreamList(StreamList& aStreamList) {
|
||||
NS_ASSERT_OWNINGTHREAD(Manager);
|
||||
MOZ_DIAGNOSTIC_ASSERT(aStreamList);
|
||||
mStreamLists.RemoveElement(aStreamList);
|
||||
mStreamLists.RemoveElement(&aStreamList);
|
||||
}
|
||||
|
||||
void Manager::ExecuteCacheOp(Listener* aListener, CacheId aCacheId,
|
||||
|
6
dom/cache/Manager.h
vendored
6
dom/cache/Manager.h
vendored
@ -177,8 +177,8 @@ class Manager final : public SafeRefCounted<Manager> {
|
||||
|
||||
// Methods to allow a StreamList to register themselves with the Manager.
|
||||
// StreamList objects must call RemoveStreamList() before they are destroyed.
|
||||
void AddStreamList(StreamList* aStreamList);
|
||||
void RemoveStreamList(StreamList* aStreamList);
|
||||
void AddStreamList(StreamList& aStreamList);
|
||||
void RemoveStreamList(StreamList& aStreamList);
|
||||
|
||||
void ExecuteCacheOp(Listener* aListener, CacheId aCacheId,
|
||||
const CacheOpArgs& aOpArgs);
|
||||
@ -268,7 +268,7 @@ class Manager final : public SafeRefCounted<Manager> {
|
||||
static ListenerId sNextListenerId;
|
||||
|
||||
// Weak references cleared by RemoveStreamList() in StreamList destructors.
|
||||
nsTArray<StreamList*> mStreamLists;
|
||||
nsTArray<NotNull<StreamList*>> mStreamLists;
|
||||
|
||||
bool mShuttingDown;
|
||||
State mState;
|
||||
|
4
dom/cache/StreamList.cpp
vendored
4
dom/cache/StreamList.cpp
vendored
@ -74,7 +74,7 @@ void StreamList::Activate(CacheId aCacheId) {
|
||||
mActivated = true;
|
||||
mCacheId = aCacheId;
|
||||
mManager->AddRefCacheId(mCacheId);
|
||||
mManager->AddStreamList(this);
|
||||
mManager->AddStreamList(*this);
|
||||
|
||||
for (uint32_t i = 0; i < mList.Length(); ++i) {
|
||||
mManager->AddRefBodyId(mList[i].mId);
|
||||
@ -149,7 +149,7 @@ StreamList::~StreamList() {
|
||||
NS_ASSERT_OWNINGTHREAD(StreamList);
|
||||
MOZ_DIAGNOSTIC_ASSERT(!mStreamControl);
|
||||
if (mActivated) {
|
||||
mManager->RemoveStreamList(this);
|
||||
mManager->RemoveStreamList(*this);
|
||||
for (uint32_t i = 0; i < mList.Length(); ++i) {
|
||||
mManager->ReleaseBodyId(mList[i].mId);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user