Bug 1415799 - Inline and remove PREF_Cleanup. r=glandium
authorNicholas Nethercote <nnethercote@mozilla.com>
Thu, 09 Nov 2017 17:56:29 +1100
changeset 444411 1ecee4342b40b32f14a52e7396bc3aa121043d77
parent 444410 05a3c8d0c61a4a41bc735364082930d56b9eb18b
child 444412 1ac606e618639da441d54024dea61315d8f468b0
push id1618
push userCallek@gmail.com
push dateThu, 11 Jan 2018 17:45:48 +0000
treeherdermozilla-release@882ca853e05a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1415799
milestone58.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 1415799 - Inline and remove PREF_Cleanup. r=glandium It has a single call site. MozReview-Commit-ID: DoE5BlEA9a6
modules/libpref/Preferences.cpp
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -384,37 +384,16 @@ PREF_CleanupPrefs()
 {
   if (gHashTable) {
     delete gHashTable;
     gHashTable = nullptr;
     gPrefNameArena.Clear();
   }
 }
 
-// Frees the callback list. Should be called at program exit.
-static void
-PREF_Cleanup()
-{
-  NS_ASSERTION(!gCallbacksInProgress,
-               "PREF_Cleanup was called while gCallbacksInProgress is true!");
-
-  CallbackNode* node = gFirstCallback;
-  CallbackNode* next_node;
-
-  while (node) {
-    next_node = node->mNext;
-    free(const_cast<char*>(node->mDomain));
-    free(node);
-    node = next_node;
-  }
-  gLastPriorityNode = gFirstCallback = nullptr;
-
-  PREF_CleanupPrefs();
-}
-
 // Assign to aResult a quoted, escaped copy of aOriginal.
 static void
 StrEscape(const char* aOriginal, nsCString& aResult)
 {
   if (aOriginal == nullptr) {
     aResult.AssignLiteral("\"\"");
     return;
   }
@@ -3663,17 +3642,29 @@ Preferences::Preferences()
 
 Preferences::~Preferences()
 {
   MOZ_ASSERT(!sPreferences);
 
   delete gCacheData;
   gCacheData = nullptr;
 
-  PREF_Cleanup();
+  NS_ASSERTION(!gCallbacksInProgress,
+               "~Preferences was called while gCallbacksInProgress is true!");
+
+  CallbackNode* node = gFirstCallback;
+  while (node) {
+    CallbackNode* next_node = node->mNext;
+    free(const_cast<char*>(node->mDomain));
+    free(node);
+    node = next_node;
+  }
+  gLastPriorityNode = gFirstCallback = nullptr;
+
+  PREF_CleanupPrefs();
 }
 
 //
 // nsISupports Implementation
 //
 
 NS_IMPL_ADDREF(Preferences)
 NS_IMPL_RELEASE(Preferences)