Bug 1407112 (part 1) - Merge nsPrefsFactory.cpp into Preferences.cpp. r=glandium.
authorNicholas Nethercote <nnethercote@mozilla.com>
Wed, 11 Oct 2017 19:03:23 +1100
changeset 385752 16941fa18f1c25cfde54978cefe95a52ed1ba8c4
parent 385751 73b85fa99b0c78bd6ed377bcae8c34b77f7990dc
child 385753 af42b728e0edce3b43e2f96ef68ba3ea05ececa1
push id32665
push userarchaeopteryx@coole-files.de
push dateThu, 12 Oct 2017 09:43:49 +0000
treeherdermozilla-central@191c4f1b5992 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1407112
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 1407112 (part 1) - Merge nsPrefsFactory.cpp into Preferences.cpp. r=glandium. MozReview-Commit-ID: V1tONOw0wT
modules/libpref/Preferences.cpp
modules/libpref/moz.build
modules/libpref/nsPrefsFactory.cpp
--- a/modules/libpref/Preferences.cpp
+++ b/modules/libpref/Preferences.cpp
@@ -5,16 +5,17 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 #include "GeckoProfiler.h"
 #include "mozilla/ArrayUtils.h"
 #include "mozilla/Attributes.h"
 #include "mozilla/dom/PContent.h"
 #include "mozilla/HashFunctions.h"
 #include "mozilla/MemoryReporting.h"
+#include "mozilla/ModuleUtils.h"
 #include "mozilla/Omnijar.h"
 #include "mozilla/Preferences.h"
 #include "mozilla/ResultExtensions.h"
 #include "mozilla/ScopeExit.h"
 #include "mozilla/ServoStyleSet.h"
 #include "mozilla/SyncRunnable.h"
 #include "mozilla/Telemetry.h"
 #include "mozilla/UniquePtrExtensions.h"
@@ -80,16 +81,20 @@ public:
   if (MOZ_UNLIKELY(!XRE_IsParentProcess())) {                                  \
     return NS_ERROR_NOT_AVAILABLE;                                             \
   }
 
 #define WATCHING_PREF_RAII()
 
 #endif // DEBUG
 
+//===========================================================================
+// Core prefs code
+//===========================================================================
+
 class PrefCallback;
 
 namespace mozilla {
 
 #define INITIAL_PREF_FILES 10
 
 static NS_DEFINE_CID(kZipReaderCID, NS_ZIPREADER_CID);
 
@@ -2296,8 +2301,56 @@ Preferences::GetDefaultType(const char* 
   return NS_SUCCEEDED(sDefaultRootBranch->GetPrefType(aPref, &result))
            ? result
            : nsIPrefBranch::PREF_INVALID;
 }
 
 } // namespace mozilla
 
 #undef ENSURE_MAIN_PROCESS
+
+//===========================================================================
+// Module and factory stuff
+//===========================================================================
+
+NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
+                                         Preferences::GetInstanceForService)
+NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
+NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref)
+
+static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
+static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
+static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
+
+static mozilla::Module::CIDEntry kPrefCIDs[] = {
+  { &kPrefServiceCID, true, nullptr, PreferencesConstructor },
+  { &kPrefLocalizedStringCID,
+    false,
+    nullptr,
+    nsPrefLocalizedStringConstructor },
+  { &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
+  { nullptr }
+};
+
+static mozilla::Module::ContractIDEntry kPrefContracts[] = {
+  { NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID },
+  { NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID },
+  { NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID },
+  // compatibility for extension that uses old service
+  { "@mozilla.org/preferences;1", &kPrefServiceCID },
+  { nullptr }
+};
+
+static void
+UnloadPrefsModule()
+{
+  Preferences::Shutdown();
+}
+
+static const mozilla::Module kPrefModule = { mozilla::Module::kVersion,
+                                             kPrefCIDs,
+                                             kPrefContracts,
+                                             nullptr,
+                                             nullptr,
+                                             nullptr,
+                                             UnloadPrefsModule };
+
+NSMODULE_DEFN(nsPrefModule) = &kPrefModule;
--- a/modules/libpref/moz.build
+++ b/modules/libpref/moz.build
@@ -25,17 +25,16 @@ XPIDL_SOURCES += [
 XPIDL_MODULE = 'pref'
 
 EXPORTS.mozilla += [
     'Preferences.h',
 ]
 
 UNIFIED_SOURCES += [
     'nsPrefBranch.cpp',
-    'nsPrefsFactory.cpp',
     'prefapi.cpp',
     'Preferences.cpp',
     'prefread.cpp',
 ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
deleted file mode 100644
--- a/modules/libpref/nsPrefsFactory.cpp
+++ /dev/null
@@ -1,55 +0,0 @@
-/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* This Source Code Form is subject to the terms of the Mozilla Public
- * License, v. 2.0. If a copy of the MPL was not distributed with this
- * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
-
-#include "mozilla/ModuleUtils.h"
-#include "mozilla/Preferences.h"
-#include "nsPrefBranch.h"
-#include "prefapi.h"
-
-using namespace mozilla;
-
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(Preferences,
-                                         Preferences::GetInstanceForService)
-NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsPrefLocalizedString, Init)
-NS_GENERIC_FACTORY_CONSTRUCTOR(nsRelativeFilePref)
-
-static NS_DEFINE_CID(kPrefServiceCID, NS_PREFSERVICE_CID);
-static NS_DEFINE_CID(kPrefLocalizedStringCID, NS_PREFLOCALIZEDSTRING_CID);
-static NS_DEFINE_CID(kRelativeFilePrefCID, NS_RELATIVEFILEPREF_CID);
-
-static mozilla::Module::CIDEntry kPrefCIDs[] = {
-  { &kPrefServiceCID, true, nullptr, PreferencesConstructor },
-  { &kPrefLocalizedStringCID,
-    false,
-    nullptr,
-    nsPrefLocalizedStringConstructor },
-  { &kRelativeFilePrefCID, false, nullptr, nsRelativeFilePrefConstructor },
-  { nullptr }
-};
-
-static mozilla::Module::ContractIDEntry kPrefContracts[] = {
-  { NS_PREFSERVICE_CONTRACTID, &kPrefServiceCID },
-  { NS_PREFLOCALIZEDSTRING_CONTRACTID, &kPrefLocalizedStringCID },
-  { NS_RELATIVEFILEPREF_CONTRACTID, &kRelativeFilePrefCID },
-  // compatibility for extension that uses old service
-  { "@mozilla.org/preferences;1", &kPrefServiceCID },
-  { nullptr }
-};
-
-static void
-UnloadPrefsModule()
-{
-  Preferences::Shutdown();
-}
-
-static const mozilla::Module kPrefModule = { mozilla::Module::kVersion,
-                                             kPrefCIDs,
-                                             kPrefContracts,
-                                             nullptr,
-                                             nullptr,
-                                             nullptr,
-                                             UnloadPrefsModule };
-
-NSMODULE_DEFN(nsPrefModule) = &kPrefModule;