Bug 1367416 - Read ahead DLLs on a background thread r=jimm

This also reads the dlls for bug 1362382 and bug 1360167.

MozReview-Commit-ID: A0qVw6BnohC

--HG--
extra : rebase_source : ac4c12cf8eedbbbea18bb1b21f4994fe0caaeb89
This commit is contained in:
Adam Gashlin 2017-08-02 11:18:52 -07:00
parent 53021c2bb8
commit 414b33cce2

View File

@ -3711,6 +3711,27 @@ AnnotateLSBRelease(void*)
#endif
#ifdef XP_WIN
static void ReadAheadDll(const wchar_t* dllName) {
wchar_t dllPath[MAX_PATH];
if (ConstructSystem32Path(dllName, dllPath, MAX_PATH)) {
ReadAheadLib(dllPath);
}
}
static void PR_CALLBACK ReadAheadDlls_ThreadStart(void *) {
// Load DataExchange.dll and twinapi.appcore.dll for nsWindow::EnableDragDrop
ReadAheadDll(L"DataExchange.dll");
ReadAheadDll(L"twinapi.appcore.dll");
// Load twinapi.dll for WindowsUIUtils::UpdateTabletModeState
ReadAheadDll(L"twinapi.dll");
// Load explorerframe.dll for WinTaskbar::Initialize
ReadAheadDll(L"ExplorerFrame.dll");
}
#endif
namespace mozilla {
ShutdownChecksMode gShutdownChecks = SCM_NOTHING;
} // namespace mozilla
@ -4339,6 +4360,15 @@ XREMain::XRE_mainRun()
(do_GetService(NS_APPSTARTUP_CONTRACTID));
NS_ENSURE_TRUE(appStartup, NS_ERROR_FAILURE);
#ifdef XP_WIN
if (!PR_GetEnv("XRE_NO_DLL_READAHEAD"))
{
PR_CreateThread(PR_USER_THREAD, ReadAheadDlls_ThreadStart, 0, PR_PRIORITY_LOW,
PR_GLOBAL_THREAD, PR_UNJOINABLE_THREAD, 0);
}
#endif
if (gDoMigration) {
nsCOMPtr<nsIFile> file;
mDirProvider.GetAppDir()->Clone(getter_AddRefs(file));