Bug 1417976 - Part 3: Stream the DocShell list and DocShellId marker data to profile data r?mstange
MozReview-Commit-ID: G2s5H8i4p6E
--- a/tools/profiler/core/ProfilerMarkerPayload.cpp
+++ b/tools/profiler/core/ProfilerMarkerPayload.cpp
@@ -31,16 +31,19 @@ ProfilerMarkerPayload::StreamCommonProps
SpliceableJSONWriter& aWriter,
const TimeStamp& aProcessStartTime,
UniqueStacks& aUniqueStacks)
{
MOZ_ASSERT(aMarkerType);
aWriter.StringProperty("type", aMarkerType);
WriteTime(aWriter, aProcessStartTime, mStartTime, "startTime");
WriteTime(aWriter, aProcessStartTime, mEndTime, "endTime");
+ if (mDocShellId) {
+ aWriter.StringProperty("docshellId", mDocShellId->ToString());
+ }
if (mStack) {
aWriter.StartObjectProperty("stack");
{
mStack->StreamJSON(aWriter, aProcessStartTime, aUniqueStacks);
}
aWriter.EndObject();
}
}
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -1827,16 +1827,30 @@ StreamMetaJSCustomObject(PSLockRef aLock
}
}
aWriter.EndArray();
}
}
aWriter.EndObject();
}
+static void
+StreamDocshell(PSLockRef aLock, SpliceableJSONWriter& aWriter)
+{
+ MOZ_RELEASE_ASSERT(CorePS::Exists());
+
+ aWriter.StartObjectElement();
+ {
+ for (auto& docshell : CorePS::GetRegisteredDocShells(aLock)) {
+ docshell->AppendElement(aWriter);
+ }
+ }
+ aWriter.EndObject();
+}
+
#if defined(GP_OS_android)
static UniquePtr<ProfileBuffer>
CollectJavaThreadProfileData()
{
// locked_profiler_start uses sample count is 1000 for Java thread.
// This entry size is enough now, but we might have to estimate it
// if we can customize it
auto buffer = MakeUnique<ProfileBuffer>(1000 * 1000);
@@ -1887,16 +1901,23 @@ locked_profiler_stream_json_for_this_pro
// Put meta data
aWriter.StartObjectProperty("meta");
{
StreamMetaJSCustomObject(aLock, aWriter, aIsShuttingDown);
}
aWriter.EndObject();
+ // Put docshell data
+ aWriter.StartArrayProperty("docshells");
+ {
+ StreamDocshell(aLock, aWriter);
+ }
+ aWriter.EndArray();
+
// Data of TaskTracer doesn't belong in the circular buffer.
if (ActivePS::FeatureTaskTracer(aLock)) {
aWriter.StartObjectProperty("tasktracer");
StreamTaskTracer(aLock, aWriter);
aWriter.EndObject();
}
// Lists the samples for each thread profile