зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
846d8789ee
Коммит
b500bde65b
|
@ -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__);;
|
||||
|
|
Загрузка…
Ссылка в новой задаче