diff --git a/browser/app/Makefile.in b/browser/app/Makefile.in index db8a00d87a82..dd3a89ffa6e1 100644 --- a/browser/app/Makefile.in +++ b/browser/app/Makefile.in @@ -185,8 +185,7 @@ endif ifeq ($(OS_ARCH),WINNT) OS_LIBS += $(call EXPAND_LIBNAME,comctl32 comdlg32 uuid shell32 ole32 oleaut32 version winspool) -OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32 delayimp) -LDFLAGS += -delayload:xul.dll -delayload:xpcom.dll -delayload:plc4.dll -delayload:nspr4.dll -delayload:mozalloc.dll +OS_LIBS += $(call EXPAND_LIBNAME,usp10 msimg32) endif ifeq ($(OS_ARCH),WINNT) diff --git a/browser/app/nsBrowserApp.cpp b/browser/app/nsBrowserApp.cpp index e0f034055fec..f8cbf7933824 100644 --- a/browser/app/nsBrowserApp.cpp +++ b/browser/app/nsBrowserApp.cpp @@ -56,7 +56,6 @@ #ifdef XP_WIN // we want to use the DLL blocklist if possible #define XRE_WANT_DLL_BLOCKLIST -#define XRE_PRELOAD_XUL // we want a wmain entry point #include "nsWindowsWMain.cpp" #endif diff --git a/toolkit/xre/nsWindowsWMain.cpp b/toolkit/xre/nsWindowsWMain.cpp index b978972a9ca5..a1c0179a7977 100644 --- a/toolkit/xre/nsWindowsWMain.cpp +++ b/toolkit/xre/nsWindowsWMain.cpp @@ -73,76 +73,8 @@ FreeAllocStrings(int argc, char **argv) delete [] argv; } -#ifdef XRE_PRELOAD_XUL -static void preload(LPCWSTR dll) -{ - HANDLE fd = CreateFileW(dll, GENERIC_READ, FILE_SHARE_READ, - NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL); - char buf[64 * 1024]; - - if (fd == INVALID_HANDLE_VALUE) - return; - - DWORD dwBytesRead; - // Do dummy reads to trigger kernel-side readhead via FILE_FLAG_SEQUENTIAL_SCAN. - // Abort when underfilling because during testing the buffers are read fully - // A buffer that's not keeping up would imply that readahead isn't working right - while (ReadFile(fd, buf, sizeof(buf), &dwBytesRead, NULL) && dwBytesRead == sizeof(buf)) - /* Nothing */; - - CloseHandle(fd); -} - -/** Populate the windows page cache */ -static void preload_libs(LPCWSTR appPath) -{ - wchar_t buf[MAX_PATH]; - size_t pathlen = wcslen(appPath); - - // rewind until the last \ - for(;pathlen && appPath[pathlen] != L'\\'; pathlen--); - - // if there is a directory name present, keep the last \ - if (pathlen) - pathlen++; - - if (pathlen + 10 > MAX_PATH) { - return; - } - - wcsncpy(buf, appPath, pathlen); - size_t remaining = sizeof(buf)/sizeof(buf[0]) - pathlen - 1; - // For now only preload only the most expensive libs. - // The rest cost a few magnitudes less. - LPCWSTR files[] = {L"xul.dll", -#ifndef MOZ_STATIC_JS - L"mozjs.dll", -#endif - 0}; - for(int i = 0; files[i]; i++) { - wcsncpy(buf + pathlen, files[i], remaining); - preload(buf); - } - return; -} -#endif - int wmain(int argc, WCHAR **argv) { -#ifdef XRE_PRELOAD_XUL - // GetProcessIoCounters().ReadOperationCount seems to have little to - // do with actual read operations. It reports 0 or 1 at this stage - // in the program. Luckily 1 coincides with when prefetch is - // enabled. If Windows prefetch didn't happen we can do our own - // faster dll preloading. - IO_COUNTERS ioCounters; - if (GetProcessIoCounters(GetCurrentProcess(), &ioCounters) - && !ioCounters.ReadOperationCount) - { - preload_libs(argv[0]); - } -#endif - #ifndef XRE_DONT_PROTECT_DLL_LOAD mozilla::NS_SetDllDirectory(L""); #endif