зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1437605 - part 1 - use NS_IMPL_QUERY_INTERFACE in js/xpconnect/; r=mccr8
This construct is nicer than NS_INTERFACE_MAP_BEGIN and assures the reader there's no weirdness in the QI implementation. This change does mean that PGO doesn't get an opportunity to measure the frequency of which interfaces are QI'd most often. I think this is probably an OK tradeoff to make, given the prevalence of NS_IMPL_QUERY_INTERFACE elsewhere in the codebase. The one thing we have to ensure with this change is that the ambiguous QI to nsISupports uses the proper class after the change. The NS_IMPL_QUERY_INTERFACE macro chooses the first interface listed to disambiguate the cast to nsISupports. In many cases, the ordering of the interfaces was already correct, but a few cases required reordering the interfaces.
This commit is contained in:
Родитель
28164f62e6
Коммит
276f4b0515
|
@ -622,11 +622,9 @@ nsXPCComponents_utils_Sandbox::~nsXPCComponents_utils_Sandbox()
|
|||
{
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_utils_Sandbox)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_utils_Sandbox)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_utils_Sandbox)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_utils_Sandbox,
|
||||
nsIXPCComponents_utils_Sandbox,
|
||||
nsIXPCScriptable)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_utils_Sandbox)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_utils_Sandbox)
|
||||
|
|
|
@ -187,12 +187,10 @@ nsXPCComponents_Interfaces::~nsXPCComponents_Interfaces()
|
|||
}
|
||||
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Interfaces)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Interfaces)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Interfaces)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_Interfaces,
|
||||
nsIXPCComponents_Interfaces,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo);
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_Interfaces)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_Interfaces)
|
||||
|
@ -391,12 +389,10 @@ nsXPCComponents_InterfacesByID::~nsXPCComponents_InterfacesByID()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_InterfacesByID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_InterfacesByID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_InterfacesByID)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_InterfacesByID,
|
||||
nsIXPCComponents_InterfacesByID,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_InterfacesByID)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_InterfacesByID)
|
||||
|
@ -595,12 +591,10 @@ nsXPCComponents_Classes::~nsXPCComponents_Classes()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Classes)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Classes)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Classes)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_Classes,
|
||||
nsIXPCComponents_Classes,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_Classes)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_Classes)
|
||||
|
@ -789,12 +783,10 @@ nsXPCComponents_ClassesByID::~nsXPCComponents_ClassesByID()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_ClassesByID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_ClassesByID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_ClassesByID)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_ClassesByID,
|
||||
nsIXPCComponents_ClassesByID,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_ClassesByID)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_ClassesByID)
|
||||
|
@ -1000,12 +992,10 @@ nsXPCComponents_Results::~nsXPCComponents_Results()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Results)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Results)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Results)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_Results,
|
||||
nsIXPCComponents_Results,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_Results)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_Results)
|
||||
|
@ -1167,12 +1157,10 @@ nsXPCComponents_ID::~nsXPCComponents_ID()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_ID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_ID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_ID)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_ID,
|
||||
nsIXPCComponents_ID,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_ID)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_ID)
|
||||
|
@ -1343,12 +1331,10 @@ nsXPCComponents_Exception::~nsXPCComponents_Exception()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Exception)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Exception)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Exception)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_Exception,
|
||||
nsIXPCComponents_Exception,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_Exception)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_Exception)
|
||||
|
@ -1708,12 +1694,10 @@ nsXPCConstructor::GetInitializer(char * *aInitializer)
|
|||
XPC_STRING_GETTER_BODY(aInitializer, mInitializer);
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCConstructor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCConstructor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCConstructor)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCConstructor,
|
||||
nsIXPCConstructor,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCConstructor)
|
||||
NS_IMPL_RELEASE(nsXPCConstructor)
|
||||
|
@ -1881,12 +1865,10 @@ nsXPCComponents_Constructor::~nsXPCComponents_Constructor()
|
|||
// empty
|
||||
}
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Constructor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Constructor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Constructor)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_Constructor,
|
||||
nsIXPCComponents_Constructor,
|
||||
nsIXPCScriptable,
|
||||
nsIClassInfo)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_Constructor)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_Constructor)
|
||||
|
@ -2078,11 +2060,9 @@ private:
|
|||
nsCOMPtr<nsIXPCComponents_utils_Sandbox> mSandbox;
|
||||
};
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsXPCComponents_Utils)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCComponents_Utils)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCComponents_Utils)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(nsXPCComponents_Utils,
|
||||
nsIXPCComponents_Utils,
|
||||
nsIXPCScriptable)
|
||||
|
||||
NS_IMPL_ADDREF(nsXPCComponents_Utils)
|
||||
NS_IMPL_RELEASE(nsXPCComponents_Utils)
|
||||
|
@ -3351,10 +3331,7 @@ ComponentsSH ComponentsSH::singleton(0);
|
|||
NS_IMETHODIMP_(MozExternalRefCountType) ComponentsSH::AddRef(void) { return 1; }
|
||||
NS_IMETHODIMP_(MozExternalRefCountType) ComponentsSH::Release(void) { return 1; }
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(ComponentsSH)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupports)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(ComponentsSH, nsIXPCScriptable)
|
||||
|
||||
#define NSXPCCOMPONENTSBASE_CID \
|
||||
{ 0xc62998e5, 0x95f1, 0x4058, \
|
||||
|
|
|
@ -214,10 +214,8 @@ public:
|
|||
SharedScriptableHelperForJSIID() {}
|
||||
};
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(SharedScriptableHelperForJSIID)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(SharedScriptableHelperForJSIID,
|
||||
nsIXPCScriptable)
|
||||
|
||||
NS_IMPL_ADDREF(SharedScriptableHelperForJSIID)
|
||||
NS_IMPL_RELEASE(SharedScriptableHelperForJSIID)
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
#include "nsIPrincipal.h"
|
||||
#include "mozilla/dom/BindingUtils.h"
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(BackstagePass)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIGlobalObject)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIClassInfo)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIScriptObjectPrincipal)
|
||||
NS_INTERFACE_MAP_ENTRY(nsISupportsWeakReference)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIXPCScriptable)
|
||||
NS_INTERFACE_MAP_END
|
||||
NS_IMPL_QUERY_INTERFACE(BackstagePass,
|
||||
nsIXPCScriptable,
|
||||
nsIGlobalObject,
|
||||
nsIClassInfo,
|
||||
nsIScriptObjectPrincipal,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
NS_IMPL_ADDREF(BackstagePass)
|
||||
NS_IMPL_RELEASE(BackstagePass)
|
||||
|
|
Загрузка…
Ссылка в новой задаче