Files
firefox/tools/profiler/core/ProfilerBacktrace.cpp
T
Nicholas Nethercote 5f9f77b7cc Bug 1328378 (part 6) - Eliminate SyncProfile. r=mstange.
It's now a very thin wrapper around ThreadInfo, and so can be removed.

The patch also has the bonus of setting mIsMainThread correctly for the
ThreadInfos that used to be SyncProfiles (i.e. the ones created in
profiler_get_backtrace()). As far as I can tell this has only one very minor
effect, because that field is only used for those objects to determine how
ThreadResponsiveness::Update() dispatches its runnables.
2017-02-27 12:56:42 +11:00

36 lines
1.1 KiB
C++

/* -*- 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"
#include "ProfileJSONWriter.h"
#include "ThreadInfo.h"
ProfilerBacktrace::ProfilerBacktrace(ProfileBuffer* aBuffer,
ThreadInfo* aThreadInfo)
: mBuffer(aBuffer)
, mThreadInfo(aThreadInfo)
{
MOZ_COUNT_CTOR(ProfilerBacktrace);
MOZ_ASSERT(aThreadInfo && aThreadInfo->HasProfile());
}
ProfilerBacktrace::~ProfilerBacktrace()
{
MOZ_COUNT_DTOR(ProfilerBacktrace);
delete mBuffer;
delete mThreadInfo;
}
void
ProfilerBacktrace::StreamJSON(SpliceableJSONWriter& aWriter,
UniqueStacks& aUniqueStacks)
{
mozilla::MutexAutoLock lock(mThreadInfo->GetMutex());
mThreadInfo->StreamSamplesAndMarkers(mBuffer, aWriter, /* aSinceTime */ 0,
aUniqueStacks);
}