diff --git a/tools/profiler/core/ProfileBufferEntry.cpp b/tools/profiler/core/ProfileBufferEntry.cpp index 0ea2db73a247..271922850ce4 100644 --- a/tools/profiler/core/ProfileBufferEntry.cpp +++ b/tools/profiler/core/ProfileBufferEntry.cpp @@ -868,19 +868,20 @@ ProfileBuffer::StreamSamplesToJSON(SpliceableJSONWriter& aWriter, int aThreadId, } strbuf[kMaxFrameKeyLength - 1] = '\0'; - UniqueStacks::FrameKey frameKey(strbuf.get()); - + Maybe 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 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++; diff --git a/tools/profiler/core/ProfileBufferEntry.h b/tools/profiler/core/ProfileBufferEntry.h index d1c1c395ebc4..4415bf0e798e 100644 --- a/tools/profiler/core/ProfileBufferEntry.h +++ b/tools/profiler/core/ProfileBufferEntry.h @@ -183,6 +183,14 @@ public: { } + FrameKey(const char* aLocation, const mozilla::Maybe& aLine, + const mozilla::Maybe& aCategory) + : mLocation(aLocation) + , mLine(aLine) + , mCategory(aCategory) + { + } + FrameKey(const JITAddress& aJITAddress, uint32_t aJITDepth) : mJITAddress(mozilla::Some(aJITAddress)) , mJITDepth(mozilla::Some(aJITDepth))