зеркало из https://github.com/mozilla/pjs.git
Bug 710112 - cleanup xpcom/io for windows (reduce LoadLibrary/PR_LoadLibrary). r=jimm
This commit is contained in:
Родитель
285e8ffe45
Коммит
07fb70e23f
|
@ -717,8 +717,6 @@ ShutdownXPCOM(nsIServiceManager* servMgr)
|
|||
nsComponentManagerImpl::gComponentManager = nsnull;
|
||||
nsCategoryManager::Destroy();
|
||||
|
||||
ShutdownSpecialSystemDirectory();
|
||||
|
||||
NS_PurgeAtomTable();
|
||||
|
||||
NS_IF_RELEASE(gDebug);
|
||||
|
|
|
@ -101,8 +101,6 @@ typedef HRESULT (WINAPI* nsGetKnownFolderPath)(GUID& rfid,
|
|||
PWSTR *ppszPath);
|
||||
|
||||
static nsGetKnownFolderPath gGetKnownFolderPath = NULL;
|
||||
|
||||
static HINSTANCE gShell32DLLInst = NULL;
|
||||
#endif
|
||||
|
||||
void StartupSpecialSystemDirectory()
|
||||
|
@ -110,23 +108,11 @@ void StartupSpecialSystemDirectory()
|
|||
#if defined (XP_WIN)
|
||||
// SHGetKnownFolderPath is only available on Windows Vista
|
||||
// so that we need to use GetProcAddress to get the pointer.
|
||||
gShell32DLLInst = LoadLibraryW(L"shell32.dll");
|
||||
if(gShell32DLLInst)
|
||||
HMODULE hShell32DLLInst = GetModuleHandleW(L"shell32.dll");
|
||||
if(hShell32DLLInst)
|
||||
{
|
||||
gGetKnownFolderPath = (nsGetKnownFolderPath)
|
||||
GetProcAddress(gShell32DLLInst, "SHGetKnownFolderPath");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void ShutdownSpecialSystemDirectory()
|
||||
{
|
||||
#if defined (XP_WIN)
|
||||
if (gShell32DLLInst)
|
||||
{
|
||||
FreeLibrary(gShell32DLLInst);
|
||||
gShell32DLLInst = NULL;
|
||||
gGetKnownFolderPath = NULL;
|
||||
GetProcAddress(hShell32DLLInst, "SHGetKnownFolderPath");
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
|
|
@ -51,7 +51,6 @@
|
|||
#endif
|
||||
|
||||
extern void StartupSpecialSystemDirectory();
|
||||
extern void ShutdownSpecialSystemDirectory();
|
||||
|
||||
|
||||
enum SystemDirectories {
|
||||
|
|
|
@ -108,7 +108,6 @@ unsigned char *_mbsstr( const unsigned char *str,
|
|||
|
||||
ILCreateFromPathWPtr nsLocalFile::sILCreateFromPathW = NULL;
|
||||
SHOpenFolderAndSelectItemsPtr nsLocalFile::sSHOpenFolderAndSelectItems = NULL;
|
||||
PRLibrary *nsLocalFile::sLibShell = NULL;
|
||||
|
||||
class nsDriveEnumerator : public nsISimpleEnumerator
|
||||
{
|
||||
|
@ -2773,7 +2772,7 @@ nsLocalFile::RevealUsingShell()
|
|||
{
|
||||
// All of these shell32.dll related pointers should be non NULL
|
||||
// on XP and later.
|
||||
if (!sLibShell || !sILCreateFromPathW || !sSHOpenFolderAndSelectItems) {
|
||||
if (!sILCreateFromPathW || !sSHOpenFolderAndSelectItems) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -3134,26 +3133,23 @@ nsLocalFile::GlobalInit()
|
|||
|
||||
// shell32.dll should be loaded already, so we are not actually
|
||||
// loading the library here.
|
||||
sLibShell = PR_LoadLibrary("shell32.dll");
|
||||
if (sLibShell) {
|
||||
HMODULE hLibShell = GetModuleHandleW(L"shell32.dll");
|
||||
if (hLibShell) {
|
||||
// ILCreateFromPathW is available in XP and up.
|
||||
sILCreateFromPathW = (ILCreateFromPathWPtr)
|
||||
PR_FindFunctionSymbol(sLibShell,
|
||||
"ILCreateFromPathW");
|
||||
GetProcAddress(hLibShell,
|
||||
"ILCreateFromPathW");
|
||||
|
||||
// SHOpenFolderAndSelectItems is available in XP and up.
|
||||
sSHOpenFolderAndSelectItems = (SHOpenFolderAndSelectItemsPtr)
|
||||
PR_FindFunctionSymbol(sLibShell,
|
||||
"SHOpenFolderAndSelectItems");
|
||||
GetProcAddress(hLibShell,
|
||||
"SHOpenFolderAndSelectItems");
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
nsLocalFile::GlobalShutdown()
|
||||
{
|
||||
if (sLibShell) {
|
||||
PR_UnloadLibrary(sLibShell);
|
||||
}
|
||||
NS_DestroyShortcutResolver();
|
||||
}
|
||||
|
||||
|
|
|
@ -133,7 +133,6 @@ private:
|
|||
|
||||
static ILCreateFromPathWPtr sILCreateFromPathW;
|
||||
static SHOpenFolderAndSelectItemsPtr sSHOpenFolderAndSelectItems;
|
||||
static PRLibrary *sLibShell;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче