/* static */ PLDHashOperator PR_CALLBACK sbLocalDatabaseLibraryLoader::VerifyEntriesCallback(nsUint32HashKey::KeyType aKey, nsAutoPtr<sbLibraryLoaderInfo>& aEntry, void* aUserData) { nsCAutoString prefBranch; aEntry->GetPrefBranch(prefBranch); NS_ASSERTION(!prefBranch.IsEmpty(), "This can't be empty!"); nsAutoString databaseGUID; aEntry->GetDatabaseGUID(databaseGUID); if (databaseGUID.IsEmpty()) { NS_WARNING("One of the libraries was missing a database GUID and will be removed."); RemovePrefBranch(prefBranch); return PL_DHASH_REMOVE; } nsAutoString resourceGUID; aEntry->GetResourceGUID(resourceGUID); if (resourceGUID.IsEmpty()) { NS_WARNING("One of the libraries was missing a resource GUID and will be removed."); RemovePrefBranch(prefBranch); return PL_DHASH_REMOVE; } nsCOMPtr<nsILocalFile> location = aEntry->GetDatabaseLocation(); if (!location) { NS_WARNING("One of the libraries had no location and will be removed."); RemovePrefBranch(prefBranch); return PL_DHASH_REMOVE; } return PL_DHASH_NEXT; }
PLDHashOperator FreeObserverFunc(PrefCallback *aKey, nsAutoPtr<PrefCallback> &aCallback, void *aArgs) { // Calling NS_RELEASE below might trigger a call to // nsPrefBranch::RemoveObserver, since some classes remove themselves from // the pref branch on destruction. We don't need to worry about this causing // double-frees, however, because freeObserverList sets mFreeingObserverList // to true, which prevents RemoveObserver calls from doing anything. nsPrefBranch *prefBranch = aCallback->GetPrefBranch(); const char *pref = prefBranch->getPrefName(aCallback->GetDomain().get()); PREF_UnregisterCallback(pref, nsPrefBranch::NotifyObserver, aCallback); return PL_DHASH_REMOVE; }