Allow disabling of profile locking. r=ccarlen b=212132

This commit is contained in:
dougt%meer.net 2003-07-09 05:07:56 +00:00
Родитель c37108f32e
Коммит 5e4a9e7187
4 изменённых файлов: 29 добавлений и 3 удалений

Просмотреть файл

@ -103,6 +103,7 @@ XPC_IDISPATCH_SUPPORT = @MOZ_ACTIVEX_SCRIPTING_SUPPORT@
MOZ_XPFE_COMPONENTS = @MOZ_XPFE_COMPONENTS@
MOZ_IPCD = @MOZ_IPCD@
MOZ_PROFILESHARING = @MOZ_PROFILESHARING@
MOZ_PROFILELOCKING = @MOZ_PROFILELOCKING@
MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS = @MOZ_COMPONENTS_VERSION_SCRIPT_LDFLAGS@
MOZ_COMPONENT_NSPR_LIBS=@MOZ_COMPONENT_NSPR_LIBS@

Просмотреть файл

@ -4842,6 +4842,19 @@ if test "$MOZ_PROFILESHARING"; then
AC_DEFINE(MOZ_PROFILESHARING)
fi
dnl ========================================================
dnl disable profile locking
dnl ========================================================
MOZ_PROFILELOCKING=1
MOZ_ARG_DISABLE_BOOL(profilelocking,
[ --disable-profilelocking Disable profile locking],
MOZ_PROFILELOCKING=,
MOZ_PROFILELOCKING=1 )
if test "$MOZ_PROFILELOCKING"; then
AC_DEFINE(MOZ_PROFILELOCKING)
fi
dnl ========================================================
dnl necko configuration options
dnl ========================================================

Просмотреть файл

@ -53,9 +53,11 @@ REQUIRES += ipcd \
$(NULL)
endif
CPPSRCS = nsProfileDirServiceProvider.cpp \
nsProfileLock.cpp \
$(NULL)
CPPSRCS = nsProfileDirServiceProvider.cpp
ifdef MOZ_PROFILELOCKING
CPPSRCS += nsProfileLock.cpp
endif
# we don't want the shared lib
FORCE_STATIC_LIB = 1

Просмотреть файл

@ -92,7 +92,9 @@ nsIAtom* nsProfileDirServiceProvider::sApp_MessengerFolderCache50;
//*****************************************************************************
nsProfileDirServiceProvider::nsProfileDirServiceProvider(PRBool aNotifyObservers) :
#ifdef MOZ_PROFILELOCKING
mProfileDirLock(nsnull),
#endif
mNotifyObservers(aNotifyObservers),
mSharingEnabled(PR_FALSE)
{
@ -101,7 +103,9 @@ nsProfileDirServiceProvider::nsProfileDirServiceProvider(PRBool aNotifyObservers
nsProfileDirServiceProvider::~nsProfileDirServiceProvider()
{
#ifdef MOZ_PROFILELOCKING
delete mProfileDirLock;
#endif
}
nsresult
@ -114,7 +118,9 @@ nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir)
NS_WARNING("Setting profile dir to same as current");
return NS_OK;
}
#ifdef MOZ_PROFILELOCKING
mProfileDirLock->Unlock();
#endif
UndefineFileLocations();
}
mProfileDir = aProfileDir;
@ -141,6 +147,7 @@ nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir)
}
#endif
#ifdef MOZ_PROFILELOCKING
// Lock the non-shared sub-dir if we are sharing,
// the whole profile dir if we are not.
nsCOMPtr<nsILocalFile> dirToLock;
@ -151,6 +158,7 @@ nsProfileDirServiceProvider::SetProfileDir(nsIFile* aProfileDir)
rv = mProfileDirLock->Lock(dirToLock);
if (NS_FAILED(rv))
return rv;
#endif
if (mNotifyObservers) {
nsCOMPtr<nsIObserverService> observerService =
@ -336,9 +344,11 @@ nsProfileDirServiceProvider::GetFile(const char *prop, PRBool *persistant, nsIFi
nsresult
nsProfileDirServiceProvider::Initialize()
{
#ifdef MOZ_PROFILELOCKING
mProfileDirLock = new nsProfileLock;
if (!mProfileDirLock)
return NS_ERROR_OUT_OF_MEMORY;
#endif
#ifdef MOZ_PROFILESHARING
nsCOMPtr<nsIProfileSharingSetup> sharingSetup =