Bug 1306327 - Remove XPCOMGlueEnablePreload. r=froydnj
authorMike Hommey <mh+mozilla@glandium.org>
Thu, 15 Dec 2016 17:37:53 +0900
changeset 462786 b92d791582e5bbee2a681e48b6901cf601c35164
parent 462785 64dcf6b92394480d0546657f3615a31a24c0f3b4
child 462787 398e907e9a9c44b7ff525b2199cb81cea7695f75
push id41857
push userbmo:mh+mozilla@glandium.org
push dateWed, 18 Jan 2017 00:24:11 +0000
reviewersfroydnj
bugs1306327, 632404, 771745
milestone53.0a1
Bug 1306327 - Remove XPCOMGlueEnablePreload. r=froydnj Back in bug 632404, when the function was added, preloading was conditional. But after some A/B testing, the conclusion in bug 771745 was that we would just do preloading unconditionally. Which means in practice, we don't need to have a function to enable it manually anymore, since we're always enabling it.
b2g/app/nsBrowserApp.cpp
browser/app/nsBrowserApp.cpp
xpcom/glue/standalone/nsXPCOMGlue.cpp
xpcom/glue/standalone/nsXPCOMGlue.h
--- a/b2g/app/nsBrowserApp.cpp
+++ b/b2g/app/nsBrowserApp.cpp
@@ -187,19 +187,16 @@ int main(int argc, char* argv[])
   // process group controller (the normal situation).
   (void)setsid();
 #endif
 
 #ifdef HAS_DLL_BLOCKLIST
   DllBlocklist_Initialize();
 #endif
 
-  // We do this because of data in bug 771745
-  XPCOMGlueEnablePreload();
-
   rv = XPCOMGlueStartup(exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XPCOM.\n");
     return 255;
   }
   // Reset exePath so that it is the directory name and not the xpcom dll name
   *lastSlash = 0;
 
--- a/browser/app/nsBrowserApp.cpp
+++ b/browser/app/nsBrowserApp.cpp
@@ -350,19 +350,16 @@ InitXPCOMGlue(const char *argv0, nsIFile
 
   strcpy(lastSlash + 1, XPCOM_DLL);
 
   if (!FileExists(exePath)) {
     Output("Could not find the Mozilla runtime.\n");
     return NS_ERROR_FAILURE;
   }
 
-  // We do this because of data in bug 771745
-  XPCOMGlueEnablePreload();
-
   rv = XPCOMGlueStartup(exePath);
   if (NS_FAILED(rv)) {
     Output("Couldn't load XPCOM.\n");
     return rv;
   }
 
   rv = XPCOMGlueLoadXULFunctions(kXULFuncs);
   if (NS_FAILED(rv)) {
--- a/xpcom/glue/standalone/nsXPCOMGlue.cpp
+++ b/xpcom/glue/standalone/nsXPCOMGlue.cpp
@@ -17,17 +17,16 @@
 #include "mozilla/FileUtils.h"
 #include "mozilla/Sprintf.h"
 
 using namespace mozilla;
 
 #define XPCOM_DEPENDENT_LIBS_LIST "dependentlibs.list"
 
 static XPCOMFunctions xpcomFunctions;
-static bool do_preload = false;
 
 #if defined(XP_WIN)
 #define READ_TEXTMODE L"rt"
 #else
 #define READ_TEXTMODE "r"
 #endif
 
 #if defined(XP_WIN)
@@ -141,36 +140,35 @@ AppendDependentLib(LibHandleType aLibHan
 
   d->next = sTop;
   d->libHandle = aLibHandle;
 
   sTop = d;
 }
 
 static bool
-ReadDependentCB(pathstr_t aDependentLib, bool aDoPreload)
+ReadDependentCB(pathstr_t aDependentLib)
 {
-  if (aDoPreload) {
-    ReadAheadLib(aDependentLib);
-  }
+  // We do this unconditionally because of data in bug 771745
+  ReadAheadLib(aDependentLib);
   LibHandleType libHandle = GetLibHandle(aDependentLib);
   if (libHandle) {
     AppendDependentLib(libHandle);
   }
 
   return libHandle;
 }
 
 #ifdef XP_WIN
 static bool
-ReadDependentCB(const char* aDependentLib, bool do_preload)
+ReadDependentCB(const char* aDependentLib)
 {
   wchar_t wideDependentLib[MAX_PATH];
   MultiByteToWideChar(CP_UTF8, 0, aDependentLib, -1, wideDependentLib, MAX_PATH);
-  return ReadDependentCB(wideDependentLib, do_preload);
+  return ReadDependentCB(wideDependentLib);
 }
 
 inline FILE*
 TS_tfopen(const char* path, const wchar_t* mode)
 {
   wchar_t wPath[MAX_PATH];
   MultiByteToWideChar(CP_UTF8, 0, path, -1, wPath, MAX_PATH);
   return _wfopen(wPath, mode);
@@ -315,17 +313,17 @@ XPCOMGlueLoad(const char* aXPCOMFile)
       buffer[l - 1] = '\0';
     }
 
     if (l + size_t(cursor - xpcomDir) > MAXPATHLEN) {
       return nullptr;
     }
 
     strcpy(cursor, buffer);
-    if (!ReadDependentCB(xpcomDir, do_preload)) {
+    if (!ReadDependentCB(xpcomDir)) {
       XPCOMGlueUnload();
       return nullptr;
     }
   }
 
   GetFrozenFunctionsFunc sym =
     (GetFrozenFunctionsFunc)GetSymbol(sTop->libHandle,
                                       "NS_GetFrozenFunctions");
@@ -354,22 +352,16 @@ XPCOMGlueLoadXULFunctions(const nsDynami
       rv = NS_ERROR_LOSS_OF_SIGNIFICANT_DATA;
     }
 
     ++aSymbols;
   }
   return rv;
 }
 
-void
-XPCOMGlueEnablePreload()
-{
-  do_preload = true;
-}
-
 #if defined(MOZ_WIDGET_GTK) && (defined(MOZ_MEMORY) || defined(__FreeBSD__) || defined(__NetBSD__))
 #define MOZ_GSLICE_INIT
 #endif
 
 #ifdef MOZ_GSLICE_INIT
 #include <glib.h>
 
 class GSliceInit {
--- a/xpcom/glue/standalone/nsXPCOMGlue.h
+++ b/xpcom/glue/standalone/nsXPCOMGlue.h
@@ -11,21 +11,16 @@
 
 #ifdef XPCOM_GLUE
 
 /**
  * The following functions are only available in the standalone glue.
  */
 
 /**
- * Enabled preloading of dynamically loaded libraries
- */
-extern "C" NS_HIDDEN_(void) XPCOMGlueEnablePreload();
-
-/**
  * Initialize the XPCOM glue by dynamically linking against the XPCOM
  * shared library indicated by xpcomFile.
  */
 extern "C" NS_HIDDEN_(nsresult) XPCOMGlueStartup(const char* aXPCOMFile);
 
 typedef void (*NSFuncPtr)();
 
 struct nsDynamicFunctionLoad