From 060123c88a08d5aaeb7c158cb8b5df1677d9b33a Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Mon, 15 Aug 2016 14:29:43 +1000 Subject: [PATCH] Bug 1295053 (part 1) - Don't use NS_METHOD for xpcom thread utility functions. r=froydnj. These don't need __stdcall on Win32. --HG-- extra : rebase_source : 9af47c64571a2c7459f95c46e737c5ef50d47909 --- xpcom/glue/MainThreadUtils.h | 2 +- xpcom/glue/nsThreadUtils.cpp | 16 ++++++++-------- xpcom/glue/nsThreadUtils.h | 16 ++++++++-------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/xpcom/glue/MainThreadUtils.h b/xpcom/glue/MainThreadUtils.h index e03f39f69dd5..8d76f84ec5c8 100644 --- a/xpcom/glue/MainThreadUtils.h +++ b/xpcom/glue/MainThreadUtils.h @@ -17,7 +17,7 @@ class nsIThread; * @param aResult * The resulting nsIThread object. */ -extern NS_METHOD NS_GetMainThread(nsIThread** aResult); +extern nsresult NS_GetMainThread(nsIThread** aResult); #ifdef MOZILLA_INTERNAL_API // Fast access to the current thread. Do not release the returned pointer! If diff --git a/xpcom/glue/nsThreadUtils.cpp b/xpcom/glue/nsThreadUtils.cpp index 8f80cfebb5ad..541555dedd68 100644 --- a/xpcom/glue/nsThreadUtils.cpp +++ b/xpcom/glue/nsThreadUtils.cpp @@ -55,7 +55,7 @@ CancelableRunnable::Cancel() //----------------------------------------------------------------------------- -NS_METHOD +nsresult NS_NewThread(nsIThread** aResult, nsIRunnable* aEvent, uint32_t aStackSize) { nsCOMPtr thread; @@ -89,7 +89,7 @@ NS_NewThread(nsIThread** aResult, nsIRunnable* aEvent, uint32_t aStackSize) return NS_OK; } -NS_METHOD +nsresult NS_GetCurrentThread(nsIThread** aResult) { #ifdef MOZILLA_INTERNAL_API @@ -105,7 +105,7 @@ NS_GetCurrentThread(nsIThread** aResult) #endif } -NS_METHOD +nsresult NS_GetMainThread(nsIThread** aResult) { #ifdef MOZILLA_INTERNAL_API @@ -135,7 +135,7 @@ NS_IsMainThread() } #endif -NS_METHOD +nsresult NS_DispatchToCurrentThread(already_AddRefed&& aEvent) { nsresult rv; @@ -168,14 +168,14 @@ NS_DispatchToCurrentThread(already_AddRefed&& aEvent) // It is common to call NS_DispatchToCurrentThread with a newly // allocated runnable with a refcount of zero. To keep us from leaking // the runnable if the dispatch method fails, we take a death grip. -NS_METHOD +nsresult NS_DispatchToCurrentThread(nsIRunnable* aEvent) { nsCOMPtr event(aEvent); return NS_DispatchToCurrentThread(event.forget()); } -NS_METHOD +nsresult NS_DispatchToMainThread(already_AddRefed&& aEvent, uint32_t aDispatchFlags) { LeakRefPtr event(Move(aEvent)); @@ -195,7 +195,7 @@ NS_DispatchToMainThread(already_AddRefed&& aEvent, uint32_t aDispat // likely that the runnable is being dispatched to the main thread // because it owns main thread only objects, so it is not safe to // release them here. -NS_METHOD +nsresult NS_DispatchToMainThread(nsIRunnable* aEvent, uint32_t aDispatchFlags) { nsCOMPtr event(aEvent); @@ -203,7 +203,7 @@ NS_DispatchToMainThread(nsIRunnable* aEvent, uint32_t aDispatchFlags) } #ifndef XPCOM_GLUE_AVOID_NSPR -NS_METHOD +nsresult NS_ProcessPendingEvents(nsIThread* aThread, PRIntervalTime aTimeout) { nsresult rv = NS_OK; diff --git a/xpcom/glue/nsThreadUtils.h b/xpcom/glue/nsThreadUtils.h index 4a5d1f113afc..2f2fad68f2e0 100644 --- a/xpcom/glue/nsThreadUtils.h +++ b/xpcom/glue/nsThreadUtils.h @@ -59,7 +59,7 @@ NS_SetThreadName(nsIThread* aThread, const char (&aName)[LEN]) * @returns NS_ERROR_INVALID_ARG * Indicates that the given name is not unique. */ -extern NS_METHOD +extern nsresult NS_NewThread(nsIThread** aResult, nsIRunnable* aInitialEvent = nullptr, uint32_t aStackSize = nsIThreadManager::DEFAULT_STACK_SIZE); @@ -68,7 +68,7 @@ NS_NewThread(nsIThread** aResult, * Creates a named thread, otherwise the same as NS_NewThread */ template -inline NS_METHOD +inline nsresult NS_NewNamedThread(const char (&aName)[LEN], nsIThread** aResult, nsIRunnable* aInitialEvent = nullptr, @@ -97,7 +97,7 @@ NS_NewNamedThread(const char (&aName)[LEN], * @param aResult * The resulting nsIThread object. */ -extern NS_METHOD NS_GetCurrentThread(nsIThread** aResult); +extern nsresult NS_GetCurrentThread(nsIThread** aResult); /** * Dispatch the given event to the current thread. @@ -108,8 +108,8 @@ extern NS_METHOD NS_GetCurrentThread(nsIThread** aResult); * @returns NS_ERROR_INVALID_ARG * If event is null. */ -extern NS_METHOD NS_DispatchToCurrentThread(nsIRunnable* aEvent); -extern NS_METHOD +extern nsresult NS_DispatchToCurrentThread(nsIRunnable* aEvent); +extern nsresult NS_DispatchToCurrentThread(already_AddRefed&& aEvent); /** @@ -123,10 +123,10 @@ NS_DispatchToCurrentThread(already_AddRefed&& aEvent); * @returns NS_ERROR_INVALID_ARG * If event is null. */ -extern NS_METHOD +extern nsresult NS_DispatchToMainThread(nsIRunnable* aEvent, uint32_t aDispatchFlags = NS_DISPATCH_NORMAL); -extern NS_METHOD +extern nsresult NS_DispatchToMainThread(already_AddRefed&& aEvent, uint32_t aDispatchFlags = NS_DISPATCH_NORMAL); @@ -146,7 +146,7 @@ NS_DispatchToMainThread(already_AddRefed&& aEvent, * value is simply used to determine whether or not to process another event. * Pass PR_INTERVAL_NO_TIMEOUT to specify no timeout. */ -extern NS_METHOD +extern nsresult NS_ProcessPendingEvents(nsIThread* aThread, PRIntervalTime aTimeout = PR_INTERVAL_NO_TIMEOUT); #endif