Bug 1355123 - Initialize gecko profiler properly for IPDL test runner. r=mstange,njn
authorKan-Ru Chen <kanru@kanru.info>
Mon, 10 Apr 2017 13:35:44 -0400
changeset 400555 edef97549a8c8121512dc034b280c444495bb2f5
parent 400554 a848eff50b88dfee45d116613e07d4f5db210a76
child 400556 d6697d89d054deadede94ded4857fa50e5ccef02
push id7391
push usermtabara@mozilla.com
push dateMon, 12 Jun 2017 13:08:53 +0000
treeherdermozilla-beta@2191d7f87e2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmstange, njn
bugs1355123
milestone55.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1355123 - Initialize gecko profiler properly for IPDL test runner. r=mstange,njn MozReview-Commit-ID: C9hkZPj3SVL
toolkit/xre/nsEmbedFunctions.cpp
tools/profiler/core/platform.cpp
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -765,16 +765,22 @@ XRE_InitParentProcess(int aArgc,
                       char* aArgv[],
                       MainFunction aMainFunction,
                       void* aMainFunctionData)
 {
   NS_ENSURE_ARG_MIN(aArgc, 1);
   NS_ENSURE_ARG_POINTER(aArgv);
   NS_ENSURE_ARG_POINTER(aArgv[0]);
 
+  // Set main thread before we initialize the profiler
+  NS_SetMainThread();
+
+  char aLocal;
+  GeckoProfilerInitRAII profiler(&aLocal);
+
   ScopedXREEmbed embed;
 
   gArgc = aArgc;
   gArgv = aArgv;
   nsresult rv = XRE_InitCommandLine(gArgc, gArgv);
   if (NS_FAILED(rv))
       return NS_ERROR_FAILURE;
 
--- a/tools/profiler/core/platform.cpp
+++ b/tools/profiler/core/platform.cpp
@@ -1976,17 +1976,16 @@ locked_profiler_start(PS::LockRef aLock,
                       const char** aFeatures, uint32_t aFeatureCount,
                       const char** aThreadNameFilters, uint32_t aFilterCount);
 
 void
 profiler_init(void* aStackTop)
 {
   LOG("profiler_init");
 
-  MOZ_RELEASE_ASSERT(NS_IsMainThread());
   MOZ_RELEASE_ASSERT(!gPS);
 
   const char* features[] = { "js"
 #if defined(PROFILE_JAVA)
                            , "java"
 #endif
                            , "leaf"
 #if defined(HAVE_NATIVE_UNWIND)