зеркало из https://github.com/mozilla/pjs.git
Bug 383939. All RDF datasources must implement cycle collection to avoid leaking. r/sr=bsmedberg
This commit is contained in:
Родитель
0e594828a8
Коммит
938920c59d
|
@ -347,6 +347,7 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULDocument, nsXMLDocument)
|
|||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTooltipNode)
|
||||
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLocalStore)
|
||||
|
||||
if (tmp->mOverlayLoadObservers.IsInitialized())
|
||||
tmp->mOverlayLoadObservers.EnumerateRead(TraverseObservers, &cb);
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
NS_IMETHOD Init(const char *uri);
|
||||
NS_IMETHOD Flush();
|
||||
NS_IMETHOD FlushTo(const char *aURI);
|
||||
NS_IMETHOD Refresh(PRBool sync);
|
||||
|
||||
// nsIObserver
|
||||
NS_DECL_NSIOBSERVER
|
||||
// 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
|
||||
|
|
Загрузка…
Ссылка в новой задаче