Bug 1238121 - Properly guard Profiler's RAII classes r=BenWa f=mystor

We can't use GuardObjects easily on the printf variant as va_list args and
default args can't play together.
This commit is contained in:
Chris H-C 2016-01-28 09:19:00 +01:00
parent 04b7223d4b
commit a249626ef5

View File

@ -411,23 +411,26 @@ protected:
const char* mInfo;
};
class MOZ_STACK_CLASS SamplerStackFrameRAII {
class MOZ_RAII SamplerStackFrameRAII {
public:
// we only copy the strings at save time, so to take multiple parameters we'd need to copy them then.
SamplerStackFrameRAII(const char *aInfo,
js::ProfileEntry::Category aCategory, uint32_t line)
js::ProfileEntry::Category aCategory, uint32_t line
MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
{
MOZ_GUARD_OBJECT_NOTIFIER_INIT;
mHandle = mozilla_sampler_call_enter(aInfo, aCategory, this, false, line);
}
~SamplerStackFrameRAII() {
mozilla_sampler_call_exit(mHandle);
}
private:
MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
void* mHandle;
};
static const int SAMPLER_MAX_STRING = 128;
class MOZ_STACK_CLASS SamplerStackFramePrintfRAII {
class MOZ_RAII SamplerStackFramePrintfRAII {
public:
// we only copy the strings at save time, so to take multiple parameters we'd need to copy them then.
SamplerStackFramePrintfRAII(const char *aInfo,