Bug 711818 - MOZILLA_GUARD_OBJECT_NOTIFIER* should use a MOZ_ prefix to follow MFBT style
authorMichael Kohler <michaelkohler@linux.com>
Tue, 10 Jan 2012 00:29:30 -0500
changeset 86523 71eb0a8829cf659a19c5a434b1e687e9cef5b540
parent 86522 2a35bcdd7c1ea8b55e9052c4aa30bb79f8cc916a
child 86524 51cc1b5c935afe6084dd9d33f9c638b23153b1b2
push idunknown
push userunknown
push dateunknown
bugs711818
milestone12.0a1
Bug 711818 - MOZILLA_GUARD_OBJECT_NOTIFIER* should use a MOZ_ prefix to follow MFBT style
content/base/public/nsContentUtils.h
content/base/public/nsDOMFile.h
content/base/src/nsDOMFile.cpp
content/base/src/nsFrameLoader.cpp
js/xpconnect/src/xpcprivate.h
mfbt/GuardObjects.h
toolkit/components/telemetry/Telemetry.h
xpcom/glue/AutoRestore.h
xpcom/glue/Mutex.h
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -1984,25 +1984,25 @@ private:
   bool mPushedSomething;
 #ifdef DEBUG
   JSContext* mPushedContext;
 #endif
 };
 
 class NS_STACK_CLASS nsAutoScriptBlocker {
 public:
-  nsAutoScriptBlocker(MOZILLA_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
-    MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+  nsAutoScriptBlocker(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM) {
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     nsContentUtils::AddScriptBlocker();
   }
   ~nsAutoScriptBlocker() {
     nsContentUtils::RemoveScriptBlocker();
   }
 private:
-  MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 class NS_STACK_CLASS nsAutoScriptBlockerSuppressNodeRemoved :
                           public nsAutoScriptBlocker {
 public:
   nsAutoScriptBlockerSuppressNodeRemoved() {
 #ifdef DEBUG
     ++nsContentUtils::sDOMNodeRemovedSuppressCount;
--- a/content/base/public/nsDOMFile.h
+++ b/content/base/public/nsDOMFile.h
@@ -376,16 +376,16 @@ public:
 
 private:
   PRUint16 mCode;
 };
 
 class NS_STACK_CLASS nsDOMFileInternalUrlHolder {
 public:
   nsDOMFileInternalUrlHolder(nsIDOMBlob* aFile, nsIPrincipal* aPrincipal
-                             MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM);
+                             MOZ_GUARD_OBJECT_NOTIFIER_PARAM);
   ~nsDOMFileInternalUrlHolder();
   nsAutoString mUrl;
 private:
-  MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 #endif
--- a/content/base/src/nsDOMFile.cpp
+++ b/content/base/src/nsDOMFile.cpp
@@ -654,18 +654,18 @@ nsDOMFileError::GetCode(PRUint16* aCode)
   return NS_OK;
 }
 
 ////////////////////////////////////////////////////////////////////////////
 // nsDOMFileInternalUrlHolder implementation
 
 nsDOMFileInternalUrlHolder::nsDOMFileInternalUrlHolder(nsIDOMBlob* aFile,
                                                        nsIPrincipal* aPrincipal
-                                                       MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) {
-  MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+                                                       MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL) {
+  MOZ_GUARD_OBJECT_NOTIFIER_INIT;
   aFile->GetInternalUrl(aPrincipal, mUrl);
 }
  
 nsDOMFileInternalUrlHolder::~nsDOMFileInternalUrlHolder() {
   if (!mUrl.IsEmpty()) {
     nsCAutoString narrowUrl;
     CopyUTF16toUTF8(mUrl, narrowUrl);
     nsFileDataProtocolHandler::RemoveFileDataEntry(narrowUrl);
--- a/content/base/src/nsFrameLoader.cpp
+++ b/content/base/src/nsFrameLoader.cpp
@@ -737,22 +737,22 @@ AllDescendantsOfType(nsIDocShellTreeItem
 
 /**
  * A class that automatically sets mInShow to false when it goes
  * out of scope.
  */
 class NS_STACK_CLASS AutoResetInShow {
   private:
     nsFrameLoader* mFrameLoader;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
   public:
-    AutoResetInShow(nsFrameLoader* aFrameLoader MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+    AutoResetInShow(nsFrameLoader* aFrameLoader MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : mFrameLoader(aFrameLoader)
     {
-      MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+      MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
     ~AutoResetInShow() { mFrameLoader->mInShow = false; }
 };
 
 
 bool
 nsFrameLoader::Show(PRInt32 marginWidth, PRInt32 marginHeight,
                     PRInt32 scrollbarPrefX, PRInt32 scrollbarPrefY,
--- a/js/xpconnect/src/xpcprivate.h
+++ b/js/xpconnect/src/xpcprivate.h
@@ -365,34 +365,34 @@ static inline void xpc_NotifyAll(XPCLock
 class NS_STACK_CLASS XPCAutoLock {
 public:
 
     static XPCLock* NewLock(const char* name)
                         {return new mozilla::ReentrantMonitor(name);}
     static void     DestroyLock(XPCLock* lock)
                         {delete lock;}
 
-    XPCAutoLock(XPCLock* lock MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+    XPCAutoLock(XPCLock* lock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
         : mLock(lock)
     {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         if (mLock)
             mLock->Enter();
     }
 
     ~XPCAutoLock()
     {
         if (mLock) {
             mLock->Exit();
         }
     }
 
 private:
     XPCLock*  mLock;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
     // Not meant to be implemented. This makes it a compiler error to
     // construct or assign an XPCAutoLock object incorrectly.
     XPCAutoLock(void) {}
     XPCAutoLock(XPCAutoLock& /*aMon*/) {}
     XPCAutoLock& operator =(XPCAutoLock& /*aMon*/) {
         return *this;
     }
@@ -404,34 +404,34 @@ private:
     }
     static void operator delete(void* /*memory*/) {}
 };
 
 /************************************************/
 
 class NS_STACK_CLASS XPCAutoUnlock {
 public:
-    XPCAutoUnlock(XPCLock* lock MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+    XPCAutoUnlock(XPCLock* lock MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
         : mLock(lock)
     {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         if (mLock) {
             mLock->Exit();
         }
     }
 
     ~XPCAutoUnlock()
     {
         if (mLock)
             mLock->Enter();
     }
 
 private:
     XPCLock*  mLock;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
     // Not meant to be implemented. This makes it a compiler error to
     // construct or assign an XPCAutoUnlock object incorrectly.
     XPCAutoUnlock(void) {}
     XPCAutoUnlock(XPCAutoUnlock& /*aMon*/) {}
     XPCAutoUnlock& operator =(XPCAutoUnlock& /*aMon*/) {
         return *this;
     }
@@ -3902,49 +3902,49 @@ private:
 };
 
 /***************************************************************************/
 
 class NS_STACK_CLASS AutoJSErrorAndExceptionEater
 {
 public:
     AutoJSErrorAndExceptionEater(JSContext* aCX
-                                 MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+                                 MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
         : mCX(aCX),
           mOldErrorReporter(JS_SetErrorReporter(mCX, nsnull)),
           mOldExceptionState(JS_SaveExceptionState(mCX)) {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
     ~AutoJSErrorAndExceptionEater()
     {
         JS_SetErrorReporter(mCX, mOldErrorReporter);
         JS_RestoreExceptionState(mCX, mOldExceptionState);
     }
 private:
     JSContext*        mCX;
     JSErrorReporter   mOldErrorReporter;
     JSExceptionState* mOldExceptionState;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /******************************************************************************
  * Handles pre/post script processing and the setting/resetting the error
  * reporter
  */
 class NS_STACK_CLASS AutoScriptEvaluate
 {
 public:
     /**
      * Saves the JSContext as well as initializing our state
      * @param cx The JSContext, this can be null, we don't do anything then
      */
-    AutoScriptEvaluate(JSContext * cx MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+    AutoScriptEvaluate(JSContext * cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
          : mJSContext(cx), mState(0), mErrorReporterSet(false),
            mEvaluated(false), mContextHasThread(0) {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
 
     /**
      * Does the pre script evaluation and sets the error reporter if given
      * This function should only be called once, and will assert if called
      * more than once
      * @param errorReporter the error reporter callback function to set
      */
@@ -3956,48 +3956,48 @@ public:
     ~AutoScriptEvaluate();
 private:
     JSContext* mJSContext;
     JSExceptionState* mState;
     bool mErrorReporterSet;
     bool mEvaluated;
     jsword mContextHasThread;
     JSAutoEnterCompartment mEnterCompartment;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 
     // No copying or assignment allowed
     AutoScriptEvaluate(const AutoScriptEvaluate &) MOZ_DELETE;
     AutoScriptEvaluate & operator =(const AutoScriptEvaluate &) MOZ_DELETE;
 };
 
 /***************************************************************************/
 class NS_STACK_CLASS AutoResolveName
 {
 public:
     AutoResolveName(XPCCallContext& ccx, jsid name
-                    MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+                    MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
         : mTLS(ccx.GetThreadData()),
           mOld(mTLS->SetResolveName(name)),
           mCheck(name) {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
     ~AutoResolveName()
         {
 #ifdef DEBUG
             jsid old =
 #endif
             mTLS->SetResolveName(mOld);
             NS_ASSERTION(old == mCheck, "Bad Nesting!");
         }
 
 private:
     XPCPerThreadData* mTLS;
     jsid mOld;
     jsid mCheck;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /***************************************************************************/
 class XPCMarkableJSVal
 {
 public:
     XPCMarkableJSVal(jsval val) : mVal(val), mValPtr(&mVal) {}
     XPCMarkableJSVal(jsval *pval) : mVal(JSVAL_VOID), mValPtr(pval) {}
--- a/mfbt/GuardObjects.h
+++ b/mfbt/GuardObjects.h
@@ -63,31 +63,31 @@ namespace mozilla {
    * section 12.2 [class.temporary], clauses 4 and 5 seem to assume a
    * guarantee that temporaries are destroyed in the reverse of their
    * construction order, but I actually can't find a statement that that
    * is true in the general case (beyond the two specific cases mentioned
    * there).  However, it seems to be true.
    *
    * These classes are intended to be used only via the macros immediately
    * below them:
-   *   MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER declares (ifdef DEBUG) a member
+   *   MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER declares (ifdef DEBUG) a member
    *     variable, and should be put where a declaration of a private
    *     member variable would be placed.
-   *   MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM should be placed at the end of the
+   *   MOZ_GUARD_OBJECT_NOTIFIER_PARAM should be placed at the end of the
    *     parameters to each constructor of the guard object; it declares
    *     (ifdef DEBUG) an additional parameter.  (But use the *_ONLY_PARAM
    *     variant for constructors that take no other parameters.)
-   *   MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL should likewise be used in
+   *   MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL should likewise be used in
    *     the implementation of such constructors when they are not inline.
-   *   MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT should be used in
+   *   MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT should be used in
    *     the implementation of such constructors to pass the parameter to
    *     a base class that also uses these macros
-   *   MOZILLA_GUARD_OBJECT_NOTIFIER_INIT is a statement that belongs in each
+   *   MOZ_GUARD_OBJECT_NOTIFIER_INIT is a statement that belongs in each
    *     constructor.  It uses the parameter declared by
-   *     MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM.
+   *     MOZ_GUARD_OBJECT_NOTIFIER_PARAM.
    *
    * For more details, and examples of using these macros, see
    * https://developer.mozilla.org/en/Using_RAII_classes_in_Mozilla
    */
 #ifdef DEBUG
   class GuardObjectNotifier
   {
   private:
@@ -126,37 +126,37 @@ namespace mozilla {
        * aNotifier is passed as a const reference so that we can pass a
        * temporary, but we really intend it as non-const
        */
       const_cast<GuardObjectNotifier&>(aNotifier).
           SetStatementDone(&mStatementDone);
     }
   };
 
-  #define MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER \
+  #define MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER \
       mozilla::GuardObjectNotificationReceiver _mCheckNotUsedAsTemporary;
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM \
+  #define MOZ_GUARD_OBJECT_NOTIFIER_PARAM \
       , const mozilla::GuardObjectNotifier& _notifier = \
                 mozilla::GuardObjectNotifier()
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_ONLY_PARAM \
+  #define MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM \
       const mozilla::GuardObjectNotifier& _notifier = \
               mozilla::GuardObjectNotifier()
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL \
+  #define MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL \
       , const mozilla::GuardObjectNotifier& _notifier
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT \
+  #define MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT \
       , _notifier
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_INIT \
+  #define MOZ_GUARD_OBJECT_NOTIFIER_INIT \
       PR_BEGIN_MACRO _mCheckNotUsedAsTemporary.Init(_notifier); PR_END_MACRO
 
 #else /* defined(DEBUG) */
 
-  #define MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_ONLY_PARAM
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT
-  #define MOZILLA_GUARD_OBJECT_NOTIFIER_INIT PR_BEGIN_MACRO PR_END_MACRO
+  #define MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
+  #define MOZ_GUARD_OBJECT_NOTIFIER_PARAM
+  #define MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM
+  #define MOZ_GUARD_OBJECT_NOTIFIER_PARAM_IN_IMPL
+  #define MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT
+  #define MOZ_GUARD_OBJECT_NOTIFIER_INIT PR_BEGIN_MACRO PR_END_MACRO
 
 #endif /* !defined(DEBUG) */
 
 } // namespace mozilla
 
 #endif /* mozilla_GuardObjects_h */
--- a/toolkit/components/telemetry/Telemetry.h
+++ b/toolkit/components/telemetry/Telemetry.h
@@ -79,29 +79,29 @@ void AccumulateTimeDelta(ID id, TimeStam
 /**
  * Return a raw Histogram for direct manipulation for users who can not use Accumulate().
  */
 base::Histogram* GetHistogramById(ID id);
 
 template<ID id>
 class AutoTimer {
 public:
-  AutoTimer(TimeStamp aStart = TimeStamp::Now() MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+  AutoTimer(TimeStamp aStart = TimeStamp::Now() MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
      : start(aStart)
   {
-    MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+    MOZ_GUARD_OBJECT_NOTIFIER_INIT;
   }
 
   ~AutoTimer() {
     AccumulateTimeDelta(id, start);
   }
 
 private:
   const TimeStamp start;
-  MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+  MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 /**
  * Records slow SQL statements for Telemetry reporting.
  * For privacy reasons, only prepared statements are reported.
  *
  * @param statement - offending SQL statement to record
  * @param dbName - DB filename; reporting is only done for whitelisted DBs
--- a/xpcom/glue/AutoRestore.h
+++ b/xpcom/glue/AutoRestore.h
@@ -57,21 +57,21 @@ namespace mozilla {
    *   }
    */
   template <class T>
   class NS_STACK_CLASS AutoRestore
   {
   private:
     T& mLocation;
     T mValue;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
   public:
-    AutoRestore(T& aValue MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM)
+    AutoRestore(T& aValue MOZ_GUARD_OBJECT_NOTIFIER_PARAM)
       : mLocation(aValue), mValue(aValue)
     {
-      MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+      MOZ_GUARD_OBJECT_NOTIFIER_INIT;
     }
     ~AutoRestore() { mLocation = mValue; }
   };
 
 } // namespace mozilla
 
 #endif /* !defined(mozilla_AutoRestore_h_) */
--- a/xpcom/glue/Mutex.h
+++ b/xpcom/glue/Mutex.h
@@ -171,54 +171,54 @@ public:
     /**
      * Constructor
      * The constructor aquires the given lock.  The destructor
      * releases the lock.
      * 
      * @param aLock A valid mozilla::Mutex* returned by 
      *              mozilla::Mutex::NewMutex. 
      **/
-    MutexAutoLock(mozilla::Mutex& aLock MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM) :
+    MutexAutoLock(mozilla::Mutex& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
         mLock(&aLock)
     {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         NS_ASSERTION(mLock, "null mutex");
         mLock->Lock();
     }
     
     ~MutexAutoLock(void) {
         mLock->Unlock();
     }
  
 private:
     MutexAutoLock();
     MutexAutoLock(MutexAutoLock&);
     MutexAutoLock& operator=(MutexAutoLock&);
     static void* operator new(size_t) CPP_THROW_NEW;
     static void operator delete(void*);
 
     mozilla::Mutex* mLock;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 
 /**
  * MutexAutoUnlock
  * Releases the Mutex when it enters scope, and re-acquires it when it leaves 
  * scope.
  *
  * MUCH PREFERRED to bare calls to Mutex.Unlock and Lock.
  */ 
 class NS_COM_GLUE NS_STACK_CLASS MutexAutoUnlock 
 {
 public:
-    MutexAutoUnlock(mozilla::Mutex& aLock MOZILLA_GUARD_OBJECT_NOTIFIER_PARAM) :
+    MutexAutoUnlock(mozilla::Mutex& aLock MOZ_GUARD_OBJECT_NOTIFIER_PARAM) :
         mLock(&aLock)
     {
-        MOZILLA_GUARD_OBJECT_NOTIFIER_INIT;
+        MOZ_GUARD_OBJECT_NOTIFIER_INIT;
         NS_ASSERTION(mLock, "null lock");
         mLock->Unlock();
     }
 
     ~MutexAutoUnlock() 
     {
         mLock->Lock();
     }
@@ -226,16 +226,16 @@ public:
 private:
     MutexAutoUnlock();
     MutexAutoUnlock(MutexAutoUnlock&);
     MutexAutoUnlock& operator =(MutexAutoUnlock&);
     static void* operator new(size_t) CPP_THROW_NEW;
     static void operator delete(void*);
      
     mozilla::Mutex* mLock;
-    MOZILLA_DECL_USE_GUARD_OBJECT_NOTIFIER
+    MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER
 };
 
 
 } // namespace mozilla
 
 
 #endif // ifndef mozilla_Mutex_h