Bug 514280 Only use nsCOMPtr for interfaces r=bsmedberg

This commit is contained in:
Neil Rashbrook 2014-05-11 10:47:11 +01:00
Родитель c0394c6fd2
Коммит 5b3f3e053a
8 изменённых файлов: 59 добавлений и 12 удалений

Просмотреть файл

@ -315,6 +315,13 @@ struct FireChangeArgs {
bool mHaveImageOverride; bool mHaveImageOverride;
}; };
// XXX Workaround for bug 980560 to maintain the existing broken semantics
template<>
struct nsIStyleRule::COMTypeInfo<css::Rule, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsIStyleRule::COMTypeInfo<css::Rule, void>::kIID = NS_ISTYLE_RULE_IID;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

Просмотреть файл

@ -298,6 +298,13 @@ MaybeTestPBackground()
#endif #endif
} }
// XXX Workaround for bug 986973 to maintain the existing broken semantics
template<>
struct nsIConsoleService::COMTypeInfo<nsConsoleService, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsIConsoleService::COMTypeInfo<nsConsoleService, void>::kIID = NS_ICONSOLESERVICE_IID;
namespace mozilla { namespace mozilla {
namespace dom { namespace dom {

Просмотреть файл

@ -59,6 +59,18 @@
#undef GetCurrentTime #undef GetCurrentTime
#endif #endif
// XXX Workaround for bug 986974 to maintain the existing broken semantics
template<>
struct nsIMediaDevice::COMTypeInfo<mozilla::VideoDevice, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsIMediaDevice::COMTypeInfo<mozilla::VideoDevice, void>::kIID = NS_IMEDIADEVICE_IID;
template<>
struct nsIMediaDevice::COMTypeInfo<mozilla::AudioDevice, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsIMediaDevice::COMTypeInfo<mozilla::AudioDevice, void>::kIID = NS_IMEDIADEVICE_IID;
namespace mozilla { namespace mozilla {
#ifdef LOG #ifdef LOG

Просмотреть файл

@ -148,6 +148,12 @@ PRLogModuleInfo *signalingLogInfo() {
return logModuleInfo; return logModuleInfo;
} }
// XXX Workaround for bug 998092 to maintain the existing broken semantics
template<>
struct nsISupportsWeakReference::COMTypeInfo<nsSupportsWeakReference, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsISupportsWeakReference::COMTypeInfo<nsSupportsWeakReference, void>::kIID = NS_ISUPPORTSWEAKREFERENCE_IID;
namespace sipcc { namespace sipcc {

Просмотреть файл

@ -55,6 +55,13 @@ nsAndroidHandlerApp::SetDetailedDescription(const nsAString & aDescription)
return NS_OK; return NS_OK;
} }
// XXX Workaround for bug 986975 to maintain the existing broken semantics
template<>
struct nsISharingHandlerApp::COMTypeInfo<nsAndroidHandlerApp, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsISharingHandlerApp::COMTypeInfo<nsAndroidHandlerApp, void>::kIID = NS_IHANDLERAPP_IID;
NS_IMETHODIMP NS_IMETHODIMP
nsAndroidHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *aRetval) nsAndroidHandlerApp::Equals(nsIHandlerApp *aHandlerApp, bool *aRetval)
{ {

Просмотреть файл

@ -402,6 +402,13 @@ nsMIMEInfoAndroid::SystemChooser::SetDetailedDescription(const nsAString&) {
return NS_OK; return NS_OK;
} }
// XXX Workaround for bug 986975 to maintain the existing broken semantics
template<>
struct nsIHandlerApp::COMTypeInfo<nsMIMEInfoAndroid::SystemChooser, void> {
static const nsIID kIID NS_HIDDEN;
};
const nsIID nsIHandlerApp::COMTypeInfo<nsMIMEInfoAndroid::SystemChooser, void>::kIID = NS_IHANDLERAPP_IID;
nsresult nsresult
nsMIMEInfoAndroid::SystemChooser::Equals(nsIHandlerApp *aHandlerApp, bool *aRetVal) { nsMIMEInfoAndroid::SystemChooser::Equals(nsIHandlerApp *aHandlerApp, bool *aRetVal) {
nsCOMPtr<nsMIMEInfoAndroid::SystemChooser> info = do_QueryInterface(aHandlerApp); nsCOMPtr<nsMIMEInfoAndroid::SystemChooser> info = do_QueryInterface(aHandlerApp);

Просмотреть файл

@ -113,19 +113,20 @@ typedef nsID nsIID;
* A macro to build the static const IID accessor method. The Dummy * A macro to build the static const IID accessor method. The Dummy
* template parameter only exists so that the kIID symbol will be linked * template parameter only exists so that the kIID symbol will be linked
* properly (weak symbol on linux, gnu_linkonce on mac, multiple-definitions * properly (weak symbol on linux, gnu_linkonce on mac, multiple-definitions
* merged on windows). Dummy should always be instantiated as "int". * merged on windows). Dummy should always be instantiated as "void".
*/ */
#define NS_DECLARE_STATIC_IID_ACCESSOR(the_iid) \ #define NS_DECLARE_STATIC_IID_ACCESSOR(the_iid) \
template <class Dummy> \ template<typename T, typename U> \
struct COMTypeInfo \ struct COMTypeInfo;
{ \
static const nsIID kIID NS_HIDDEN; \
};
#define NS_DEFINE_STATIC_IID_ACCESSOR(the_interface, the_iid) \ #define NS_DEFINE_STATIC_IID_ACCESSOR(the_interface, the_iid) \
template <class Dummy> \ template <typename T> \
const nsIID the_interface::COMTypeInfo<Dummy>::kIID NS_HIDDEN = the_iid; struct the_interface::COMTypeInfo<the_interface, T> { \
static const nsIID kIID NS_HIDDEN; \
}; \
template <typename T> \
const nsIID the_interface::COMTypeInfo<the_interface, T>::kIID NS_HIDDEN = the_iid;
/** /**
* A macro to build the static const CID accessor method * A macro to build the static const CID accessor method
@ -134,7 +135,7 @@ typedef nsID nsIID;
#define NS_DEFINE_STATIC_CID_ACCESSOR(the_cid) \ #define NS_DEFINE_STATIC_CID_ACCESSOR(the_cid) \
static const nsID& GetCID() {static const nsID cid = the_cid; return cid;} static const nsID& GetCID() {static const nsID cid = the_cid; return cid;}
#define NS_GET_IID(T) (T::COMTypeInfo<int>::kIID) #define NS_GET_IID(T) (T::COMTypeInfo<T, void>::kIID)
#define NS_GET_TEMPLATE_IID(T) (T::template COMTypeInfo<int>::kIID) #define NS_GET_TEMPLATE_IID(T) (T::template COMTypeInfo<T, void>::kIID)
#endif #endif

Просмотреть файл

@ -662,14 +662,14 @@ NS_IMETHODIMP _class::QueryInterface(REFNSIID aIID, void** aInstancePtr) \
static const QITableEntry table[] = { static const QITableEntry table[] = {
#define NS_INTERFACE_TABLE_ENTRY(_class, _interface) \ #define NS_INTERFACE_TABLE_ENTRY(_class, _interface) \
{ &_interface::COMTypeInfo<int>::kIID, \ { &NS_GET_IID(_interface), \
int32_t(reinterpret_cast<char*>( \ int32_t(reinterpret_cast<char*>( \
static_cast<_interface*>((_class*) 0x1000)) - \ static_cast<_interface*>((_class*) 0x1000)) - \
reinterpret_cast<char*>((_class*) 0x1000)) \ reinterpret_cast<char*>((_class*) 0x1000)) \
}, },
#define NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, _interface, _implClass) \ #define NS_INTERFACE_TABLE_ENTRY_AMBIGUOUS(_class, _interface, _implClass) \
{ &_interface::COMTypeInfo<int>::kIID, \ { &NS_GET_IID(_interface), \
int32_t(reinterpret_cast<char*>( \ int32_t(reinterpret_cast<char*>( \
static_cast<_interface*>( \ static_cast<_interface*>( \
static_cast<_implClass*>( \ static_cast<_implClass*>( \