2013-09-25 19:28:34 +04:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#include "ProfilerBacktrace.h"
|
|
|
|
|
2015-05-12 00:16:44 +03:00
|
|
|
#include "ProfileJSONWriter.h"
|
2015-03-17 01:01:00 +03:00
|
|
|
#include "SyncProfile.h"
|
2014-04-22 00:48:47 +04:00
|
|
|
|
2013-09-25 19:28:34 +04:00
|
|
|
ProfilerBacktrace::ProfilerBacktrace(SyncProfile* aProfile)
|
|
|
|
: mProfile(aProfile)
|
|
|
|
{
|
2014-09-16 23:35:55 +04:00
|
|
|
MOZ_COUNT_CTOR(ProfilerBacktrace);
|
2013-09-25 19:28:34 +04:00
|
|
|
MOZ_ASSERT(aProfile);
|
|
|
|
}
|
|
|
|
|
|
|
|
ProfilerBacktrace::~ProfilerBacktrace()
|
|
|
|
{
|
2014-09-16 23:35:55 +04:00
|
|
|
MOZ_COUNT_DTOR(ProfilerBacktrace);
|
2013-09-25 19:28:34 +04:00
|
|
|
if (mProfile->ShouldDestroy()) {
|
|
|
|
delete mProfile;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2014-04-22 00:48:47 +04:00
|
|
|
void
|
2015-05-12 00:16:44 +03:00
|
|
|
ProfilerBacktrace::StreamJSON(SpliceableJSONWriter& aWriter,
|
|
|
|
UniqueStacks& aUniqueStacks)
|
2013-09-25 19:28:34 +04:00
|
|
|
{
|
2017-01-25 06:34:25 +03:00
|
|
|
mozilla::MutexAutoLock lock(mProfile->GetMutex());
|
2015-05-12 00:16:44 +03:00
|
|
|
mProfile->StreamJSON(aWriter, aUniqueStacks);
|
2013-09-25 19:28:34 +04:00
|
|
|
}
|