bug 820182 - remove nsISupportsArray::ElementAt() uses r=ehsan
authorTrevor Saunders <trev.saunders@gmail.com>
Tue, 11 Dec 2012 11:16:42 -0500
changeset 125353 163f1b12bdef4a50726f85830d0552f98d364ba6
parent 125352 ba26dc1c6267bd22235e3ffca31824dba5ada4ec
child 125354 9ea3572c80b338b518ec3f211e4a739a13f010f0
push id2151
push userlsblakk@mozilla.com
push dateTue, 19 Feb 2013 18:06:57 +0000
treeherdermozilla-beta@4952e88741ec [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersehsan
bugs820182
milestone20.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 820182 - remove nsISupportsArray::ElementAt() uses r=ehsan
embedding/components/windowwatcher/src/nsWindowWatcher.cpp
layout/xul/base/src/tree/src/nsTreeStyleCache.cpp
rdf/base/src/nsInMemoryDataSource.cpp
security/manager/pki/src/nsPKIParamBlock.cpp
xpcom/ds/nsSupportsArrayEnumerator.cpp
--- a/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
+++ b/embedding/components/windowwatcher/src/nsWindowWatcher.cpp
@@ -360,17 +360,18 @@ ConvertArgsToArray(nsISupports* aArgumen
       return NULL;
     }
 
     nsCOMPtr<nsIMutableArray> mutableArray =
       do_CreateInstance(NS_ARRAY_CONTRACTID);
     NS_ENSURE_TRUE(mutableArray, NULL);
 
     for (uint32_t i = 0; i < argc; i++) {
-      nsCOMPtr<nsISupports> elt = dont_AddRef(supArray->ElementAt(i));
+      nsCOMPtr<nsISupports> elt;
+      supArray->GetElementAt(i, getter_AddRefs(elt));
       nsresult rv = mutableArray->AppendElement(elt, /* aWeak = */ false);
       NS_ENSURE_SUCCESS(rv, NULL);
     }
 
     return mutableArray.forget();
   }
 
   nsCOMPtr<nsIMutableArray> singletonArray =
--- a/layout/xul/base/src/tree/src/nsTreeStyleCache.cpp
+++ b/layout/xul/base/src/tree/src/nsTreeStyleCache.cpp
@@ -36,17 +36,17 @@ nsTreeStyleCache::GetStyleContext(nsICSS
   if (!currState) {
     // We had a miss. Make a new state and add it to our hash.
     currState = new nsDFAState(mNextState);
     mNextState++;
     mTransitionTable->Put(&key, currState);
   }
 
   for (uint32_t i = 0; i < count; i++) {
-    nsCOMPtr<nsIAtom> pseudo = getter_AddRefs(static_cast<nsIAtom*>(aInputWord->ElementAt(i)));
+    nsCOMPtr<nsIAtom> pseudo = do_QueryElementAt(aInputWord, i);
     nsTransitionKey key(currState->GetStateID(), pseudo);
     currState = static_cast<nsDFAState*>(mTransitionTable->Get(&key));
 
     if (!currState) {
       // We had a miss. Make a new state and add it to our hash.
       currState = new nsDFAState(mNextState);
       mNextState++;
       mTransitionTable->Put(&key, currState);
--- a/rdf/base/src/nsInMemoryDataSource.cpp
+++ b/rdf/base/src/nsInMemoryDataSource.cpp
@@ -734,18 +734,18 @@ InMemoryArcsEnumeratorImpl::HasMoreEleme
     }
 
     if (mHashArcs) {
         uint32_t    itemCount;
         nsresult    rv;
         if (NS_FAILED(rv = mHashArcs->Count(&itemCount)))   return(rv);
         if (itemCount > 0) {
             --itemCount;
-            mCurrent = static_cast<nsIRDFResource *>
-                                  (mHashArcs->ElementAt(itemCount));
+            nsCOMPtr<nsIRDFResource> tmp = do_QueryElementAt(mHashArcs, itemCount);
+            tmp.forget(&mCurrent);
             mHashArcs->RemoveElementAt(itemCount);
             *aResult = true;
             return NS_OK;
         }
     }
     else
         while (mAssertion) {
             nsIRDFResource* next = mAssertion->u.as.mProperty;
--- a/security/manager/pki/src/nsPKIParamBlock.cpp
+++ b/security/manager/pki/src/nsPKIParamBlock.cpp
@@ -89,13 +89,12 @@ nsPKIParamBlock::SetISupportAtIndex(int3
 }
 
 /* nsISupports getISupportAtIndex (in int32_t index); */
 NS_IMETHODIMP 
 nsPKIParamBlock::GetISupportAtIndex(int32_t index, nsISupports **_retval)
 {
   NS_ENSURE_ARG(_retval);
 
-  *_retval = mSupports->ElementAt(index-1);
-  return NS_OK;
+  return mSupports->GetElementAt(index - 1, _retval);
 }
 
 
--- a/xpcom/ds/nsSupportsArrayEnumerator.cpp
+++ b/xpcom/ds/nsSupportsArrayEnumerator.cpp
@@ -52,18 +52,17 @@ nsSupportsArrayEnumerator::Next()
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::CurrentItem(nsISupports **aItem)
 {
   NS_ASSERTION(aItem, "null out parameter");
   uint32_t cnt;
   nsresult rv = mArray->Count(&cnt);
   if (NS_FAILED(rv)) return rv;
   if (mCursor >= 0 && mCursor < (int32_t)cnt) {
-    *aItem = mArray->ElementAt(mCursor);
-    return NS_OK;
+    return mArray->GetElementAt(mCursor, aItem);
   }
   return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsSupportsArrayEnumerator::IsDone()
 {
   uint32_t cnt;