mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 22:01:30 +00:00
SetDestructor
This commit is contained in:
parent
4300354ee1
commit
f8887c33ae
@ -18,12 +18,17 @@
|
||||
|
||||
#include "nsGenericFactory.h"
|
||||
|
||||
nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor) : mConstructor(constructor)
|
||||
nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor)
|
||||
: mConstructor(constructor), mDestructor(NULL)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsGenericFactory::~nsGenericFactory() {}
|
||||
nsGenericFactory::~nsGenericFactory()
|
||||
{
|
||||
if (mDestructor != NULL)
|
||||
(*mDestructor) ();
|
||||
}
|
||||
|
||||
NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
@ -59,6 +64,12 @@ NS_IMETHODIMP nsGenericFactory::SetConstructor(ConstructorProcPtr constructor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericFactory::SetDestructor(DestructorProcPtr destructor)
|
||||
{
|
||||
mDestructor = destructor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsGenericFactory::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
// sorry, aggregation not spoken here.
|
||||
|
@ -38,11 +38,23 @@ public:
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's constructor function, which will be called
|
||||
* by CreateInstance.
|
||||
*/
|
||||
NS_IMETHOD SetConstructor(ConstructorProcPtr constructor);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's destructor function, which will be called
|
||||
* whe the generic factory is deleted. This is used to notify the DLL that
|
||||
* an instance of one of its generic factories is going away.
|
||||
*/
|
||||
NS_IMETHOD SetDestructor(DestructorProcPtr destructor);
|
||||
|
||||
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
private:
|
||||
ConstructorProcPtr mConstructor;
|
||||
DestructorProcPtr mDestructor;
|
||||
};
|
||||
|
||||
#endif /* nsGenericFactory_h___ */
|
||||
|
@ -44,12 +44,20 @@ public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IGENERICFACTORY_IID; return iid; }
|
||||
|
||||
typedef NS_CALLBACK(ConstructorProcPtr) (nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
typedef NS_CALLBACK(DestructorProcPtr) (void);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's constructor function, which will be called
|
||||
* by CreateInstance.
|
||||
*/
|
||||
NS_IMETHOD SetConstructor(ConstructorProcPtr constructor) = 0;
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's destructor function, which will be called
|
||||
* whe the generic factory is deleted. This is used to notify the DLL that
|
||||
* an instance of one of its generic factories is going away.
|
||||
*/
|
||||
NS_IMETHOD SetDestructor(DestructorProcPtr destructor) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIGenericFactory_h___ */
|
||||
|
@ -18,12 +18,17 @@
|
||||
|
||||
#include "nsGenericFactory.h"
|
||||
|
||||
nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor) : mConstructor(constructor)
|
||||
nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor)
|
||||
: mConstructor(constructor), mDestructor(NULL)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsGenericFactory::~nsGenericFactory() {}
|
||||
nsGenericFactory::~nsGenericFactory()
|
||||
{
|
||||
if (mDestructor != NULL)
|
||||
(*mDestructor) ();
|
||||
}
|
||||
|
||||
NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
@ -59,6 +64,12 @@ NS_IMETHODIMP nsGenericFactory::SetConstructor(ConstructorProcPtr constructor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericFactory::SetDestructor(DestructorProcPtr destructor)
|
||||
{
|
||||
mDestructor = destructor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsGenericFactory::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
// sorry, aggregation not spoken here.
|
||||
|
@ -38,11 +38,23 @@ public:
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's constructor function, which will be called
|
||||
* by CreateInstance.
|
||||
*/
|
||||
NS_IMETHOD SetConstructor(ConstructorProcPtr constructor);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's destructor function, which will be called
|
||||
* whe the generic factory is deleted. This is used to notify the DLL that
|
||||
* an instance of one of its generic factories is going away.
|
||||
*/
|
||||
NS_IMETHOD SetDestructor(DestructorProcPtr destructor);
|
||||
|
||||
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
private:
|
||||
ConstructorProcPtr mConstructor;
|
||||
DestructorProcPtr mDestructor;
|
||||
};
|
||||
|
||||
#endif /* nsGenericFactory_h___ */
|
||||
|
@ -44,12 +44,20 @@ public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IGENERICFACTORY_IID; return iid; }
|
||||
|
||||
typedef NS_CALLBACK(ConstructorProcPtr) (nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
typedef NS_CALLBACK(DestructorProcPtr) (void);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's constructor function, which will be called
|
||||
* by CreateInstance.
|
||||
*/
|
||||
NS_IMETHOD SetConstructor(ConstructorProcPtr constructor) = 0;
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's destructor function, which will be called
|
||||
* whe the generic factory is deleted. This is used to notify the DLL that
|
||||
* an instance of one of its generic factories is going away.
|
||||
*/
|
||||
NS_IMETHOD SetDestructor(DestructorProcPtr destructor) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIGenericFactory_h___ */
|
||||
|
@ -44,12 +44,20 @@ public:
|
||||
static const nsIID& IID() { static nsIID iid = NS_IGENERICFACTORY_IID; return iid; }
|
||||
|
||||
typedef NS_CALLBACK(ConstructorProcPtr) (nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
typedef NS_CALLBACK(DestructorProcPtr) (void);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's constructor function, which will be called
|
||||
* by CreateInstance.
|
||||
*/
|
||||
NS_IMETHOD SetConstructor(ConstructorProcPtr constructor) = 0;
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's destructor function, which will be called
|
||||
* whe the generic factory is deleted. This is used to notify the DLL that
|
||||
* an instance of one of its generic factories is going away.
|
||||
*/
|
||||
NS_IMETHOD SetDestructor(DestructorProcPtr destructor) = 0;
|
||||
};
|
||||
|
||||
#endif /* nsIGenericFactory_h___ */
|
||||
|
@ -18,12 +18,17 @@
|
||||
|
||||
#include "nsGenericFactory.h"
|
||||
|
||||
nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor) : mConstructor(constructor)
|
||||
nsGenericFactory::nsGenericFactory(ConstructorProcPtr constructor)
|
||||
: mConstructor(constructor), mDestructor(NULL)
|
||||
{
|
||||
NS_INIT_ISUPPORTS();
|
||||
}
|
||||
|
||||
nsGenericFactory::~nsGenericFactory() {}
|
||||
nsGenericFactory::~nsGenericFactory()
|
||||
{
|
||||
if (mDestructor != NULL)
|
||||
(*mDestructor) ();
|
||||
}
|
||||
|
||||
NS_METHOD nsGenericFactory::QueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
@ -59,6 +64,12 @@ NS_IMETHODIMP nsGenericFactory::SetConstructor(ConstructorProcPtr constructor)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsGenericFactory::SetDestructor(DestructorProcPtr destructor)
|
||||
{
|
||||
mDestructor = destructor;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD nsGenericFactory::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
// sorry, aggregation not spoken here.
|
||||
|
@ -38,11 +38,23 @@ public:
|
||||
|
||||
NS_IMETHOD LockFactory(PRBool aLock);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's constructor function, which will be called
|
||||
* by CreateInstance.
|
||||
*/
|
||||
NS_IMETHOD SetConstructor(ConstructorProcPtr constructor);
|
||||
|
||||
/**
|
||||
* Establishes the generic factory's destructor function, which will be called
|
||||
* whe the generic factory is deleted. This is used to notify the DLL that
|
||||
* an instance of one of its generic factories is going away.
|
||||
*/
|
||||
NS_IMETHOD SetDestructor(DestructorProcPtr destructor);
|
||||
|
||||
static NS_METHOD Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
private:
|
||||
ConstructorProcPtr mConstructor;
|
||||
DestructorProcPtr mDestructor;
|
||||
};
|
||||
|
||||
#endif /* nsGenericFactory_h___ */
|
||||
|
Loading…
Reference in New Issue
Block a user