mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-12-14 10:43:24 +00:00
Added support for caching accesses to the root branch as per alecf.
This commit is contained in:
parent
5b94d02a3a
commit
b9b49f0a2a
@ -82,6 +82,7 @@ nsPrefService::nsPrefService()
|
||||
nsPrefService::~nsPrefService()
|
||||
{
|
||||
PREF_Cleanup();
|
||||
NS_IF_RELEASE(mCurrentFile);
|
||||
}
|
||||
|
||||
|
||||
@ -205,10 +206,19 @@ NS_IMETHODIMP nsPrefService::GetBranch(const char *aPrefRoot, nsIPrefBranch **_r
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// TODO: - cache this stuff and allow consumers to share branches (hold weak references I think)
|
||||
nsPrefBranch* prefBranch = new nsPrefBranch(aPrefRoot, PR_FALSE);
|
||||
if ((nsnull != aPrefRoot) && (aPrefRoot != "")) {
|
||||
// TODO: - cache this stuff and allow consumers to share branches (hold weak references I think)
|
||||
nsPrefBranch* prefBranch = new nsPrefBranch(aPrefRoot, PR_FALSE);
|
||||
|
||||
rv = prefBranch->QueryInterface(NS_GET_IID(nsIPrefBranch), (void **)_retval);
|
||||
rv = prefBranch->QueryInterface(NS_GET_IID(nsIPrefBranch), (void **)_retval);
|
||||
} else {
|
||||
// special case caching the default root
|
||||
nsCOMPtr<nsIPrefBranch> prefBranch = do_QueryInterface(mRootBranch, &rv);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
*_retval = prefBranch;
|
||||
NS_ADDREF(*_retval);
|
||||
}
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user