Bug 1329857 - Remove NS_METHOD and NS_CALLBACK. r=froydnj.

Bug 1295053 removed most uses of NS_METHOD and NS_CALLBACK, but one use was
unintentionally left behind (in the XPIDL parser) and another has since crept
in (in MediaDrmCDMProxy.h).

So this patch removes NS_METHOD and NS_CALLBACK. NS_METHOD_(nsresult) and
NS_CALLBACK_(nsresult, T) can still be used for the same purpose, but those
alternatives are less likely to be used unintentionally.

--HG--
extra : rebase_source : a50fc7b2a64a36d1ca9beda81bc0edb8f2ec1934
This commit is contained in:
Nicholas Nethercote 2017-01-10 14:08:43 +11:00
Родитель 2b6f1ffa12
Коммит 949658eb73
6 изменённых файлов: 34 добавлений и 34 удалений

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

@ -154,7 +154,7 @@ private:
, mReason(aReason)
{
}
NS_METHOD Run() {
NS_IMETHOD Run() override {
mProxy->RejectPromise(mId, mCode, mReason);
return NS_OK;
}
@ -182,4 +182,4 @@ private:
} // namespace mozilla
#endif // MediaDrmCDMProxy_h_
#endif // MediaDrmCDMProxy_h_

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

@ -87,6 +87,15 @@
#define NS_CONSTRUCTOR_FASTCALL
#endif
/**
* Various API modifiers.
*
* - NS_IMETHOD/NS_IMETHOD_: use for in-class declarations and definitions.
* - NS_IMETHODIMP/NS_IMETHODIMP_: use for out-of-class definitions.
* - NS_METHOD_: usually used in conjunction with NS_CALLBACK_. Best avoided.
* - NS_CALLBACK_: used in some legacy situations. Best avoided.
*/
#ifdef XP_WIN
#define NS_IMPORT __declspec(dllimport)
@ -121,6 +130,9 @@
#endif
#define NS_IMETHOD NS_IMETHOD_(nsresult)
#define NS_IMETHODIMP NS_IMETHODIMP_(nsresult)
/**
* Macro for creating typedefs for pointer-to-member types which are
* declared with stdcall. It is important to use this for any type which is
@ -159,19 +171,6 @@
# define MOZ_DEPRECATED
#endif
/**
* Generic API modifiers which return the standard XPCOM nsresult type
*
* - NS_IMETHOD: use for in-class declarations and definitions.
* - NS_IMETHODIMP: use for out-of-class definitions.
* - NS_METHOD: usually used in conjunction with NS_CALLBACK.
* - NS_CALLBACK: used in some legacy situations. Best avoided.
*/
#define NS_IMETHOD NS_IMETHOD_(nsresult)
#define NS_IMETHODIMP NS_IMETHODIMP_(nsresult)
#define NS_METHOD NS_METHOD_(nsresult)
#define NS_CALLBACK(_name) NS_CALLBACK_(nsresult, _name)
/**
* Import/Export macros for XPCOM APIs
*/

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

@ -112,7 +112,7 @@ typedef void (*CycleCollectorSuspect3Func)(void*,
nsCycleCollectingAutoRefCnt*,
bool*);
// PRIVATE AND DEPRECATED
typedef NS_CALLBACK(XPCOMExitRoutine)(void);
typedef NS_CALLBACK_(nsresult, XPCOMExitRoutine)(void);
typedef nsresult (*RegisterXPCOMExitRoutineFunc)(XPCOMExitRoutine aExitRoutine,
uint32_t aPriority);

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

@ -89,12 +89,13 @@ class GenericClassInfo : public nsIClassInfo
public:
struct ClassInfoData
{
// This function pointer uses NS_CALLBACK because it's always set to an
// This function pointer uses NS_CALLBACK_ because it's always set to an
// NS_IMETHOD function, which uses __stdcall on Win32.
typedef NS_CALLBACK(GetInterfacesProc)(uint32_t* aCountP, nsIID*** aArray);
typedef NS_CALLBACK_(nsresult, GetInterfacesProc)(uint32_t* aCountP,
nsIID*** aArray);
GetInterfacesProc getinterfaces;
// This function pointer doesn't use NS_CALLBACK because it's always set to
// This function pointer doesn't use NS_CALLBACK_ because it's always set to
// a vanilla function.
typedef nsresult (*GetScriptableHelperProc)(nsIXPCScriptable** aHelper);
GetScriptableHelperProc getscriptablehelper;

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

@ -460,7 +460,7 @@ def write_interface(iface, fd):
fd.write(iface_epilog % names)
def writeDeclaration(fd, iface, virtual):
declType = "NS_IMETHOD" if virtual else "NS_METHOD"
declType = "NS_IMETHOD" if virtual else "nsresult"
suffix = " override" if virtual else ""
for member in iface.members:
if isinstance(member, xpidl.Attribute):

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

@ -243,7 +243,7 @@ nsTimerImpl::InitWithFuncCallbackCommon(nsTimerCallbackFunc aFunc,
return InitCommon(aDelay, aType);
}
NS_IMETHODIMP
nsresult
nsTimerImpl::InitWithFuncCallback(nsTimerCallbackFunc aFunc,
void* aClosure,
uint32_t aDelay,
@ -253,7 +253,7 @@ nsTimerImpl::InitWithFuncCallback(nsTimerCallbackFunc aFunc,
return InitWithFuncCallbackCommon(aFunc, aClosure, aDelay, aType, name);
}
NS_IMETHODIMP
nsresult
nsTimerImpl::InitWithNamedFuncCallback(nsTimerCallbackFunc aFunc,
void* aClosure,
uint32_t aDelay,
@ -264,7 +264,7 @@ nsTimerImpl::InitWithNamedFuncCallback(nsTimerCallbackFunc aFunc,
return InitWithFuncCallbackCommon(aFunc, aClosure, aDelay, aType, name);
}
NS_IMETHODIMP
nsresult
nsTimerImpl::InitWithNameableFuncCallback(nsTimerCallbackFunc aFunc,
void* aClosure,
uint32_t aDelay,
@ -275,7 +275,7 @@ nsTimerImpl::InitWithNameableFuncCallback(nsTimerCallbackFunc aFunc,
return InitWithFuncCallbackCommon(aFunc, aClosure, aDelay, aType, name);
}
NS_IMETHODIMP
nsresult
nsTimerImpl::InitWithCallback(nsITimerCallback* aCallback,
uint32_t aDelay,
uint32_t aType)
@ -292,7 +292,7 @@ nsTimerImpl::InitWithCallback(nsITimerCallback* aCallback,
return InitCommon(aDelay, aType);
}
NS_IMETHODIMP
nsresult
nsTimerImpl::Init(nsIObserver* aObserver, uint32_t aDelay, uint32_t aType)
{
if (NS_WARN_IF(!aObserver)) {
@ -307,7 +307,7 @@ nsTimerImpl::Init(nsIObserver* aObserver, uint32_t aDelay, uint32_t aType)
return InitCommon(aDelay, aType);
}
NS_IMETHODIMP
nsresult
nsTimerImpl::Cancel()
{
@ -334,7 +334,7 @@ nsTimerImpl::Neuter()
++mGeneration;
}
NS_IMETHODIMP
nsresult
nsTimerImpl::SetDelay(uint32_t aDelay)
{
if (mCallbackType == CallbackType::Unknown && mType == nsITimer::TYPE_ONE_SHOT) {
@ -359,14 +359,14 @@ nsTimerImpl::SetDelay(uint32_t aDelay)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsTimerImpl::GetDelay(uint32_t* aDelay)
{
*aDelay = mDelay;
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsTimerImpl::SetType(uint32_t aType)
{
mType = (uint8_t)aType;
@ -376,7 +376,7 @@ nsTimerImpl::SetType(uint32_t aType)
return NS_OK;
}
NS_IMETHODIMP
nsresult
nsTimerImpl::GetType(uint32_t* aType)
{
*aType = mType;
@ -384,7 +384,7 @@ nsTimerImpl::GetType(uint32_t* aType)
}
NS_IMETHODIMP
nsresult
nsTimerImpl::GetClosure(void** aClosure)
{
*aClosure = mClosure;
@ -392,7 +392,7 @@ nsTimerImpl::GetClosure(void** aClosure)
}
NS_IMETHODIMP
nsresult
nsTimerImpl::GetCallback(nsITimerCallback** aCallback)
{
if (mCallbackType == CallbackType::Interface) {
@ -405,7 +405,7 @@ nsTimerImpl::GetCallback(nsITimerCallback** aCallback)
}
NS_IMETHODIMP
nsresult
nsTimerImpl::GetTarget(nsIEventTarget** aTarget)
{
NS_IF_ADDREF(*aTarget = mEventTarget);
@ -413,7 +413,7 @@ nsTimerImpl::GetTarget(nsIEventTarget** aTarget)
}
NS_IMETHODIMP
nsresult
nsTimerImpl::SetTarget(nsIEventTarget* aTarget)
{
if (NS_WARN_IF(mCallbackType != CallbackType::Unknown)) {