Fix for bug 307713 (Improve and use nsAgg's macros). r=dougt, sr=darin.
This commit is contained in:
Родитель
10198537b6
Коммит
f54079d9e6
|
@ -206,25 +206,9 @@ AutoPushJSContext::~AutoPushJSContext()
|
|||
// Thes macro expands to the aggregated query interface scheme.
|
||||
|
||||
NS_IMPL_AGGREGATED(nsCLiveconnect)
|
||||
|
||||
NS_METHOD
|
||||
nsCLiveconnect::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = GetInner();
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsILiveconnect))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsILiveconnect*, this);
|
||||
}
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_ADDREF((nsISupports*) *aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsCLiveconnect)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILiveconnect)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -138,14 +138,14 @@ nsCLiveconnectFactory::CreateInstance(nsISupports *aOuter, REFNSIID aIID, void *
|
|||
|
||||
*aResult = NULL;
|
||||
|
||||
if (aOuter && !aIID.Equals(kISupportsIID))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, kISupportsIID);
|
||||
|
||||
nsCLiveconnect* liveconnect = new nsCLiveconnect(aOuter);
|
||||
if (liveconnect == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult result = liveconnect->AggregatedQueryInterface(aIID, aResult);
|
||||
nsISupports* inner = liveconnect->InnerObject();
|
||||
nsresult result = inner->QueryInterface(aIID, aResult);
|
||||
if (NS_FAILED(result))
|
||||
delete liveconnect;
|
||||
|
||||
|
|
|
@ -57,8 +57,17 @@ enum jni_type
|
|||
jvoid_type
|
||||
};
|
||||
|
||||
#define NS_ISECUREENV_IID \
|
||||
{ /* ca9148d0-598a-11d2-a1d4-00805f8f694d */ \
|
||||
0xca9148d0, \
|
||||
0x598a, \
|
||||
0x11d2, \
|
||||
{0xa1, 0xd4, 0x00, 0x80, 0x5f, 0x8f, 0x69, 0x4d } \
|
||||
}
|
||||
|
||||
class nsISecureEnv : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISECUREENV_IID)
|
||||
|
||||
/**
|
||||
* Create new Java object in LiveConnect.
|
||||
|
@ -351,12 +360,4 @@ public:
|
|||
/*[out]*/ jint* result) = 0;
|
||||
};
|
||||
|
||||
#define NS_ISECUREENV_IID \
|
||||
{ /* ca9148d0-598a-11d2-a1d4-00805f8f694d */ \
|
||||
0xca9148d0, \
|
||||
0x598a, \
|
||||
0x11d2, \
|
||||
{0xa1, 0xd4, 0x00, 0x80, 0x5f, 0x8f, 0x69, 0x4d } \
|
||||
}
|
||||
|
||||
#endif // nsISecureEnv_h___
|
||||
|
|
|
@ -54,14 +54,6 @@
|
|||
//
|
||||
// Implemented by the browser that supports the Symantec debugger.
|
||||
|
||||
class nsISymantecDebugManager : public nsISupports {
|
||||
public:
|
||||
|
||||
NS_IMETHOD
|
||||
SetDebugAgentPassword(PRInt32 pwd) = 0;
|
||||
|
||||
};
|
||||
|
||||
#define NS_ISYMANTECDEBUGMANAGER_IID \
|
||||
{ /* 131362e0-d985-11d1-8155-006008119d7a */ \
|
||||
0x131362e0, \
|
||||
|
@ -70,6 +62,15 @@ public:
|
|||
{0x81, 0x55, 0x00, 0x60, 0x08, 0x11, 0x9d, 0x7a} \
|
||||
}
|
||||
|
||||
class nsISymantecDebugManager : public nsISupports {
|
||||
public:
|
||||
NS_DEFINE_STATIC_IID_ACCESSOR(NS_ISYMANTECDEBUGMANAGER_IID)
|
||||
|
||||
NS_IMETHOD
|
||||
SetDebugAgentPassword(PRInt32 pwd) = 0;
|
||||
|
||||
};
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#endif /* nsISymantecDebugManager_h___ */
|
||||
|
|
|
@ -54,6 +54,8 @@
|
|||
#ifdef XP_UNIX
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsJVMConfigManagerUnix)
|
||||
#endif
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR(nsJVMManager)
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR(nsJVMAuthTools)
|
||||
|
||||
// The list of components we register
|
||||
static const nsModuleComponentInfo components[] =
|
||||
|
@ -61,13 +63,13 @@ static const nsModuleComponentInfo components[] =
|
|||
{ "JVM Manager Service",
|
||||
NS_JVMMANAGER_CID,
|
||||
"@mozilla.org/oji/jvm-mgr;1",
|
||||
nsJVMManager::Create
|
||||
nsJVMManagerConstructor
|
||||
},
|
||||
|
||||
{ "JVM Authentication Service",
|
||||
NS_JVMAUTHTOOLS_CID,
|
||||
"@mozilla.org/oji/jvm-auth-tools;1",
|
||||
nsJVMAuthTools::Create
|
||||
nsJVMAuthToolsConstructor
|
||||
},
|
||||
#ifdef XP_UNIX
|
||||
{ "JVM Config Manager",
|
||||
|
|
|
@ -40,8 +40,6 @@
|
|||
#include "nsJVMAuthTools.h"
|
||||
#include "nsIHttpAuthManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kIJVMAUTHTOOLSIID, NS_IJVMAUTHTOOLS_IID);
|
||||
static NS_DEFINE_CID(kHttpAuthManagerCID, NS_HTTPAUTHMANAGER_CID);
|
||||
|
||||
//---------------------------------------------------
|
||||
|
@ -94,46 +92,9 @@ nsJVMAuthTools::~nsJVMAuthTools(void)
|
|||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsJVMAuthTools::Create(nsISupports* outer,
|
||||
const nsIID& aIID,
|
||||
void* *aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
*aInstancePtr = nsnull;
|
||||
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
|
||||
nsJVMAuthTools* authtools = new nsJVMAuthTools(outer);
|
||||
if (authtools == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = authtools->AggregatedQueryInterface(aIID, aInstancePtr);
|
||||
if(NS_FAILED(rv))
|
||||
delete authtools;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsJVMAuthTools::AggregatedQueryInterface(const nsIID& aIID,
|
||||
void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(kIJVMAUTHTOOLSIID)) {
|
||||
*aInstancePtr = this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = GetInner();
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsJVMAuthTools)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJVMAuthTools)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_METHOD
|
||||
nsJVMAuthTools::GetAuthenticationInfo(const char* protocol,
|
||||
|
|
|
@ -63,9 +63,6 @@ public:
|
|||
NS_DECL_AGGREGATED
|
||||
NS_DECL_NSIJVMAUTHTOOLS
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
|
||||
nsJVMAuthTools(nsISupports* outer);
|
||||
virtual ~nsJVMAuthTools(void);
|
||||
};
|
||||
|
|
|
@ -345,26 +345,6 @@ nsJVMManager::PostEvent(PRThread* thread, nsIRunnable* runnable, PRBool async)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsJVMManager::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
*aInstancePtr = nsnull;
|
||||
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
nsJVMManager* jvmmgr = new nsJVMManager(outer);
|
||||
if (jvmmgr == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = jvmmgr->AggregatedQueryInterface(aIID, aInstancePtr);
|
||||
if(NS_FAILED(rv))
|
||||
delete jvmmgr;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsJVMManager::nsJVMManager(nsISupports* outer)
|
||||
: fJVM(NULL), fStatus(nsJVMStatus_Enabled),
|
||||
fDebugManager(NULL), fJSJavaVM(NULL),
|
||||
|
@ -399,7 +379,7 @@ nsJVMManager::~nsJVMManager()
|
|||
}
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsresult
|
||||
nsJVMManager::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(kIJVMManagerIID)) {
|
||||
|
@ -418,7 +398,7 @@ nsJVMManager::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
|||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = GetInner();
|
||||
*aInstancePtr = InnerObject();
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
@ -184,9 +184,6 @@ public:
|
|||
NS_IMETHOD
|
||||
GetClasspathAdditions(const char* *result);
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr);
|
||||
|
||||
nsIJVMPlugin* GetJVMPlugin(void) { return fJVM; }
|
||||
|
||||
/* Unlike the nsIJVMPlugin::StartupJVM, this version handles putting
|
||||
|
|
|
@ -43,7 +43,6 @@
|
|||
#undef Bool
|
||||
#endif
|
||||
|
||||
static NS_DEFINE_IID(kIJVMPluginTagInfoIID, NS_IJVMPLUGINTAGINFO_IID);
|
||||
static NS_DEFINE_IID(kIPluginTagInfo2IID, NS_IPLUGINTAGINFO2_IID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
@ -66,25 +65,9 @@ nsJVMPluginTagInfo::~nsJVMPluginTagInfo(void)
|
|||
}
|
||||
|
||||
NS_IMPL_AGGREGATED(nsJVMPluginTagInfo)
|
||||
|
||||
NS_METHOD
|
||||
nsJVMPluginTagInfo::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if(!aInstancePtr)
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
||||
if (aIID.Equals(kIJVMPluginTagInfoIID))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIJVMPluginTagInfo*, this);
|
||||
else if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF((nsISupports*)aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsJVMPluginTagInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIJVMPluginTagInfo)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
|
||||
static void
|
||||
|
|
|
@ -41,9 +41,6 @@
|
|||
|
||||
#include "nsJVMManager.h"
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_IID(kISymantecDebugManagerIID, NS_ISYMANTECDEBUGMANAGER_IID);
|
||||
|
||||
NS_IMPL_AGGREGATED(nsSymantecDebugManager)
|
||||
|
||||
nsSymantecDebugManager::nsSymantecDebugManager(nsISupports* outer, nsJVMManager* jvmMgr)
|
||||
|
@ -56,42 +53,27 @@ nsSymantecDebugManager::~nsSymantecDebugManager()
|
|||
{
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsSymantecDebugManager::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(kISymantecDebugManagerIID))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISymantecDebugManager*, this);
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsSymantecDebugManager)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISymantecDebugManager)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_METHOD
|
||||
nsSymantecDebugManager::Create(nsISupports* outer, const nsIID& aIID, void* *aInstancePtr,
|
||||
nsJVMManager* jvmMgr)
|
||||
{
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
if (outer && !aIID.Equals(kISupportsIID))
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
if (!aInstancePtr)
|
||||
return NS_ERROR_INVALID_POINTER;
|
||||
NS_ENSURE_PROPER_AGGREGATION(outer, aIID);
|
||||
|
||||
nsSymantecDebugManager* dbgr = new nsSymantecDebugManager(outer, jvmMgr);
|
||||
if (dbgr == NULL)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = dbgr->AggregatedQueryInterface(aIID, aInstancePtr);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete dbgr;
|
||||
return rv;
|
||||
}
|
||||
nsISupports* inner = dbgr->InnerObject();
|
||||
nsresult rv = inner->QueryInterface(aIID, aInstancePtr);
|
||||
if (NS_FAILED(rv)) {
|
||||
delete dbgr;
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -208,62 +208,16 @@ nsresult nsLoadGroup::Init()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_METHOD
|
||||
nsLoadGroup::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsresult rv;
|
||||
nsLoadGroup* group = new nsLoadGroup(aOuter);
|
||||
if (group == nsnull) {
|
||||
*aResult = nsnull;
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
rv = group->Init();
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
rv = group->AggregatedQueryInterface(aIID, aResult);
|
||||
}
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
delete group;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsISupports methods:
|
||||
|
||||
NS_IMPL_AGGREGATED(nsLoadGroup)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLoadGroup::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(NS_GET_IID(nsILoadGroup)) ||
|
||||
aIID.Equals(NS_GET_IID(nsIRequest)) ||
|
||||
aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsILoadGroup*, this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsISupportsPriority))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupportsPriority*,this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsISupportsWeakReference))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsISupportsWeakReference*,this);
|
||||
}
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsLoadGroup)
|
||||
NS_INTERFACE_MAP_ENTRY(nsILoadGroup)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequest)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsPriority)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIRequest methods:
|
||||
|
|
|
@ -75,13 +75,11 @@ public:
|
|||
// nsLoadGroup methods:
|
||||
|
||||
nsLoadGroup(nsISupports* outer);
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
nsresult Init();
|
||||
|
||||
protected:
|
||||
virtual ~nsLoadGroup();
|
||||
nsresult Init();
|
||||
|
||||
nsresult MergeLoadFlags(nsIRequest *aRequest, nsLoadFlags& flags);
|
||||
|
||||
|
|
|
@ -56,8 +56,6 @@ static NS_DEFINE_CID(kThisSimpleURIImplementationCID,
|
|||
NS_THIS_SIMPLEURI_IMPLEMENTATION_CID);
|
||||
static NS_DEFINE_CID(kSimpleURICID, NS_SIMPLEURI_CID);
|
||||
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsSimpleURI methods:
|
||||
|
||||
|
@ -72,13 +70,13 @@ nsSimpleURI::~nsSimpleURI()
|
|||
|
||||
NS_IMPL_AGGREGATED(nsSimpleURI)
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsresult
|
||||
nsSimpleURI::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = GetInner();
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aInstancePtr = InnerObject();
|
||||
} else if (aIID.Equals(kThisSimpleURIImplementationCID) || // used by Equals
|
||||
aIID.Equals(NS_GET_IID(nsIURI))) {
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIURI*, this);
|
||||
|
@ -363,28 +361,6 @@ nsSimpleURI::GetOriginCharset(nsACString &result)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_METHOD
|
||||
nsSimpleURI::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aResult);
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsSimpleURI* url = new nsSimpleURI(aOuter);
|
||||
if (url == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
nsresult rv = url->AggregatedQueryInterface(aIID, aResult);
|
||||
|
||||
if (NS_FAILED(rv))
|
||||
delete url;
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
// nsSimpleURI::nsIClassInfo
|
||||
//----------------------------------------------------------------------------
|
||||
|
|
|
@ -64,9 +64,6 @@ public:
|
|||
nsSimpleURI(nsISupports* outer);
|
||||
virtual ~nsSimpleURI();
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
protected:
|
||||
nsCString mScheme;
|
||||
nsCString mPath;
|
||||
|
|
|
@ -108,6 +108,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsSyncStreamListener, Init)
|
|||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsSafeFileOutputStream)
|
||||
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsLoadGroup, Init)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
extern NS_METHOD
|
||||
|
@ -229,6 +231,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsStdURLParser)
|
|||
#include "nsStandardURL.h"
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR(nsStandardURL)
|
||||
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR(nsSimpleURI)
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "nsIDNService.h"
|
||||
|
@ -656,7 +660,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
|||
{ NS_SIMPLEURI_CLASSNAME,
|
||||
NS_SIMPLEURI_CID,
|
||||
NS_SIMPLEURI_CONTRACTID,
|
||||
nsSimpleURI::Create },
|
||||
nsSimpleURIConstructor },
|
||||
{ NS_ASYNCSTREAMCOPIER_CLASSNAME,
|
||||
NS_ASYNCSTREAMCOPIER_CID,
|
||||
NS_ASYNCSTREAMCOPIER_CONTRACTID,
|
||||
|
@ -704,7 +708,7 @@ static const nsModuleComponentInfo gNetModuleInfo[] = {
|
|||
{ NS_LOADGROUP_CLASSNAME,
|
||||
NS_LOADGROUP_CID,
|
||||
NS_LOADGROUP_CONTRACTID,
|
||||
nsLoadGroup::Create },
|
||||
nsLoadGroupConstructor },
|
||||
{ NS_LOCALFILEINPUTSTREAM_CLASSNAME,
|
||||
NS_LOCALFILEINPUTSTREAM_CID,
|
||||
NS_LOCALFILEINPUTSTREAM_CONTRACTID,
|
||||
|
|
|
@ -54,12 +54,6 @@
|
|||
#include "NativeMonitor.h"
|
||||
#include "JavaMessageQueue.h"
|
||||
|
||||
#if 0
|
||||
static NS_DEFINE_IID(kISecureEnvIID, NS_ISECUREENV_IID);
|
||||
static NS_DEFINE_IID(kIRunnableIID, NS_IRUNNABLE_IID);
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
#endif
|
||||
|
||||
JavaMessageQueue::JavaMessageQueue(Monitor* monitor)
|
||||
: mFirst(NULL), mLast(NULL), mMonitor(monitor)
|
||||
{
|
||||
|
@ -318,27 +312,10 @@ void CSecureEnv::sendMessageFromJava(JNIEnv* javaEnv, JavaMessage* msg, Boolean
|
|||
|
||||
#if 0
|
||||
NS_IMPL_AGGREGATED(CSecureEnv)
|
||||
|
||||
NS_METHOD
|
||||
CSecureEnv::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
if (aIID.Equals(kISupportsIID)) {
|
||||
*aInstancePtr = GetInner();
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kISecureEnvIID)) {
|
||||
*aInstancePtr = (nsISecureEnv*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
if (aIID.Equals(kIRunnableIID)) {
|
||||
*aInstancePtr = (nsIRunnable*) this;
|
||||
AddRef();
|
||||
return NS_OK;
|
||||
}
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(CSecureEnv)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISecureEnv)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRunnable)
|
||||
NS_INTERFACE_MAP_END
|
||||
#endif
|
||||
|
||||
const InterfaceInfo CSecureEnv::sInterfaces[] = {
|
||||
|
|
|
@ -975,41 +975,13 @@ InMemoryDataSource::DeleteForwardArcsEntry(PLDHashTable* aTable, PLDHashEntryHdr
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_AGGREGATED(InMemoryDataSource)
|
||||
|
||||
NS_IMETHODIMP
|
||||
InMemoryDataSource::AggregatedQueryInterface(REFNSIID aIID, void** aResult)
|
||||
{
|
||||
NS_PRECONDITION(aResult != nsnull, "null ptr");
|
||||
if (! aResult)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports))) {
|
||||
*aResult = NS_STATIC_CAST(nsISupports*, &fAggregated);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIRDFDataSource))) {
|
||||
*aResult = NS_STATIC_CAST(nsIRDFDataSource*, this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIRDFInMemoryDataSource))) {
|
||||
*aResult = NS_STATIC_CAST(nsIRDFInMemoryDataSource*, this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIRDFPropagatableDataSource))) {
|
||||
*aResult = NS_STATIC_CAST(nsIRDFPropagatableDataSource*, this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(nsIRDFPurgeableDataSource))) {
|
||||
*aResult = NS_STATIC_CAST(nsIRDFPurgeableDataSource*, this);
|
||||
}
|
||||
else if (aIID.Equals(NS_GET_IID(rdfIDataSource))) {
|
||||
*aResult = NS_STATIC_CAST(rdfIDataSource*, this);
|
||||
}
|
||||
else {
|
||||
*aResult = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF(NS_STATIC_CAST(nsISupports*, *aResult));
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(InMemoryDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFInMemoryDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFPropagatableDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRDFPurgeableDataSource)
|
||||
NS_INTERFACE_MAP_ENTRY(rdfIDataSource)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
|
|
@ -49,20 +49,30 @@
|
|||
\
|
||||
public: \
|
||||
\
|
||||
/* You must implement this operation instead of the nsISupports */ \
|
||||
/* methods if you inherit from nsAggregated. */ \
|
||||
NS_IMETHOD \
|
||||
AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr); \
|
||||
/** \
|
||||
* Returns the nsISupports pointer of the inner object (aka the \
|
||||
* aggregatee). This pointer is really only useful to the outer object \
|
||||
* (aka the aggregator), which can use it to hold on to the inner \
|
||||
* object. Anything else wants the nsISupports pointer of the outer \
|
||||
* object (gotten by QI'ing inner or outer to nsISupports). This method \
|
||||
* returns a non-addrefed pointer. \
|
||||
* @return the nsISupports pointer of the inner object \
|
||||
*/ \
|
||||
nsISupports* InnerObject(void) { return &fAggregated; } \
|
||||
\
|
||||
protected: \
|
||||
private: \
|
||||
\
|
||||
/* You must implement this operation instead of the nsISupports */ \
|
||||
/* methods. */ \
|
||||
nsresult \
|
||||
AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr); \
|
||||
\
|
||||
class Internal : public nsISupports { \
|
||||
public: \
|
||||
\
|
||||
Internal() {} \
|
||||
\
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, \
|
||||
void** aInstancePtr); \
|
||||
NS_IMETHOD QueryInterface(const nsIID& aIID, void** aInstancePtr); \
|
||||
NS_IMETHOD_(nsrefcnt) AddRef(void); \
|
||||
NS_IMETHOD_(nsrefcnt) Release(void); \
|
||||
\
|
||||
|
@ -73,8 +83,6 @@ protected: \
|
|||
nsISupports* fOuter; \
|
||||
Internal fAggregated; \
|
||||
\
|
||||
nsISupports* GetInner(void) { return &fAggregated; } \
|
||||
\
|
||||
public: \
|
||||
|
||||
|
||||
|
@ -143,13 +151,64 @@ _class::Internal::Release(void) \
|
|||
NS_IMPL_AGGREGATED_QUERY_HEAD(_class)
|
||||
|
||||
#define NS_IMPL_AGGREGATED_QUERY_HEAD(_class) \
|
||||
NS_IMETHODIMP \
|
||||
nsresult \
|
||||
_class::AggregatedQueryInterface(REFNSIID aIID, void** aInstancePtr) \
|
||||
{ \
|
||||
NS_ASSERTION(aInstancePtr, \
|
||||
"AggregatedQueryInterface requires a non-NULL result ptr!"); \
|
||||
if ( !aInstancePtr ) \
|
||||
return NS_ERROR_NULL_POINTER; \
|
||||
nsISupports* foundInterface;
|
||||
nsISupports* foundInterface; \
|
||||
if ( aIID.Equals(NS_GET_IID(nsISupports)) ) \
|
||||
foundInterface = InnerObject(); \
|
||||
else
|
||||
|
||||
#define NS_GENERIC_AGGREGATED_CONSTRUCTOR(_InstanceClass) \
|
||||
static NS_METHOD \
|
||||
_InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||
void **aResult) \
|
||||
{ \
|
||||
*aResult = nsnull; \
|
||||
\
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID); \
|
||||
\
|
||||
_InstanceClass* inst = new _InstanceClass(aOuter); \
|
||||
if (!inst) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
\
|
||||
nsISupports* inner = inst->InnerObject(); \
|
||||
nsresult rv = inner->QueryInterface(aIID, aResult); \
|
||||
if (NS_FAILED(rv)) { \
|
||||
delete inst; \
|
||||
} \
|
||||
\
|
||||
return rv; \
|
||||
} \
|
||||
|
||||
#define NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(_InstanceClass, _InitMethod) \
|
||||
static NS_METHOD \
|
||||
_InstanceClass##Constructor(nsISupports *aOuter, REFNSIID aIID, \
|
||||
void **aResult) \
|
||||
{ \
|
||||
*aResult = nsnull; \
|
||||
\
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID); \
|
||||
\
|
||||
_InstanceClass* inst = new _InstanceClass(aOuter); \
|
||||
if (!inst) { \
|
||||
return NS_ERROR_OUT_OF_MEMORY; \
|
||||
} \
|
||||
\
|
||||
nsISupports* inner = inst->InnerObject(); \
|
||||
NS_ADDREF(inner); \
|
||||
nsresult rv = inst->_InitMethod(); \
|
||||
if (NS_SUCCEEDED(rv)) { \
|
||||
rv = inner->QueryInterface(aIID, aResult); \
|
||||
} \
|
||||
NS_RELEASE(inner); \
|
||||
\
|
||||
return rv; \
|
||||
} \
|
||||
|
||||
#endif /* nsAgg_h___ */
|
||||
|
|
|
@ -205,6 +205,8 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsTimelineService)
|
|||
|
||||
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(nsHashPropertyBag, Init)
|
||||
|
||||
NS_GENERIC_AGGREGATED_CONSTRUCTOR_INIT(nsProperties, Init)
|
||||
|
||||
static NS_METHOD
|
||||
nsXPTIInterfaceInfoManagerGetSingleton(nsISupports* outer,
|
||||
const nsIID& aIID,
|
||||
|
@ -320,7 +322,7 @@ static const nsModuleComponentInfo components[] = {
|
|||
COMPONENT(PIPE, nsPipeConstructor),
|
||||
|
||||
#define NS_PROPERTIES_CLASSNAME "Properties"
|
||||
COMPONENT(PROPERTIES, nsProperties::Create),
|
||||
COMPONENT(PROPERTIES, nsPropertiesConstructor),
|
||||
|
||||
#define NS_PERSISTENTPROPERTIES_CID NS_IPERSISTENTPROPERTIES_CID /* sigh */
|
||||
COMPONENT(PERSISTENTPROPERTIES, nsPersistentProperties::Create),
|
||||
|
|
|
@ -42,24 +42,9 @@
|
|||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
NS_IMPL_AGGREGATED(nsProperties)
|
||||
|
||||
NS_METHOD
|
||||
nsProperties::AggregatedQueryInterface(const nsIID& aIID, void** aInstancePtr)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aInstancePtr);
|
||||
|
||||
if (aIID.Equals(NS_GET_IID(nsISupports)))
|
||||
*aInstancePtr = GetInner();
|
||||
else if (aIID.Equals(NS_GET_IID(nsIProperties)))
|
||||
*aInstancePtr = NS_STATIC_CAST(nsIProperties*, this);
|
||||
else {
|
||||
*aInstancePtr = nsnull;
|
||||
return NS_NOINTERFACE;
|
||||
}
|
||||
|
||||
NS_ADDREF((nsISupports*)*aInstancePtr);
|
||||
return NS_OK;
|
||||
}
|
||||
NS_INTERFACE_MAP_BEGIN_AGGREGATED(nsProperties)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIProperties)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsProperties::Get(const char* prop, const nsIID & uuid, void* *result)
|
||||
|
@ -148,22 +133,4 @@ nsProperties::GetKeys(PRUint32 *count, char ***keys)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_METHOD
|
||||
nsProperties::Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)
|
||||
{
|
||||
NS_ENSURE_PROPER_AGGREGATION(aOuter, aIID);
|
||||
|
||||
nsProperties* props = new nsProperties(aOuter);
|
||||
if (props == nsnull)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
NS_ADDREF(props);
|
||||
nsresult rv = props->Init();
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = props->AggregatedQueryInterface(aIID, aResult);
|
||||
|
||||
NS_RELEASE(props);
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -66,9 +66,6 @@ public:
|
|||
|
||||
nsProperties(nsISupports *aOuter) { NS_INIT_AGGREGATED(aOuter); }
|
||||
|
||||
static NS_METHOD
|
||||
Create(nsISupports *aOuter, REFNSIID aIID, void **aResult);
|
||||
|
||||
private:
|
||||
~nsProperties() { }
|
||||
};
|
||||
|
|
Загрузка…
Ссылка в новой задаче