mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 13:21:05 +00:00
Bug 1680724 - Use ToMaybeRef or SafeRefPtr::maybeDeref where possible. r=dom-workers-and-storage-reviewers,janv
Differential Revision: https://phabricator.services.mozilla.com/D98784
This commit is contained in:
parent
8c5c02b43d
commit
b2d834a030
2
dom/cache/Manager.cpp
vendored
2
dom/cache/Manager.cpp
vendored
@ -252,7 +252,7 @@ class Manager::Factory {
|
||||
// cleaning up. We need to tell the new manager about this so
|
||||
// that it won't actually start until the old manager is done.
|
||||
SafeRefPtr<Manager> oldManager = Acquire(*aManagerId, Closing);
|
||||
ref->Init(oldManager ? SomeRef(*oldManager) : Nothing());
|
||||
ref->Init(oldManager.maybeDeref());
|
||||
|
||||
MOZ_ASSERT(!sFactory->mManagerList.Contains(ref));
|
||||
sFactory->mManagerList.AppendElement(ref.unsafeGetRawPtr());
|
||||
|
@ -573,8 +573,8 @@ void SetResultAndDispatchSuccessEvent(
|
||||
const NotNull<RefPtr<IDBRequest>>& aRequest,
|
||||
const SafeRefPtr<IDBTransaction>& aTransaction, T& aPtr,
|
||||
RefPtr<Event> aEvent) {
|
||||
const auto autoTransaction = AutoSetCurrentTransaction{
|
||||
aTransaction ? SomeRef(*aTransaction) : Nothing()};
|
||||
const auto autoTransaction =
|
||||
AutoSetCurrentTransaction{aTransaction.maybeDeref()};
|
||||
|
||||
AUTO_PROFILER_LABEL("IndexedDB:SetResultAndDispatchSuccessEvent", DOM);
|
||||
|
||||
|
@ -487,7 +487,7 @@ auto MatchMetadataNameOrId(const Enumerable& aEnumerable,
|
||||
(aName && *aName == value->mCommonMetadata.name()));
|
||||
});
|
||||
|
||||
return it != aEnumerable.cend() ? SomeRef(*it->GetData()) : Nothing();
|
||||
return ToMaybeRef(it != aEnumerable.cend() ? it->GetData().get() : nullptr);
|
||||
}
|
||||
|
||||
/*******************************************************************************
|
||||
|
@ -188,7 +188,7 @@ class IDBRequest : public DOMEventTargetHelper {
|
||||
Maybe<IDBTransaction&> MaybeTransactionRef() const {
|
||||
AssertIsOnOwningThread();
|
||||
|
||||
return mTransaction ? SomeRef(*mTransaction) : Nothing();
|
||||
return mTransaction.maybeDeref();
|
||||
}
|
||||
|
||||
IDBTransaction& MutableTransactionRef() const {
|
||||
|
@ -262,9 +262,7 @@ class MOZ_IS_REFPTR MOZ_TRIVIAL_ABI SafeRefPtr {
|
||||
return mRawPtr;
|
||||
}
|
||||
|
||||
Maybe<T&> maybeDeref() const {
|
||||
return mRawPtr ? SomeRef(*mRawPtr) : Nothing();
|
||||
}
|
||||
Maybe<T&> maybeDeref() const { return ToMaybeRef(mRawPtr); }
|
||||
|
||||
T* unsafeGetRawPtr() const { return mRawPtr; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user