Bug 1373436 (part 2) - Use a UniquePtr for CorePS::mLul. r=mstange.

This commit is contained in:
Nicholas Nethercote 2017-06-16 10:30:35 +10:00
Родитель 8d89035364
Коммит 442ac55216
2 изменённых файлов: 8 добавлений и 8 удалений

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

@ -259,9 +259,9 @@ Sampler::Sampler(PSLockRef aLock)
bool createdLUL = false;
lul::LUL* lul = CorePS::Lul(aLock);
if (!lul) {
lul = new lul::LUL(logging_sink_for_LUL);
CorePS::SetLul(aLock, lul);
CorePS::SetLul(aLock, MakeUnique<lul::LUL>(logging_sink_for_LUL));
// Read all the unwind info currently available.
lul = CorePS::Lul(aLock);
read_procmaps(lul);
createdLUL = true;
}

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

@ -185,10 +185,6 @@ private:
delete mDeadThreads.back();
mDeadThreads.pop_back();
}
#if defined(USE_LUL_STACKWALK)
delete mLul;
#endif
}
public:
@ -243,7 +239,11 @@ public:
PS_GET(ThreadVector&, DeadThreads)
#ifdef USE_LUL_STACKWALK
PS_GET_AND_SET(lul::LUL*, Lul)
static lul::LUL* Lul(PSLockRef) { return sInstance->mLul.get(); }
static void SetLul(PSLockRef, UniquePtr<lul::LUL> aLul)
{
sInstance->mLul = Move(aLul);
}
#endif
private:
@ -263,7 +263,7 @@ private:
#ifdef USE_LUL_STACKWALK
// LUL's state. Null prior to the first activation, non-null thereafter.
lul::LUL* mLul;
UniquePtr<lul::LUL> mLul;
#endif
};