Bug 1465924 - Add a new optional property called "processName" to profile.meta which contains "Main Process" in the parent process and a content process name like "WebExtensions" for special content processes, see ContentChild::RecvRemoteType. r?gregtatum
This field is in addition to the two existing process type fields we already have:
- profile.meta.processType contains the integer value of the GeckoProcessType enum for the process.
- profile.threads[i].processType contains the string for that GeckoProcessType.
MozReview-Commit-ID: 3Pg6M1D6uDf
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -47,16 +47,17 @@
#include "mozilla/MathAlgorithms.h"
#include "mozilla/Scheduler.h"
#include "mozilla/StackWalk.h"
#include "mozilla/StaticPtr.h"
#include "mozilla/SystemGroup.h"
#include "mozilla/ThreadLocal.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/Tuple.h"
+#include "mozilla/dom/ContentChild.h"
#include "mozilla/extensions/WebExtensionPolicy.h"
#include "ThreadInfo.h"
#include "nsIHttpProtocolHandler.h"
#include "nsIObserverService.h"
#include "nsIXULAppInfo.h"
#include "nsIXULRuntime.h"
#include "nsDirectoryServiceUtils.h"
#include "nsDirectoryServiceDefs.h"
@@ -1679,16 +1680,28 @@ StreamMetaJSCustomObject(PSLockRef aLock
aWriter.IntProperty("gcpoison", JS::IsGCPoisoning() ? 1 : 0);
bool asyncStacks = Preferences::GetBool("javascript.options.asyncstack");
aWriter.IntProperty("asyncstack", asyncStacks);
aWriter.IntProperty("processType", XRE_GetProcessType());
+ nsAutoCString processName;
+ if (XRE_IsParentProcess()) {
+ // We're the main process.
+ processName.AssignLiteral("Main Process");
+ } else if (dom::ContentChild* cc = dom::ContentChild::GetSingleton()) {
+ // Try to get the process name from ContentChild.
+ cc->GetProcessName(processName);
+ }
+ if (!processName.IsEmpty()) {
+ aWriter.StringProperty("processName", processName.Data());
+ }
+
nsresult res;
nsCOMPtr<nsIHttpProtocolHandler> http =
do_GetService(NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "http", &res);
if (!NS_FAILED(res)) {
nsAutoCString string;
res = http->GetPlatform(string);