Bug 1195491 - use nsCOMPtr in RDFContentSinkImpl; r=bsmedberg
authorNathan Froyd <froydnj@mozilla.com>
Wed, 12 Aug 2015 00:12:05 -0400
changeset 262870 adac35e4feeb83a99a4476df70bb16766f4ab203
parent 262869 7508686dc981cd072b73ae182f71c233aff94863
child 262871 fd29f486b3e308a8d2d77e1e33e6a5e21a1ce74a
push id29385
push usercbook@mozilla.com
push dateThu, 17 Sep 2015 12:56:50 +0000
treeherdermozilla-central@de0e763b5210 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbsmedberg
bugs1195491
milestone43.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1195491 - use nsCOMPtr in RDFContentSinkImpl; r=bsmedberg
rdf/base/nsRDFContentSink.cpp
--- a/rdf/base/nsRDFContentSink.cpp
+++ b/rdf/base/nsRDFContentSink.cpp
@@ -218,17 +218,17 @@ protected:
     struct RDFContextStackElement {
         nsCOMPtr<nsIRDFResource> mResource;
         RDFContentSinkState      mState;
         RDFContentSinkParseMode  mParseMode;
     };
 
     nsAutoTArray<RDFContextStackElement, 8>* mContextStack;
 
-    nsIURI*      mDocumentURL;
+    nsCOMPtr<nsIURI> mDocumentURL;
 
 private:
     static PRLogModuleInfo* gLog;
 };
 
 int32_t         RDFContentSinkImpl::gRefCnt = 0;
 nsIRDFService*  RDFContentSinkImpl::gRDFService;
 nsIRDFContainerUtils* RDFContentSinkImpl::gRDFContainerUtils;
@@ -258,18 +258,17 @@ static const nsStaticAtom rdf_atoms[] = 
 };
 
 RDFContentSinkImpl::RDFContentSinkImpl()
     : mText(nullptr),
       mTextLength(0),
       mTextSize(0),
       mState(eRDFContentSinkState_InProlog),
       mParseMode(eRDFContentSinkParseMode_Literal),
-      mContextStack(nullptr),
-      mDocumentURL(nullptr)
+      mContextStack(nullptr)
 {
     if (gRefCnt++ == 0) {
         NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
         nsresult rv = CallGetService(kRDFServiceCID, &gRDFService);
 
         NS_ASSERTION(NS_SUCCEEDED(rv), "unable to get RDF service");
         if (NS_SUCCEEDED(rv)) {
             rv = gRDFService->GetResource(NS_LITERAL_CSTRING(RDF_NAMESPACE_URI "type"),
@@ -299,18 +298,16 @@ RDFContentSinkImpl::RDFContentSinkImpl()
 
 RDFContentSinkImpl::~RDFContentSinkImpl()
 {
 #ifdef DEBUG_REFS
     --gInstanceCount;
     fprintf(stdout, "%d - RDF: RDFContentSinkImpl\n", gInstanceCount);
 #endif
 
-    NS_IF_RELEASE(mDocumentURL);
-
     if (mContextStack) {
         MOZ_LOG(gLog, LogLevel::Warning,
                ("rdfxml: warning! unclosed tag"));
 
         // XXX we should never need to do this, but, we'll write the
         // code all the same. If someone left the content stack dirty,
         // pop all the elements off the stack and release them.
         int32_t i = mContextStack->Length();
@@ -603,18 +600,16 @@ RDFContentSinkImpl::SetParser(nsParserBa
 NS_IMETHODIMP
 RDFContentSinkImpl::Init(nsIURI* aURL)
 {
     NS_PRECONDITION(aURL != nullptr, "null ptr");
     if (! aURL)
         return NS_ERROR_NULL_POINTER;
 
     mDocumentURL = aURL;
-    NS_ADDREF(aURL);
-
     mState = eRDFContentSinkState_InProlog;
     return NS_OK;
 }
 
 NS_IMETHODIMP
 RDFContentSinkImpl::SetDataSource(nsIRDFDataSource* aDataSource)
 {
     NS_PRECONDITION(aDataSource != nullptr, "SetDataSource null ptr");