зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1388134 - Move some OS.Constants.Path members to lazy init r=baku
These calls to GetPathToSpecialDir are performing some unnecessary IO during early startup which we'd like to defer. Simply adding the required ones to the list in osfile_async_front.jsm should mostly get us there. Differential Revision: https://phabricator.services.mozilla.com/D6079 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
3248322b16
Коммит
dc006145f9
|
@ -105,32 +105,6 @@ OSFileConstantsService::Paths
|
|||
nsString tmpDir;
|
||||
nsString profileDir;
|
||||
nsString localProfileDir;
|
||||
/**
|
||||
* The user's home directory
|
||||
*/
|
||||
nsString homeDir;
|
||||
/**
|
||||
* The user's 'application data' directory.
|
||||
* Windows:
|
||||
* HOME = Documents and Settings\$USER\Application Data
|
||||
* UAppData = $HOME[\$vendor]\$name
|
||||
*
|
||||
* Unix:
|
||||
* HOME = ~
|
||||
* UAppData = $HOME/.[$vendor/]$name
|
||||
*
|
||||
* Mac:
|
||||
* HOME = ~
|
||||
* UAppData = $HOME/Library/Application Support/$name
|
||||
*/
|
||||
nsString userApplicationDataDir;
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
/**
|
||||
* The user's Library directory.
|
||||
*/
|
||||
nsString macUserLibDir;
|
||||
#endif // defined(XP_MACOSX)
|
||||
|
||||
Paths()
|
||||
{
|
||||
|
@ -138,12 +112,6 @@ OSFileConstantsService::Paths
|
|||
tmpDir.SetIsVoid(true);
|
||||
profileDir.SetIsVoid(true);
|
||||
localProfileDir.SetIsVoid(true);
|
||||
homeDir.SetIsVoid(true);
|
||||
userApplicationDataDir.SetIsVoid(true);
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
macUserLibDir.SetIsVoid(true);
|
||||
#endif // defined(XP_MACOSX)
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -251,16 +219,7 @@ OSFileConstantsService::InitOSFileConstants()
|
|||
}
|
||||
}
|
||||
|
||||
// For other directories, ignore errors (they may be undefined on
|
||||
// some platforms or in non-Firefox embeddings of Gecko).
|
||||
|
||||
GetPathToSpecialDir(NS_OS_TEMP_DIR, paths->tmpDir);
|
||||
GetPathToSpecialDir(NS_OS_HOME_DIR, paths->homeDir);
|
||||
GetPathToSpecialDir(XRE_USER_APP_DATA_DIR, paths->userApplicationDataDir);
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
GetPathToSpecialDir(NS_MAC_USER_LIB_DIR, paths->macUserLibDir);
|
||||
#endif // defined(XP_MACOSX)
|
||||
|
||||
mPaths = std::move(paths);
|
||||
|
||||
|
@ -935,20 +894,6 @@ OSFileConstantsService::DefineOSFileConstants(JSContext* aCx,
|
|||
return false;
|
||||
}
|
||||
|
||||
if (!SetStringProperty(aCx, objPath, "homeDir", mPaths->homeDir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!SetStringProperty(aCx, objPath, "userApplicationDataDir", mPaths->userApplicationDataDir)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
#if defined(XP_MACOSX)
|
||||
if (!SetStringProperty(aCx, objPath, "macUserLibDir", mPaths->macUserLibDir)) {
|
||||
return false;
|
||||
}
|
||||
#endif // defined(XP_MACOSX)
|
||||
|
||||
// sqlite3 is linked from different places depending on the platform
|
||||
nsAutoString libsqlite3;
|
||||
#if defined(ANDROID)
|
||||
|
|
|
@ -86,6 +86,9 @@ for (let [constProp, dirKey] of [
|
|||
["winAppDataDir", "AppData"],
|
||||
["winLocalAppDataDir", "LocalAppData"],
|
||||
["winStartMenuProgsDir", "Progs"],
|
||||
["tmpDir", "TmpD"],
|
||||
["homeDir", "Home"],
|
||||
["macUserLibDir", "ULibDir"],
|
||||
]) {
|
||||
|
||||
if (constProp in SharedAll.Constants.Path) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче