Bug 383939. RDF datasources must implement cycle collection. r/sr=bsmedberg

This commit is contained in:
sayrer@gmail.com 2008-03-05 12:07:55 -08:00
parent b97376dfa8
commit a41d6a883d
4 changed files with 32 additions and 52 deletions

View File

@ -345,8 +345,9 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULDocument, nsXMLDocument)
for (i = 0; i < count; ++i) {
cb.NoteXPCOMChild(static_cast<nsIScriptGlobalObjectOwner*>(tmp->mPrototypes[i]));
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTooltipNode)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLocalStore)
if (tmp->mOverlayLoadObservers.IsInitialized())
tmp->mOverlayLoadObservers.EnumerateRead(TraverseObservers, &cb);

View File

@ -251,7 +251,12 @@ FileSystemDataSource::Create(nsISupports* aOuter, const nsIID& aIID, void **aRes
return self->QueryInterface(aIID, aResult);
}
NS_IMPL_ISUPPORTS1(FileSystemDataSource, nsIRDFDataSource)
NS_IMPL_CYCLE_COLLECTION_0(FileSystemDataSource)
NS_IMPL_CYCLE_COLLECTING_ADDREF(FileSystemDataSource)
NS_IMPL_CYCLE_COLLECTING_RELEASE(FileSystemDataSource)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(FileSystemDataSource)
NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
NS_INTERFACE_MAP_END
NS_IMETHODIMP
FileSystemDataSource::GetURI(char **uri)

View File

@ -46,6 +46,7 @@
#include "nsISupportsArray.h"
#include "nsCOMPtr.h"
#include "nsString.h"
#include "nsCycleCollectionParticipant.h"
#if defined(XP_UNIX) || defined(XP_OS2) || defined(XP_WIN) || defined(XP_BEOS)
#define USE_NC_EXTENSION
@ -54,7 +55,8 @@
class FileSystemDataSource : public nsIRDFDataSource
{
public:
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(FileSystemDataSource)
NS_DECL_NSIRDFDATASOURCE
static NS_METHOD Create(nsISupports* aOuter,

View File

@ -66,6 +66,7 @@
#include "nsCRTGlue.h"
#include "nsCRT.h"
#include "nsEnumeratorUtils.h"
#include "nsCycleCollectionParticipant.h"
////////////////////////////////////////////////////////////////////////
@ -91,7 +92,8 @@ protected:
public:
// nsISupports interface
NS_DECL_ISUPPORTS
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(LocalStoreImpl, nsILocalStore)
// nsILocalStore interface
@ -213,13 +215,13 @@ public:
}
NS_IMETHOD GetLoaded(PRBool* _result);
NS_IMETHOD Init(const char *uri);
NS_IMETHOD Flush();
NS_IMETHOD FlushTo(const char *aURI);
NS_IMETHOD Refresh(PRBool sync);
// nsIObserver
NS_DECL_NSIOBSERVER
NS_IMETHOD Init(const char *uri);
NS_IMETHOD Flush();
NS_IMETHOD FlushTo(const char *aURI);
NS_IMETHOD Refresh(PRBool sync);
// nsIObserver
NS_DECL_NSIOBSERVER
};
////////////////////////////////////////////////////////////////////////
@ -264,51 +266,21 @@ NS_NewLocalStore(nsISupports* aOuter, REFNSIID aIID, void** aResult)
return rv;
}
NS_IMPL_CYCLE_COLLECTION_1(LocalStoreImpl, mInner)
NS_IMPL_CYCLE_COLLECTING_ADDREF_AMBIGUOUS(LocalStoreImpl, nsILocalStore)
NS_IMPL_CYCLE_COLLECTING_RELEASE_AMBIGUOUS(LocalStoreImpl, nsILocalStore)
// nsISupports interface
NS_IMPL_ADDREF(LocalStoreImpl)
NS_IMPL_RELEASE(LocalStoreImpl)
NS_IMETHODIMP
LocalStoreImpl::QueryInterface(REFNSIID aIID, void** aResult)
{
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
NS_PRECONDITION(aResult != nsnull, "null ptr");
if (! aResult)
return NS_ERROR_NULL_POINTER;
if (aIID.Equals(kISupportsIID) ||
aIID.Equals(NS_GET_IID(nsILocalStore))) {
*aResult = static_cast<nsILocalStore*>(this);
}
else if (aIID.Equals(NS_GET_IID(nsIRDFDataSource))) {
*aResult = static_cast<nsIRDFDataSource *>(this);
}
else if (aIID.Equals(NS_GET_IID(nsIRDFRemoteDataSource))) {
*aResult = static_cast<nsIRDFRemoteDataSource *>(this);
}
else if (aIID.Equals(NS_GET_IID(nsIObserver))) {
*aResult = static_cast<nsIObserver *>(this);
}
else if (aIID.Equals(NS_GET_IID(nsISupportsWeakReference))) {
*aResult = static_cast<nsISupportsWeakReference *>(this);
}
else {
*aResult = nsnull;
return NS_NOINTERFACE;
}
NS_ADDREF(this);
return NS_OK;
}
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(LocalStoreImpl)
NS_INTERFACE_MAP_ENTRY(nsILocalStore)
NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
NS_INTERFACE_MAP_ENTRY(nsIRDFRemoteDataSource)
NS_INTERFACE_MAP_ENTRY(nsIObserver)
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsILocalStore)
NS_INTERFACE_MAP_END
// nsILocalStore interface
// nsIRDFDataSource interface
NS_IMETHODIMP