Bug 1414318 - Turn off |StartWriter| in leak checking builds. r=mccr8
authorEric Rahm <erahm@mozilla.com>
Fri, 03 Nov 2017 14:17:57 -0700
changeset 393118 90a3dbed251b8afaecaff3f32fb584b98ea29c02
parent 393117 f573a266230f7007fab88d2fcfb4b6588d1b91a7
child 393119 fec67e7c728dc4783bb1c59d58d0fcb082c8032b
push id32954
push usershindli@mozilla.com
push dateWed, 22 Nov 2017 21:30:30 +0000
treeherdermozilla-central@960f50c2e0a9 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmccr8
bugs1414318
milestone59.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 1414318 - Turn off |StartWriter| in leak checking builds. r=mccr8
toolkit/components/terminator/nsTerminator.cpp
toolkit/components/terminator/tests/xpcshell/xpcshell.ini
--- a/toolkit/components/terminator/nsTerminator.cpp
+++ b/toolkit/components/terminator/nsTerminator.cpp
@@ -231,17 +231,18 @@ void RunWriter(void* arg)
   NS_SetCurrentThreadName("Shutdown Statistics Writer");
 
   MOZ_LSAN_INTENTIONALLY_LEAK_OBJECT(arg);
   // Shutdown will generally complete before we have a chance to
   // deallocate. This is not a leak.
 
   // Setup destinationPath and tmpFilePath
 
-  nsCString destinationPath(static_cast<char*>(arg));
+  nsCString destinationPath;
+  destinationPath.Adopt(static_cast<char*>(arg));
   nsAutoCString tmpFilePath;
   tmpFilePath.Append(destinationPath);
   tmpFilePath.AppendLiteral(".tmp");
 
   // Cleanup any file leftover from a previous run
   Unused << PR_Delete(tmpFilePath.get());
   Unused << PR_Delete(destinationPath.get());
 
@@ -364,22 +365,22 @@ nsTerminator::SelfInit()
 }
 
 // Actually launch these threads. This takes place at the first sign of shutdown.
 void
 nsTerminator::Start()
 {
   MOZ_ASSERT(!mInitialized);
   StartWatchdog();
-#if !defined(DEBUG)
-  // Only allow nsTerminator to write on non-debug builds so we don't get leak warnings on
-  // shutdown for intentional leaks (see bug 1242084). This will be enabled again by bug
-  // 1255484 when 1255478 lands.
+#if !defined(NS_FREE_PERMANENT_DATA)
+  // Only allow nsTerminator to write on non-leak-checked builds so we don't
+  // get leak warnings on shutdown for intentional leaks (see bug 1242084).
+  // This will be enabled again by bug 1255484 when 1255478 lands.
   StartWriter();
-#endif // !defined(DEBUG)
+#endif // !defined(NS_FREE_PERMANENT_DATA)
   mInitialized = true;
 }
 
 // Prepare, allocate and start the watchdog thread.
 // By design, it will never finish, nor be deallocated.
 void
 nsTerminator::StartWatchdog()
 {
@@ -458,22 +459,22 @@ nsTerminator::Observe(nsISupports *, con
   // As we have seen examples in the wild of shutdown notifications
   // not being sent (or not being sent in the expected order), we do
   // not assume a specific order.
   if (!mInitialized) {
     Start();
   }
 
   UpdateHeartbeat(aTopic);
-#if !defined(DEBUG)
-  // Only allow nsTerminator to write on non-debug builds so we don't get leak warnings on
+#if !defined(NS_FREE_PERMANENT_DATA)
+  // Only allow nsTerminator to write on non-leak checked builds so we don't get leak warnings on
   // shutdown for intentional leaks (see bug 1242084). This will be enabled again by bug
   // 1255484 when 1255478 lands.
   UpdateTelemetry();
-#endif // !defined(DEBUG)
+#endif // !defined(NS_FREE_PERMANENT_DATA)
   UpdateCrashReport(aTopic);
 
   // Perform a little cleanup
   nsCOMPtr<nsIObserverService> os = mozilla::services::GetObserverService();
   MOZ_RELEASE_ASSERT(os);
   (void)os->RemoveObserver(this, aTopic);
 
   return NS_OK;
--- a/toolkit/components/terminator/tests/xpcshell/xpcshell.ini
+++ b/toolkit/components/terminator/tests/xpcshell/xpcshell.ini
@@ -1,7 +1,7 @@
 [DEFAULT]
 head=
 
 [test_terminator_record.js]
-skip-if = debug # Disabled by bug 1242084, bug 1255484 will enable it again.
+skip-if = debug || asan # Disabled by bug 1242084, bug 1255484 will enable it again.
 [test_terminator_reload.js]
 skip-if = os == "android"