From 816e4b7276ab5eb959195ac0b00de0a1dc9f27c6 Mon Sep 17 00:00:00 2001 From: "rjc%netscape.com" Date: Tue, 11 Jan 2000 22:03:53 +0000 Subject: [PATCH] Tweak resource cache usage. Change from putterman, Review from me --- .../templates/src/nsXULTemplateBuilder.cpp | 23 +++++++++++-------- rdf/content/src/nsRDFGenericBuilder.cpp | 23 +++++++++++-------- rdf/content/src/nsXULTemplateBuilder.cpp | 23 +++++++++++-------- 3 files changed, 42 insertions(+), 27 deletions(-) diff --git a/content/xul/templates/src/nsXULTemplateBuilder.cpp b/content/xul/templates/src/nsXULTemplateBuilder.cpp index c2a1a066f2b..2a8ff8af9bd 100644 --- a/content/xul/templates/src/nsXULTemplateBuilder.cpp +++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp @@ -2066,15 +2066,20 @@ RDFGenericBuilderImpl::BuildContentFromTemplate(nsIContent *aTemplateNode, if (! isUnique) { rv = NS_ERROR_UNEXPECTED; - if (gXULSortService && isResourceElement) { - nsCOMPtr tempCache = nsnull; - - rv = gXULSortService->InsertContainerNode(mDB, getter_AddRefs(tempCache), - mRoot, trueParent, aRealNode, realKid, aNotify); - if (tempCache) - { - mCache = tempCache; - } + if (gXULSortService && isResourceElement) + { + if (mCache) + { + rv = gXULSortService->InsertContainerNode(mDB, + (nsIRDFDataSource **)&mCache, + mRoot, trueParent, aRealNode, realKid, aNotify); + } + else + { + rv = gXULSortService->InsertContainerNode(mDB, + getter_AddRefs(mCache), + mRoot, trueParent, aRealNode, realKid, aNotify); + } } if (NS_FAILED(rv)) { diff --git a/rdf/content/src/nsRDFGenericBuilder.cpp b/rdf/content/src/nsRDFGenericBuilder.cpp index c2a1a066f2b..2a8ff8af9bd 100644 --- a/rdf/content/src/nsRDFGenericBuilder.cpp +++ b/rdf/content/src/nsRDFGenericBuilder.cpp @@ -2066,15 +2066,20 @@ RDFGenericBuilderImpl::BuildContentFromTemplate(nsIContent *aTemplateNode, if (! isUnique) { rv = NS_ERROR_UNEXPECTED; - if (gXULSortService && isResourceElement) { - nsCOMPtr tempCache = nsnull; - - rv = gXULSortService->InsertContainerNode(mDB, getter_AddRefs(tempCache), - mRoot, trueParent, aRealNode, realKid, aNotify); - if (tempCache) - { - mCache = tempCache; - } + if (gXULSortService && isResourceElement) + { + if (mCache) + { + rv = gXULSortService->InsertContainerNode(mDB, + (nsIRDFDataSource **)&mCache, + mRoot, trueParent, aRealNode, realKid, aNotify); + } + else + { + rv = gXULSortService->InsertContainerNode(mDB, + getter_AddRefs(mCache), + mRoot, trueParent, aRealNode, realKid, aNotify); + } } if (NS_FAILED(rv)) { diff --git a/rdf/content/src/nsXULTemplateBuilder.cpp b/rdf/content/src/nsXULTemplateBuilder.cpp index c2a1a066f2b..2a8ff8af9bd 100644 --- a/rdf/content/src/nsXULTemplateBuilder.cpp +++ b/rdf/content/src/nsXULTemplateBuilder.cpp @@ -2066,15 +2066,20 @@ RDFGenericBuilderImpl::BuildContentFromTemplate(nsIContent *aTemplateNode, if (! isUnique) { rv = NS_ERROR_UNEXPECTED; - if (gXULSortService && isResourceElement) { - nsCOMPtr tempCache = nsnull; - - rv = gXULSortService->InsertContainerNode(mDB, getter_AddRefs(tempCache), - mRoot, trueParent, aRealNode, realKid, aNotify); - if (tempCache) - { - mCache = tempCache; - } + if (gXULSortService && isResourceElement) + { + if (mCache) + { + rv = gXULSortService->InsertContainerNode(mDB, + (nsIRDFDataSource **)&mCache, + mRoot, trueParent, aRealNode, realKid, aNotify); + } + else + { + rv = gXULSortService->InsertContainerNode(mDB, + getter_AddRefs(mCache), + mRoot, trueParent, aRealNode, realKid, aNotify); + } } if (NS_FAILED(rv)) {