Bug 1067547 - add more uses of MOZ_COUNT_CTOR to tools/profiler; r?bsmedberg
MozReview-Commit-ID: 5Gf5OkydkL0
--- a/tools/profiler/core/ThreadInfo.cpp
+++ b/tools/profiler/core/ThreadInfo.cpp
@@ -16,28 +16,30 @@ ThreadInfo::ThreadInfo(const char* aName
, mThreadId(aThreadId)
, mIsMainThread(aIsMainThread)
, mPseudoStack(aPseudoStack)
, mPlatformData(Sampler::AllocPlatformData(aThreadId))
, mProfile(nullptr)
, mStackTop(aStackTop)
, mPendingDelete(false)
{
+ MOZ_COUNT_CTOR(ThreadInfo);
#ifndef SPS_STANDALONE
mThread = NS_GetCurrentThread();
#endif
// We don't have to guess on mac
#ifdef XP_MACOSX
pthread_t self = pthread_self();
mStackTop = pthread_get_stackaddr_np(self);
#endif
}
ThreadInfo::~ThreadInfo() {
+ MOZ_COUNT_DTOR(ThreadInfo);
free(mName);
if (mProfile)
delete mProfile;
Sampler::FreePlatformData(mPlatformData);
}
--- a/tools/profiler/core/platform-linux.cc
+++ b/tools/profiler/core/platform-linux.cc
@@ -272,17 +272,24 @@ static void ProfilerSignalThread(ThreadP
int tgkill(pid_t tgid, pid_t tid, int signalno) {
return syscall(SYS_tgkill, tgid, tid, signalno);
}
class PlatformData {
public:
PlatformData()
- {}
+ {
+ MOZ_COUNT_CTOR(PlatformData);
+ }
+
+ ~PlatformData()
+ {
+ MOZ_COUNT_DTOR(PlatformData);
+ }
};
/* static */ PlatformData*
Sampler::AllocPlatformData(int aThreadId)
{
return new PlatformData;
}
@@ -382,19 +389,21 @@ static void* SignalSender(void* arg) {
}
Sampler::Sampler(double interval, bool profiling, int entrySize)
: interval_(interval),
profiling_(profiling),
paused_(false),
active_(false),
entrySize_(entrySize) {
+ MOZ_COUNT_CTOR(Sampler);
}
Sampler::~Sampler() {
+ MOZ_COUNT_DTOR(Sampler);
ASSERT(!signal_sender_launched_);
}
void Sampler::Start() {
LOG("Sampler started");
#if defined(USE_EHABI_STACKWALK)
--- a/tools/profiler/public/PseudoStack.h
+++ b/tools/profiler/public/PseudoStack.h
@@ -371,20 +371,23 @@ public:
, mSleepIdObserved(0)
, mSleeping(false)
, mRefCnt(1)
#ifndef SPS_STANDALONE
, mContext(nullptr)
#endif
, mStartJSSampling(false)
, mPrivacyMode(false)
- { }
+ {
+ MOZ_COUNT_CTOR(PseudoStack);
+ }
// A PseudoStack can only be deleted via deref.
~PseudoStack() {
+ MOZ_COUNT_DTOR(PseudoStack);
if (mStackPointer != 0) {
// We're releasing the pseudostack while it's still in use.
// The label macros keep a non ref counted reference to the
// stack to avoid a TLS. If these are not all cleared we will
// get a use-after-free so better to crash now.
abort();
}
}