Bug 442735 - Annotate classes in dom/content which only appear on the stack, r+sr=jst
authorBenjamin Smedberg <benjamin@smedbergs.us>
Mon, 30 Jun 2008 21:03:50 -0400
changeset 15594 6d88fe34dc34e109048efe8be0a438c4c351f0a0
parent 15593 3590fdfcfe26e421d1a49a6a02aa107ef0d3d222
child 15595 82a38df7573f3d0c6a151adf5a6ed6e8e318dce8
push id349
push userbsmedberg@mozilla.com
push dateTue, 01 Jul 2008 01:23:47 +0000
treeherdermozilla-central@6d88fe34dc34 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs442735
milestone1.9.1a1pre
Bug 442735 - Annotate classes in dom/content which only appear on the stack, r+sr=jst
content/base/public/nsContentUtils.h
content/base/public/nsIDocument.h
content/base/src/mozAutoDocUpdate.h
content/base/src/nsContentAreaDragDrop.cpp
content/base/src/nsNodeUtils.cpp
content/base/src/nsRange.cpp
content/events/public/nsEventDispatcher.h
content/events/src/nsEventStateManager.cpp
content/events/src/nsQueryContentEventHandler.h
content/html/content/src/nsHTMLSelectElement.h
content/svg/content/src/nsSVGFilters.cpp
content/svg/content/src/nsSVGValue.h
content/xul/templates/src/nsXULTemplateBuilder.cpp
docshell/base/nsDocShell.cpp
dom/public/base/nsIFocusController.h
dom/public/nsDOMScriptObjectHolder.h
embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
layout/base/nsPresShell.cpp
modules/plugin/base/src/nsPluginHostImpl.h
--- a/content/base/public/nsContentUtils.h
+++ b/content/base/public/nsContentUtils.h
@@ -1374,17 +1374,17 @@ private:
 #define NS_HOLD_JS_OBJECTS(obj, clazz)                                         \
   nsContentUtils::HoldJSObjects(NS_CYCLE_COLLECTION_UPCAST(obj, clazz),        \
                                 &NS_CYCLE_COLLECTION_NAME(clazz))
 
 #define NS_DROP_JS_OBJECTS(obj, clazz)                                         \
   nsContentUtils::DropJSObjects(NS_CYCLE_COLLECTION_UPCAST(obj, clazz))
 
 
-class nsCxPusher
+class NS_STACK_CLASS nsCxPusher
 {
 public:
   nsCxPusher();
   ~nsCxPusher(); // Calls Pop();
 
   // Returns PR_FALSE if something erroneous happened.
   PRBool Push(nsISupports *aCurrentTarget);
   PRBool Push(JSContext *cx);
--- a/content/base/public/nsIDocument.h
+++ b/content/base/public/nsIDocument.h
@@ -1097,17 +1097,17 @@ private:
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIDocument, NS_IDOCUMENT_IID)
 
 /**
  * mozAutoSubtreeModified batches DOM mutations so that a DOMSubtreeModified
  * event is dispatched, if necessary, when the outermost mozAutoSubtreeModified
  * object is deleted.
  */
-class mozAutoSubtreeModified
+class NS_STACK_CLASS mozAutoSubtreeModified
 {
 public:
   /**
    * @param aSubTreeOwner The document in which a subtree will be modified.
    * @param aTarget       The target of the possible DOMSubtreeModified event.
    *                      Can be nsnull, in which case mozAutoSubtreeModified
    *                      is just used to batch DOM mutations.
    */
--- a/content/base/src/mozAutoDocUpdate.h
+++ b/content/base/src/mozAutoDocUpdate.h
@@ -36,17 +36,17 @@
 
 /**
  * Helper class to automatically handle batching of document updates.  This
  * class will call BeginUpdate on construction and EndUpdate on destruction on
  * the given document with the given update type.  The document could be null,
  * in which case no updates will be called.  The constructor also takes a
  * boolean that can be set to false to prevent notifications.
  */
-class mozAutoDocUpdate
+class NS_STACK_CLASS mozAutoDocUpdate
 {
 public:
   mozAutoDocUpdate(nsIDocument* aDocument, nsUpdateType aUpdateType,
                    PRBool aNotify) :
     mDocument(aNotify ? aDocument : nsnull),
     mUpdateType(aUpdateType)
   {
     if (mDocument) {
@@ -89,17 +89,17 @@ private:
 /**
  * Creates an update batch only under certain conditions.
  * Use this rather than mozAutoDocUpdate when you expect inner updates
  * to notify but you don't always want to spec cycles creating a batch.
  * This is needed to avoid having this batch always create a blocker,
  * but then have inner mozAutoDocUpdate call the last EndUpdate before.
  * we remove that blocker. See bug 423269.
  */
-class mozAutoDocConditionalContentUpdateBatch
+class NS_STACK_CLASS mozAutoDocConditionalContentUpdateBatch
 {
 public:
   mozAutoDocConditionalContentUpdateBatch(nsIDocument* aDocument,
                                           PRBool aNotify) :
     mDocument(aNotify ? aDocument : nsnull)
   {
     if (mDocument) {
       mDocument->BeginUpdate(UPDATE_CONTENT_MODEL);
--- a/content/base/src/nsContentAreaDragDrop.cpp
+++ b/content/base/src/nsContentAreaDragDrop.cpp
@@ -114,17 +114,17 @@ NS_INTERFACE_MAP_BEGIN(nsContentAreaDrag
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIDOMDragListener)
     NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsIDOMEventListener, nsIDOMDragListener)
     NS_INTERFACE_MAP_ENTRY(nsIDOMDragListener)
     NS_INTERFACE_MAP_ENTRY(nsIFlavorDataProvider)
     NS_INTERFACE_MAP_ENTRY(nsIDragDropHandler)
 NS_INTERFACE_MAP_END
 
 
-class nsTransferableFactory
+class NS_STACK_CLASS nsTransferableFactory
 {
 public:
   nsTransferableFactory(nsIDOMEvent* inMouseEvent,
                         nsIFlavorDataProvider *inFlavorDataProvider);
   nsresult Produce(PRBool *aDragSelection, nsITransferable** outTrans);
 
 private:
   nsresult ConvertStringsToTransferable(nsITransferable** outTrans);
--- a/content/base/src/nsNodeUtils.cpp
+++ b/content/base/src/nsNodeUtils.cpp
@@ -318,20 +318,21 @@ nsNodeUtils::GetUserData(nsINode *aNode,
 
   *aResult = static_cast<nsIVariant*>
                         (aNode->GetProperty(DOM_USER_DATA, key));
   NS_IF_ADDREF(*aResult);
 
   return NS_OK;
 }
 
-struct nsHandlerData
+struct NS_STACK_CLASS nsHandlerData
 {
   PRUint16 mOperation;
-  nsCOMPtr<nsIDOMNode> mSource, mDest;
+  nsCOMPtr<nsIDOMNode> mSource;
+  nsCOMPtr<nsIDOMNode> mDest;
 };
 
 static void
 CallHandler(void *aObject, nsIAtom *aKey, void *aHandler, void *aData)
 {
   nsHandlerData *handlerData = static_cast<nsHandlerData*>(aData);
   nsCOMPtr<nsIDOMUserDataHandler> handler =
     static_cast<nsIDOMUserDataHandler*>(aHandler);
--- a/content/base/src/nsRange.cpp
+++ b/content/base/src/nsRange.cpp
@@ -784,17 +784,17 @@ nsresult nsRange::SelectNodeContents(nsI
 // so that our methods/algorithms aren't cluttered with special
 // case code that tries to include these points while iterating.
 //
 // The RangeSubtreeIterator class mimics the nsIContentIterator
 // methods we need, so should the Content Iterator support the
 // start/end points in the future, we can switchover relatively
 // easy.
 
-class RangeSubtreeIterator
+class NS_STACK_CLASS RangeSubtreeIterator
 {
 private:
 
   enum RangeSubtreeIterState { eDone=0,
                                eUseStartCData,
                                eUseIterator,
                                eUseEndCData };
 
--- a/content/events/public/nsEventDispatcher.h
+++ b/content/events/public/nsEventDispatcher.h
@@ -185,17 +185,17 @@ public:
 };
 
 /**
  * If an nsDispatchingCallback object is passed to Dispatch,
  * its HandleEvent method is called after handling the default event group,
  * before handling the system event group.
  * This is used in nsPresShell.
  */
-class nsDispatchingCallback {
+class NS_STACK_CLASS nsDispatchingCallback {
 public:
   virtual void HandleEvent(nsEventChainPostVisitor& aVisitor) = 0;
 };
 
 /**
  * The generic class for event dispatching.
  * Must not be used outside Gecko!
  */
--- a/content/events/src/nsEventStateManager.cpp
+++ b/content/events/src/nsEventStateManager.cpp
@@ -2924,17 +2924,17 @@ nsEventStateManager::SetCursor(PRInt32 a
   }
 
   if (NS_FAILED(rv))
     aWidget->SetCursor(c);
 
   return NS_OK;
 }
 
-class nsESMEventCB : public nsDispatchingCallback
+class NS_STACK_CLASS nsESMEventCB : public nsDispatchingCallback
 {
 public:
   nsESMEventCB(nsIContent* aTarget) : mTarget(aTarget) {}
 
   virtual void HandleEvent(nsEventChainPostVisitor& aVisitor)
   {
     if (aVisitor.mPresContext) {
       nsIPresShell* shell = aVisitor.mPresContext->GetPresShell();
--- a/content/events/src/nsQueryContentEventHandler.h
+++ b/content/events/src/nsQueryContentEventHandler.h
@@ -56,17 +56,17 @@ struct nsRect;
 /*
  * Query Content Event Handler
  *   nsQueryContentEventHandler is a helper class for nsEventStateManager.
  *   The platforms request some content informations, e.g., the selected text,
  *   the offset of the selected text and the text for specified range.
  *   This class answers to NS_QUERY_* events from actual contents.
  */
 
-class nsQueryContentEventHandler {
+class NS_STACK_CLASS nsQueryContentEventHandler {
 public:
   nsQueryContentEventHandler(nsPresContext *aPresContext);
 
   // NS_QUERY_SELECTED_TEXT event handler
   nsresult OnQuerySelectedText(nsQueryContentEvent* aEvent);
   // NS_QUERY_TEXT_CONTENT event handler
   nsresult OnQueryTextContent(nsQueryContentEvent* aEvent);
   // NS_QUERY_CHARACTER_RECT event handler
--- a/content/html/content/src/nsHTMLSelectElement.h
+++ b/content/html/content/src/nsHTMLSelectElement.h
@@ -185,17 +185,17 @@ public:
     return mValues.Contains(aValue) || mIndices.Contains(aIndex);
   }
 
 private:
   nsCheapStringSet mValues;
   nsCheapInt32Set mIndices;
 };
 
-class nsSafeOptionListMutation
+class NS_STACK_CLASS nsSafeOptionListMutation
 {
 public:
   /**
    * @param aSelect The select element which option list is being mutated.
    *                Can be null.
    * @param aParent The content object which is being mutated.
    * @param aKid    If not null, a new child element is being inserted to
    *                aParent. Otherwise a child element will be removed.
--- a/content/svg/content/src/nsSVGFilters.cpp
+++ b/content/svg/content/src/nsSVGFilters.cpp
@@ -74,17 +74,17 @@
 #endif
 
 //--------------------Filter Resource-----------------------
 /**
   * nsSVGFilterResource provides functionality for managing images used by
   * filters.  PLEASE NOTE that nsSVGFilterResource should ONLY be used on the
   * stack because it has nsAutoString member.
   */
-class nsSVGFilterResource
+class NS_STACK_CLASS nsSVGFilterResource
 {
 public:
   nsSVGFilterResource(nsSVGFE *aFilter, nsSVGFilterInstance* aInstance);
   ~nsSVGFilterResource();
 
   /*
    * Acquires a source image for reading
    * aIn:         the name of the filter primitive to use as the source
--- a/content/svg/content/src/nsSVGValue.h
+++ b/content/svg/content/src/nsSVGValue.h
@@ -82,17 +82,17 @@ private:
   
   nsSmallVoidArray mObservers;
   PRInt32 mModifyNestCount;
 };
 
 // Class that will automatically call WillModify and DidModify in its ctor
 // and dtor respectively (for functions that have multiple exit points).
 
-class nsSVGValueAutoNotifier
+class NS_STACK_CLASS nsSVGValueAutoNotifier
 {
 public:
   nsSVGValueAutoNotifier(nsSVGValue* aVal,
                          nsISVGValue::modificationType aModType =
                          nsISVGValue::mod_other)
     : mVal(aVal)
     , mModType(aModType)
   {
--- a/content/xul/templates/src/nsXULTemplateBuilder.cpp
+++ b/content/xul/templates/src/nsXULTemplateBuilder.cpp
@@ -1575,17 +1575,17 @@ nsXULTemplateBuilder::ParseAttribute(con
 
     if (backup != mark && aTextCallback) {
         // If there's any text left over, then fire the text callback
         (*aTextCallback)(this, Substring(mark, backup), aClosure);
     }
 }
 
 
-struct SubstituteTextClosure {
+struct NS_STACK_CLASS SubstituteTextClosure {
     SubstituteTextClosure(nsIXULTemplateResult* aResult, nsAString& aString)
         : result(aResult), str(aString) {}
 
     // some datasources are lazily initialized or modified while values are
     // being retrieved, causing results to be removed. Due to this, hold a
     // strong reference to the result.
     nsCOMPtr<nsIXULTemplateResult> result;
     nsAString& str;
--- a/docshell/base/nsDocShell.cpp
+++ b/docshell/base/nsDocShell.cpp
@@ -8435,17 +8435,17 @@ nsDocShell::WalkHistoryEntries(nsISHEntr
         nsresult rv = aCallback(childEntry, childShell, i, aData);
         NS_ENSURE_SUCCESS(rv, rv);
     }
 
     return NS_OK;
 }
 
 // callback data for WalkHistoryEntries
-struct CloneAndReplaceData
+struct NS_STACK_CLASS CloneAndReplaceData
 {
     CloneAndReplaceData(PRUint32 aCloneID, nsISHEntry *aReplaceEntry,
                         nsISHEntry *aDestTreeParent)
         : cloneID(aCloneID),
           replaceEntry(aReplaceEntry),
           destTreeParent(aDestTreeParent) { }
 
     PRUint32              cloneID;
--- a/dom/public/base/nsIFocusController.h
+++ b/dom/public/base/nsIFocusController.h
@@ -85,17 +85,17 @@ public:
   NS_IMETHOD MoveFocus(PRBool aForward, nsIDOMElement* aElt)=0;
   NS_IMETHOD RewindFocusState()=0;
 
   NS_IMETHOD ResetElementFocus() = 0;
 };
 
 NS_DEFINE_STATIC_IID_ACCESSOR(nsIFocusController, NS_IFOCUSCONTROLLER_IID)
 
-class nsFocusSuppressor {
+class NS_STACK_CLASS nsFocusSuppressor {
 public:
   ~nsFocusSuppressor()
   {
     Unsuppress();
   }
 
   // Note: We assume that aReason outlives the instance of this class.
   void Suppress(nsIFocusController *aController, const char *aReason)
@@ -123,17 +123,17 @@ public:
     return mController != nsnull;
   }
 
 private:
   nsCOMPtr<nsIFocusController> mController;
   const char *mReason;
 };
 
-class nsFocusScrollSuppressor
+class NS_STACK_CLASS nsFocusScrollSuppressor
 {
 public:
   nsFocusScrollSuppressor(nsIFocusController* aController = nsnull)
   : mWasSuppressed(PR_FALSE)
   {
     Init(aController);
   }
 
--- a/dom/public/nsDOMScriptObjectHolder.h
+++ b/dom/public/nsDOMScriptObjectHolder.h
@@ -41,17 +41,17 @@
 
 #include "nsIScriptContext.h"
 #include "nsIDOMScriptObjectFactory.h"
 
 // A thin class used to help with script object memory management.  No virtual
 // functions and a fully inline implementation should keep the cost down.
 // [Note that a fully inline implementation is necessary for use by other
 // languages, which do not link against the layout component module]
-class nsScriptObjectHolder {
+class NS_STACK_CLASS nsScriptObjectHolder {
 public:
   // A constructor that will cause a reference to |ctx| to be stored in
   // the object.  Only use for short-lived object holders.
   nsScriptObjectHolder(nsIScriptContext *ctx, void *aObject = nsnull) :
       mObject(aObject), mContext(ctx) {
     NS_ASSERTION(ctx, "Must provide a valid context");
   }
 
--- a/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
+++ b/embedding/components/webbrowserpersist/src/nsWebBrowserPersist.cpp
@@ -2351,17 +2351,17 @@ public:
     nsresult GetISupports(nsISupports **ret)
     {
         *ret = mKey;
         NS_IF_ADDREF(mKey);
         return NS_OK;
     }
 };
 
-struct FixRedirectData
+struct NS_STACK_CLASS FixRedirectData
 {
     nsCOMPtr<nsIChannel> mNewChannel;
     nsCOMPtr<nsIURI> mOriginalURI;
     nsISupportsKey *mMatchingKey;
 };
 
 nsresult
 nsWebBrowserPersist::FixRedirectedChannelEntry(nsIChannel *aNewChannel)
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -263,17 +263,17 @@ void nsWatcherWindowEnumerator::WindowRe
     mCurrentPosition = mCurrentPosition != inInfo->mYounger ?
                        inInfo->mYounger : 0;
 }
 
 /****************************************************************
  ********************** JSContextAutoPopper *********************
  ****************************************************************/
 
-class JSContextAutoPopper {
+class NS_STACK_CLASS JSContextAutoPopper {
 public:
   JSContextAutoPopper();
   ~JSContextAutoPopper();
 
   nsresult   Push(JSContext *cx = nsnull);
   JSContext *get() { return mContext; }
 
 protected:
--- a/layout/base/nsPresShell.cpp
+++ b/layout/base/nsPresShell.cpp
@@ -1232,17 +1232,17 @@ public:
     else {
       nsContentUtils::RemoveScriptBlocker();
     }
   }
 
   PresShell* mShell;
 };
 
-class nsPresShellEventCB : public nsDispatchingCallback
+class NS_STACK_CLASS nsPresShellEventCB : public nsDispatchingCallback
 {
 public:
   nsPresShellEventCB(PresShell* aPresShell) : mPresShell(aPresShell) {}
 
   virtual void HandleEvent(nsEventChainPostVisitor& aVisitor)
   {
     if (aVisitor.mPresContext && aVisitor.mEvent->eventStructType != NS_EVENT) {
       nsIFrame* frame = mPresShell->GetCurrentEventFrame();
--- a/modules/plugin/base/src/nsPluginHostImpl.h
+++ b/modules/plugin/base/src/nsPluginHostImpl.h
@@ -469,17 +469,17 @@ private:
 
   static nsIFile *sPluginTempDir;
 
   // We need to hold a global ptr to ourselves because we register for
   // two different CIDs for some reason...
   static nsPluginHostImpl* sInst;
 };
 
-class PluginDestructionGuard : protected PRCList
+class NS_STACK_CLASS PluginDestructionGuard : protected PRCList
 {
 public:
   PluginDestructionGuard(nsIPluginInstance *aInstance)
     : mInstance(aInstance)
   {
     Init();
   }