Bug 1534878 - xpcom: Rename NS_InitXPCOM2() to NS_InitXPCOM(). r=froydnj
authorChris Peterson <cpeterson@mozilla.com>
Thu, 14 Mar 2019 23:38:09 -0700
changeset 464367 124ee436c421
parent 464366 ecf117f6a9b7
child 464368 d3f3cada7e58
child 464484 1b9bfa6dab28
push id35714
push userapavel@mozilla.com
push dateSat, 16 Mar 2019 09:47:26 +0000
treeherdermozilla-central@124ee436c421 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1534878
milestone67.0a1
first release with
nightly linux32
124ee436c421 / 67.0a1 / 20190316094726 / files
nightly linux64
124ee436c421 / 67.0a1 / 20190316094726 / files
nightly mac
124ee436c421 / 67.0a1 / 20190316094726 / files
nightly win32
124ee436c421 / 67.0a1 / 20190316094726 / files
nightly win64
124ee436c421 / 67.0a1 / 20190316094726 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1534878 - xpcom: Rename NS_InitXPCOM2() to NS_InitXPCOM(). r=froydnj
dom/system/OSFileConstants.cpp
js/xpconnect/src/XPCShellImpl.cpp
layout/style/test/ParseCSS.cpp
layout/style/test/TestCSSPropertyLookup.cpp
toolkit/xre/nsAppRunner.cpp
toolkit/xre/nsEmbedFunctions.cpp
tools/fuzzing/interface/harness/FuzzerTestHarness.h
xpcom/base/nsSystemInfo.cpp
xpcom/base/nsSystemInfo.h
xpcom/build/XPCOMInit.cpp
xpcom/build/nsXPCOM.h
xpcom/io/nsDirectoryServiceDefs.h
xpcom/tests/RegFactory.cpp
xpcom/tests/TestHarness.h
xpcom/tests/TestShutdown.cpp
xpcom/tests/TestStreamUtils.cpp
xpcom/tests/windows/TestHelloXPLoop.cpp
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -218,17 +218,17 @@ nsresult OSFileConstantsService::InitOSF
 
   GetPathToSpecialDir(NS_OS_TEMP_DIR, paths->tmpDir);
 
   mPaths = std::move(paths);
 
   // Get the umask from the system-info service.
   // The property will always be present, but it will be zero on
   // non-Unix systems.
-  // nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM2 so we don't need
+  // nsSystemInfo::gUserUmask is initialized by NS_InitXPCOM so we don't need
   // to initialize the service.
   mUserUmask = nsSystemInfo::gUserUmask;
 
   mInitialized = true;
   return NS_OK;
 }
 
 /**
--- a/js/xpconnect/src/XPCShellImpl.cpp
+++ b/js/xpconnect/src/XPCShellImpl.cpp
@@ -1228,19 +1228,19 @@ int XRE_XPCShellMain(int argc, char** ar
       }
 
       XRE_InitOmnijar(greOmni, appOmni);
       argc -= 2;
       argv += 2;
     }
 
     nsCOMPtr<nsIServiceManager> servMan;
-    rv = NS_InitXPCOM2(getter_AddRefs(servMan), appDir, &dirprovider);
+    rv = NS_InitXPCOM(getter_AddRefs(servMan), appDir, &dirprovider);
     if (NS_FAILED(rv)) {
-      printf("NS_InitXPCOM2 failed!\n");
+      printf("NS_InitXPCOM failed!\n");
       return 1;
     }
 
     // xpc::ErrorReport::LogToConsoleWithStack needs this to print errors
     // to stderr.
     Preferences::SetBool("browser.dom.window.dump.enabled", true);
     Preferences::SetBool("devtools.console.stdout.chrome", true);
 
--- a/layout/style/test/ParseCSS.cpp
+++ b/layout/style/test/ParseCSS.cpp
@@ -52,17 +52,17 @@ static int ParseCSSFile(nsIURI *aSheetUR
   if (!complete) return -2;
   return 0;
 }
 
 int main(int argc, char **argv) {
   if (argc < 2) {
     fprintf(stderr, "%s [FILE]...\n", argv[0]);
   }
-  nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
+  nsresult rv = NS_InitXPCOM(nullptr, nullptr, nullptr);
   if (NS_FAILED(rv)) return (int)rv;
 
   int res = 0;
   for (int i = 1; i < argc; ++i) {
     const char *filename = argv[i];
 
     printf("\nParsing %s.\n", filename);
 
--- a/layout/style/test/TestCSSPropertyLookup.cpp
+++ b/layout/style/test/TestCSSPropertyLookup.cpp
@@ -79,17 +79,17 @@ bool TestKeywords() {
     }
   }
 
   nsCSSKeywords::ReleaseTable();
   return success;
 }
 
 int main(void) {
-  nsresult rv = NS_InitXPCOM2(nullptr, nullptr, nullptr);
+  nsresult rv = NS_InitXPCOM(nullptr, nullptr, nullptr);
   NS_ENSURE_SUCCESS(rv, 2);
 
   bool testOK = true;
   testOK &= TestProps();
   testOK &= TestKeywords();
 
   rv = NS_ShutdownXPCOM(nullptr);
   NS_ENSURE_SUCCESS(rv, 2);
--- a/toolkit/xre/nsAppRunner.cpp
+++ b/toolkit/xre/nsAppRunner.cpp
@@ -1288,18 +1288,18 @@ static const mozilla::Module kXREModule 
 
 NSMODULE_DEFN(Apprunner) = &kXREModule;
 
 nsresult ScopedXPCOMStartup::Initialize() {
   NS_ASSERTION(gDirServiceProvider, "Should not get here!");
 
   nsresult rv;
 
-  rv = NS_InitXPCOM2(&mServiceManager, gDirServiceProvider->GetAppDir(),
-                     gDirServiceProvider);
+  rv = NS_InitXPCOM(&mServiceManager, gDirServiceProvider->GetAppDir(),
+                    gDirServiceProvider);
   if (NS_FAILED(rv)) {
     NS_ERROR("Couldn't start xpcom!");
     mServiceManager = nullptr;
   } else {
 #ifdef DEBUG
     nsCOMPtr<nsIComponentRegistrar> reg = do_QueryInterface(mServiceManager);
     NS_ASSERTION(reg, "Service Manager doesn't QI to Registrar.");
 #endif
--- a/toolkit/xre/nsEmbedFunctions.cpp
+++ b/toolkit/xre/nsEmbedFunctions.cpp
@@ -185,17 +185,17 @@ nsresult XRE_InitEmbedding2(nsIFile* aLi
 
   new nsXREDirProvider;  // This sets gDirServiceProvider
   if (!gDirServiceProvider) return NS_ERROR_OUT_OF_MEMORY;
 
   rv = gDirServiceProvider->Initialize(aAppDirectory, aLibXULDirectory,
                                        aAppDirProvider);
   if (NS_FAILED(rv)) return rv;
 
-  rv = NS_InitXPCOM2(nullptr, aAppDirectory, gDirServiceProvider);
+  rv = NS_InitXPCOM(nullptr, aAppDirectory, gDirServiceProvider);
   if (NS_FAILED(rv)) return rv;
 
   // We do not need to autoregister components here. The CheckCompatibility()
   // bits in nsAppRunner.cpp check for an invalidation flag in
   // compatibility.ini.
   // If the app wants to autoregister every time (for instance, if it's debug),
   // it can do so after we return from this function.
 
--- a/tools/fuzzing/interface/harness/FuzzerTestHarness.h
+++ b/tools/fuzzing/interface/harness/FuzzerTestHarness.h
@@ -62,19 +62,19 @@ class ScopedXPCOM : public nsIDirectoryS
   NS_DECL_ISUPPORTS
 
   explicit ScopedXPCOM(const char *testName,
                        nsIDirectoryServiceProvider *dirSvcProvider = nullptr)
       : mDirSvcProvider(dirSvcProvider) {
     mTestName = testName;
     printf("Running %s tests...\n", mTestName);
 
-    nsresult rv = NS_InitXPCOM2(&mServMgr, nullptr, this);
+    nsresult rv = NS_InitXPCOM(&mServMgr, nullptr, this);
     if (NS_FAILED(rv)) {
-      fail("NS_InitXPCOM2 returned failure code 0x%" PRIx32,
+      fail("NS_InitXPCOM returned failure code 0x%" PRIx32,
            static_cast<uint32_t>(rv));
       mServMgr = nullptr;
       return;
     }
   }
 
   ~ScopedXPCOM() {
     // If we created a profile directory, we need to remove it.
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -61,17 +61,17 @@
 #ifdef XP_MACOSX
 #  include <sys/sysctl.h>
 #endif
 
 #if defined(XP_LINUX) && defined(MOZ_SANDBOX)
 #  include "mozilla/SandboxInfo.h"
 #endif
 
-// Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init.
+// Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init.
 // Only set to nonzero (potentially) if XP_UNIX.  On such systems, the
 // system call to discover the appropriate value is not thread-safe,
 // so we must call it before going multithreaded, but nsSystemInfo::Init
 // only happens well after that point.
 uint32_t nsSystemInfo::gUserUmask = 0;
 
 using namespace mozilla::dom;
 
--- a/xpcom/base/nsSystemInfo.h
+++ b/xpcom/base/nsSystemInfo.h
@@ -27,18 +27,18 @@ class nsSystemInfo final : public nsHash
   NS_DECL_ISUPPORTS_INHERITED
   NS_DECL_NSIOBSERVER
 #endif  // defined(XP_WIN)
 
   nsSystemInfo();
 
   nsresult Init();
 
-  // Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init.
-  // See comments above the variable definition and in NS_InitXPCOM2.
+  // Slot for NS_InitXPCOM to pass information to nsSystemInfo::Init.
+  // See comments above the variable definition and in NS_InitXPCOM.
   static uint32_t gUserUmask;
 
 #ifdef MOZ_WIDGET_ANDROID
   static void GetAndroidSystemInfo(mozilla::dom::AndroidSystemInfo* aInfo);
 
  protected:
   void SetupAndroidInfo(const mozilla::dom::AndroidSystemInfo&);
 #endif
--- a/xpcom/build/XPCOMInit.cpp
+++ b/xpcom/build/XPCOMInit.cpp
@@ -263,18 +263,18 @@ NS_IMPL_ISUPPORTS(OggReporter, nsIMemory
 /* static */ template <>
 CountingAllocatorBase<OggReporter>::AmountType
     CountingAllocatorBase<OggReporter>::sAmount(0);
 
 static bool sInitializedJS = false;
 
 // Note that on OSX, aBinDirectory will point to .app/Contents/Resources/browser
 EXPORT_XPCOM_API(nsresult)
-NS_InitXPCOM2(nsIServiceManager** aResult, nsIFile* aBinDirectory,
-              nsIDirectoryServiceProvider* aAppFileLocationProvider) {
+NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
+            nsIDirectoryServiceProvider* aAppFileLocationProvider) {
   static bool sInitialized = false;
   if (sInitialized) {
     return NS_ERROR_FAILURE;
   }
 
   sInitialized = true;
 
   mozPoisonValueInit();
--- a/xpcom/build/nsXPCOM.h
+++ b/xpcom/build/nsXPCOM.h
@@ -68,18 +68,18 @@ struct Module;
  *
  * @return NS_OK for success;
  *         NS_ERROR_NOT_INITIALIZED if static globals were not initialized,
  *         which can happen if XPCOM is reloaded, but did not completly
  *         shutdown. Other error codes indicate a failure during
  *         initialisation.
  */
 XPCOM_API(nsresult)
-NS_InitXPCOM2(nsIServiceManager** aResult, nsIFile* aBinDirectory,
-              nsIDirectoryServiceProvider* aAppFileLocationProvider);
+NS_InitXPCOM(nsIServiceManager** aResult, nsIFile* aBinDirectory,
+             nsIDirectoryServiceProvider* aAppFileLocationProvider);
 
 /**
  * Initialize only minimal components of XPCOM. This ensures nsThreadManager,
  * logging, and timers will work.
  */
 XPCOM_API(nsresult)
 NS_InitMinimalXPCOM();
 
--- a/xpcom/io/nsDirectoryServiceDefs.h
+++ b/xpcom/io/nsDirectoryServiceDefs.h
@@ -35,17 +35,17 @@
 #define NS_OS_DESKTOP_DIR "Desk"
 
 /* Property returns the directory in which the procces was started from.
  */
 #define NS_OS_CURRENT_PROCESS_DIR "CurProcD"
 
 /* This location is similar to NS_OS_CURRENT_PROCESS_DIR, however,
  * NS_XPCOM_CURRENT_PROCESS_DIR can be overriden by passing a "bin
- * directory" to NS_InitXPCOM2().
+ * directory" to NS_InitXPCOM().
  */
 #define NS_XPCOM_CURRENT_PROCESS_DIR "XCurProcD"
 
 /* Property will return the location of the the XPCOM Shared Library.
  */
 #define NS_XPCOM_LIBRARY_FILE "XpcomLib"
 
 /* Property will return the current location of the GRE directory.
--- a/xpcom/tests/RegFactory.cpp
+++ b/xpcom/tests/RegFactory.cpp
@@ -96,17 +96,17 @@ int ProcessArgs(nsIComponentRegistrar *r
   return 0;
 }
 
 int main(int argc, char *argv[]) {
   int ret = 0;
   nsresult rv;
   {
     nsCOMPtr<nsIServiceManager> servMan;
-    rv = NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
+    rv = NS_InitXPCOM(getter_AddRefs(servMan), nullptr, nullptr);
     if (NS_FAILED(rv)) return -1;
     nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
     NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
 
     /* With no arguments, RegFactory will autoregister */
     if (argc <= 1) {
       rv = registrar->AutoRegister(nullptr);
       ret = (NS_FAILED(rv)) ? -1 : 0;
--- a/xpcom/tests/TestHarness.h
+++ b/xpcom/tests/TestHarness.h
@@ -77,19 +77,19 @@ class ScopedXPCOM : public nsIDirectoryS
   NS_DECL_ISUPPORTS
 
   explicit ScopedXPCOM(const char* testName,
                        nsIDirectoryServiceProvider* dirSvcProvider = nullptr)
       : mServMgr(nullptr), mDirSvcProvider(dirSvcProvider) {
     mTestName = testName;
     printf("Running %s tests...\n", mTestName);
 
-    nsresult rv = NS_InitXPCOM2(&mServMgr, nullptr, this);
+    nsresult rv = NS_InitXPCOM(&mServMgr, nullptr, this);
     if (NS_FAILED(rv)) {
-      fail("NS_InitXPCOM2 returned failure code 0x%" PRIx32,
+      fail("NS_InitXPCOM returned failure code 0x%" PRIx32,
            static_cast<uint32_t>(rv));
       mServMgr = nullptr;
       return;
     }
   }
 
   ~ScopedXPCOM() {
     // If we created a profile directory, we need to remove it.
--- a/xpcom/tests/TestShutdown.cpp
+++ b/xpcom/tests/TestShutdown.cpp
@@ -3,20 +3,19 @@
  * 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 "nsIServiceManager.h"
 
 // Gee this seems simple! It's for testing for memory leaks with Purify.
 
 void main(int argc, char* argv[]) {
-  nsresult rv;
   nsIServiceManager* servMgr;
-  rv = NS_InitXPCOM2(&servMgr, nullptr, nullptr);
-  NS_ASSERTION(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
+  nsresult rv = NS_InitXPCOM(&servMgr, nullptr, nullptr);
+  MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv), "NS_InitXPCOM failed");
 
   // try loading a component and releasing it to see if it leaks
   if (argc > 1 && argv[1] != nullptr) {
     char* cidStr = argv[1];
     nsISupports* obj = nullptr;
     if (cidStr[0] == '{') {
       nsCID cid;
       cid.Parse(cidStr);
@@ -29,10 +28,10 @@ void main(int argc, char* argv[]) {
       printf("Successfully created %s\n", cidStr);
       NS_RELEASE(obj);
     } else {
       printf("Failed to create %s (%x)\n", cidStr, rv);
     }
   }
 
   rv = NS_ShutdownXPCOM(servMgr);
-  NS_ASSERTION(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
+  MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv), "NS_ShutdownXPCOM failed");
 }
--- a/xpcom/tests/TestStreamUtils.cpp
+++ b/xpcom/tests/TestStreamUtils.cpp
@@ -46,17 +46,17 @@ static const struct Test {
   const char* name;
   TestFunc func;
 } tests[] = {DECL_TEST(test_consume_stream), {nullptr, nullptr}};
 
 int main(int argc, char** argv) {
   int count = 1;
   if (argc > 1) count = atoi(argv[1]);
 
-  if (NS_FAILED(NS_InitXPCOM2(nullptr, nullptr, nullptr))) return -1;
+  if (NS_FAILED(NS_InitXPCOM(nullptr, nullptr, nullptr))) return -1;
 
   while (count--) {
     for (const Test* t = tests; t->name != nullptr; ++t) {
       printf("%25s : %s\n", t->name, t->func() ? "SUCCESS" : "FAILURE");
     }
   }
 
   NS_ShutdownXPCOM(nullptr);
--- a/xpcom/tests/windows/TestHelloXPLoop.cpp
+++ b/xpcom/tests/windows/TestHelloXPLoop.cpp
@@ -27,17 +27,17 @@ int WINAPI WinMain(HINSTANCE inst, HINST
   char* lpszAppName = "HelloWorld";
   HWND wnd;
   WNDCLASSEX wndclass;
   int retCode;
 
   {  //  Needed to scope all nsCOMPtr within XPCOM Init and Shutdown
     nsresult rv;
     nsCOMPtr<nsIServiceManager> servMan;
-    rv = NS_InitXPCOM2(getter_AddRefs(servMan), nullptr, nullptr);
+    rv = NS_InitXPCOM(getter_AddRefs(servMan), nullptr, nullptr);
     if (NS_FAILED(rv)) {
       ErrorBox("Failed to initialize xpcom.");
       return -1;
     }
 
     nsCOMPtr<nsIComponentRegistrar> registrar = do_QueryInterface(servMan);
     NS_ASSERTION(registrar, "Null nsIComponentRegistrar");
     registrar->AutoRegister(nullptr);