Bug 1429904 - Add another constructor to FrameKey which initializes mLine and mCategory, and use it in one place. r=njn

MozReview-Commit-ID: 1LliQMGjfjx

--HG--
extra : rebase_source : 82575f4dc270ac0dabccbe5cc667222f137ca8cc
This commit is contained in:
Markus Stange 2018-02-27 23:10:06 -05:00
parent 2927aca3f7
commit 89eae04310
2 changed files with 14 additions and 5 deletions

View File

@ -868,19 +868,20 @@ ProfileBuffer::StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId,
}
strbuf[kMaxFrameKeyLength - 1] = '\0';
UniqueStacks::FrameKey frameKey(strbuf.get());
Maybe<unsigned> line;
if (e.Has() && e.Get().IsLineNumber()) {
frameKey.mLine = Some(unsigned(e.Get().u.mInt));
line = Some(unsigned(e.Get().u.mInt));
e.Next();
}
Maybe<unsigned> category;
if (e.Has() && e.Get().IsCategory()) {
frameKey.mCategory = Some(unsigned(e.Get().u.mInt));
category = Some(unsigned(e.Get().u.mInt));
e.Next();
}
stack = aUniqueStacks.AppendFrame(stack, frameKey);
stack = aUniqueStacks.AppendFrame(
stack, UniqueStacks::FrameKey(strbuf.get(), line, category));
} else if (e.Get().IsJitReturnAddr()) {
numFrames++;

View File

@ -183,6 +183,14 @@ public:
{
}
FrameKey(const char* aLocation, const mozilla::Maybe<unsigned>& aLine,
const mozilla::Maybe<unsigned>& aCategory)
: mLocation(aLocation)
, mLine(aLine)
, mCategory(aCategory)
{
}
FrameKey(const JITAddress& aJITAddress, uint32_t aJITDepth)
: mJITAddress(mozilla::Some(aJITAddress))
, mJITDepth(mozilla::Some(aJITDepth))