Bug 96525 - Delay loading of strres dll when setting profile. r=tao@netscape.com/sr=alecf@betscape.com

This commit is contained in:
ccarlen%netscape.com 2002-02-07 14:41:36 +00:00
Родитель 39ee6aae6d
Коммит 238b2f2205
2 изменённых файлов: 5 добавлений и 10 удалений

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

@ -712,8 +712,10 @@ nsresult
nsStringBundleService::Init()
{
nsCOMPtr<nsIObserverService> os = do_GetService("@mozilla.org/observer-service;1");
if (os)
if (os) {
os->AddObserver(this, "memory-pressure", PR_TRUE);
os->AddObserver(this, "profile-do-change", PR_TRUE);
}
return NS_OK;
}
@ -723,7 +725,8 @@ nsStringBundleService::Observe(nsISupports* aSubject,
const char* aTopic,
const PRUnichar* aSomeData)
{
if (nsCRT::strcmp("memory-pressure", aTopic) == 0)
if (nsCRT::strcmp("memory-pressure", aTopic) == 0 ||
nsCRT::strcmp("profile-do-change", aTopic) == 0)
flushBundleCache();
return NS_OK;
}

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

@ -1162,14 +1162,6 @@ nsProfile::SetCurrentProfile(const PRUnichar * aCurrentProfile)
observerService->NotifyObservers(subject, "profile-before-change", context.get());
}
// Flush the stringbundle cache
nsCOMPtr<nsIStringBundleService> bundleService =
do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv);
if (NS_SUCCEEDED(rv)) {
rv = bundleService->FlushBundles();
NS_ASSERTION(NS_SUCCEEDED(rv), "failed to flush bundle cache");
}
// Do the profile switch
gProfileDataAccess->SetCurrentProfile(aCurrentProfile);
gProfileDataAccess->mProfileDataChanged = PR_TRUE;