Bug 1203427 (part 3) - Change order of InitCommon() arguments. r=froydnj.
authorNicholas Nethercote <nnethercote@mozilla.com>
Mon, 14 Sep 2015 15:57:17 -0700
changeset 262971 89de619e863b85ebb7f38432066e16f81ce89070
parent 262970 00eeeae71d651c4bfcc0ac0e55b0f95ca8006013
child 262972 afa92bf6913ed5a49e2de35ad9539da144a6f626
push idunknown
push userunknown
push dateunknown
reviewersfroydnj
bugs1203427
milestone43.0a1
Bug 1203427 (part 3) - Change order of InitCommon() arguments. r=froydnj. This makes the order of |aDelay| and |aType| match those of the InitWith*() functions. I've made this change because the inconsistency tripped me up during the development of part 4.
xpcom/threads/nsTimerImpl.cpp
xpcom/threads/nsTimerImpl.h
--- a/xpcom/threads/nsTimerImpl.cpp
+++ b/xpcom/threads/nsTimerImpl.cpp
@@ -183,17 +183,17 @@ nsTimerImpl::Shutdown()
   }
 
   gThread->Shutdown();
   NS_RELEASE(gThread);
 }
 
 
 nsresult
-nsTimerImpl::InitCommon(uint32_t aType, uint32_t aDelay)
+nsTimerImpl::InitCommon(uint32_t aDelay, uint32_t aType)
 {
   nsresult rv;
 
   if (NS_WARN_IF(!gThread)) {
     return NS_ERROR_NOT_INITIALIZED;
   }
   if (!mEventTarget) {
     NS_ERROR("mEventTarget is NULL");
@@ -226,49 +226,49 @@ nsTimerImpl::InitWithFuncCallback(nsTime
     return NS_ERROR_INVALID_ARG;
   }
 
   ReleaseCallback();
   mCallbackType = CallbackType::Function;
   mCallback.c = aFunc;
   mClosure = aClosure;
 
-  return InitCommon(aType, aDelay);
+  return InitCommon(aDelay, aType);
 }
 
 NS_IMETHODIMP
 nsTimerImpl::InitWithCallback(nsITimerCallback* aCallback,
                               uint32_t aDelay,
                               uint32_t aType)
 {
   if (NS_WARN_IF(!aCallback)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   ReleaseCallback();
   mCallbackType = CallbackType::Interface;
   mCallback.i = aCallback;
   NS_ADDREF(mCallback.i);
 
-  return InitCommon(aType, aDelay);
+  return InitCommon(aDelay, aType);
 }
 
 NS_IMETHODIMP
 nsTimerImpl::Init(nsIObserver* aObserver, uint32_t aDelay, uint32_t aType)
 {
   if (NS_WARN_IF(!aObserver)) {
     return NS_ERROR_INVALID_ARG;
   }
 
   ReleaseCallback();
   mCallbackType = CallbackType::Observer;
   mCallback.o = aObserver;
   NS_ADDREF(mCallback.o);
 
-  return InitCommon(aType, aDelay);
+  return InitCommon(aDelay, aType);
 }
 
 NS_IMETHODIMP
 nsTimerImpl::Cancel()
 {
   mCanceled = true;
 
   if (gThread) {
--- a/xpcom/threads/nsTimerImpl.h
+++ b/xpcom/threads/nsTimerImpl.h
@@ -72,17 +72,17 @@ private:
   enum class CallbackType : uint8_t {
     Unknown = 0,
     Interface = 1,
     Function = 2,
     Observer = 3,
   };
 
   ~nsTimerImpl();
-  nsresult InitCommon(uint32_t aType, uint32_t aDelay);
+  nsresult InitCommon(uint32_t aDelay, uint32_t aType);
 
   void ReleaseCallback()
   {
     // if we're the last owner of the callback object, make
     // sure that we don't recurse into ReleaseCallback in case
     // the callback's destructor calls Cancel() or similar.
     CallbackType cbType = mCallbackType;
     mCallbackType = CallbackType::Unknown;