Bug 1492894 - part 2 - eliminate already_AddRefed variables in netwerk/; r=valentin

We need to disallow these to fix our static analysis, which should have
already been disallowing them.
This commit is contained in:
Nathan Froyd 2018-09-21 16:45:49 -04:00
Родитель 846d8789ee
Коммит b500bde65b
2 изменённых файлов: 5 добавлений и 9 удалений

Просмотреть файл

@ -38,8 +38,7 @@ public:
void takeOver(nsCOMPtr<T> & rhs)
{
already_AddRefed<T> other = rhs.forget();
TakeOverInternal(&other);
TakeOverInternal(rhs.forget());
}
void CloseAndRelease()
@ -48,15 +47,12 @@ public:
}
private:
void TakeOverInternal(already_AddRefed<T> *aOther)
void TakeOverInternal(already_AddRefed<T>&& aOther)
{
nsCOMPtr<T> ptr;
nsCOMPtr<T> ptr(std::move(aOther));
{
MutexAutoLock lock(mMutex);
ptr.swap(mPtr);
if (aOther) {
mPtr = *aOther;
}
}
if (ptr) {

Просмотреть файл

@ -734,10 +734,10 @@ HttpChannelParent::WaitForBgParent()
registrar->LinkHttpChannel(mChannel->ChannelId(), this);
if (mBgParent) {
already_AddRefed<GenericPromise> promise = mPromise.Ensure(__func__);
RefPtr<GenericPromise> promise = mPromise.Ensure(__func__);
// resolve promise immediatedly if bg channel is ready.
mPromise.Resolve(true, __func__);
return promise;
return promise.forget();
}
return mPromise.Ensure(__func__);;