Bug 1340928 (part 3) - Remove Sampler from ProfileGatherer. r=mstange.

It's only being used in a boolean fashion, so this patch replaces it with a
boolean.

--HG--
extra : rebase_source : 91152dff81107070fa49b3984e1b6759e0cd6d20
This commit is contained in:
Nicholas Nethercote 2017-02-15 14:44:12 +11:00
Родитель fba65fb101
Коммит a84399b3b5
3 изменённых файлов: 8 добавлений и 11 удалений

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

@ -2029,7 +2029,7 @@ profiler_start(int aProfileEntries, double aInterval,
}
#endif
gGatherer = new mozilla::ProfileGatherer(gSampler);
gGatherer = new mozilla::ProfileGatherer();
MOZ_ASSERT(!gIsActive && !gIsPaused);
PlatformStart();

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

@ -27,8 +27,8 @@ static const uint32_t MAX_SUBPROCESS_EXIT_PROFILES = 5;
NS_IMPL_ISUPPORTS(ProfileGatherer, nsIObserver)
ProfileGatherer::ProfileGatherer(Sampler* aSampler)
: mSampler(aSampler)
ProfileGatherer::ProfileGatherer()
: mIsCancelled(false)
, mSinceTime(0)
, mPendingProfiles(0)
, mGathering(false)
@ -145,7 +145,7 @@ ProfileGatherer::Finish()
{
MOZ_ASSERT(NS_IsMainThread());
if (!mSampler) {
if (mIsCancelled) {
// We somehow got called after we were cancelled! This shouldn't
// be possible, but doing a belt-and-suspenders check to be sure.
return;
@ -216,7 +216,7 @@ ProfileGatherer::Reset()
void
ProfileGatherer::Cancel()
{
// The Sampler is going away. If we have a Promise in flight, we should
// We're about to stop profiling. If we have a Promise in flight, we should
// reject it.
if (mPromise) {
mPromise->MaybeReject(NS_ERROR_DOM_ABORT_ERR);
@ -224,8 +224,7 @@ ProfileGatherer::Cancel()
mPromise = nullptr;
mFile = nullptr;
// Clear out the Sampler reference, since it's being destroyed.
mSampler = nullptr;
mIsCancelled = true;
}
void

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

@ -8,8 +8,6 @@
#include "mozilla/dom/Promise.h"
#include "nsIFile.h"
class Sampler;
namespace mozilla {
class ProfileGatherer final : public nsIObserver
@ -18,7 +16,7 @@ public:
NS_DECL_ISUPPORTS
NS_DECL_NSIOBSERVER
explicit ProfileGatherer(Sampler* aSampler);
explicit ProfileGatherer();
void WillGatherOOPProfile();
void GatheredOOPProfile();
void Start(double aSinceTime, mozilla::dom::Promise* aPromise);
@ -35,7 +33,7 @@ private:
nsTArray<nsCString> mExitProfiles;
RefPtr<mozilla::dom::Promise> mPromise;
nsCOMPtr<nsIFile> mFile;
Sampler* mSampler;
bool mIsCancelled;
double mSinceTime;
uint32_t mPendingProfiles;
bool mGathering;