Bug 1308317 - Part 3: Remove nsSupportsArray::SizeTo. r=froydnj
☠☠ backed out by df460f90b0cf ☠ ☠
authorEric Rahm <erahm@mozilla.com>
Thu, 13 Oct 2016 22:04:35 -0700
changeset 317939 8d8a0f01f28cc41a378b8585dae2e191da2b89d2
parent 317938 63208c26bfc31dc3d448afc579183cd8d67dcb89
child 317940 bb30697071b22bf2218f9062372f71afe80efc35
push id33170
push usercbook@mozilla.com
push dateFri, 14 Oct 2016 10:37:07 +0000
treeherderautoland@0d101ebfd95c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersfroydnj
bugs1308317
milestone52.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 1308317 - Part 3: Remove nsSupportsArray::SizeTo. r=froydnj |SizeTo| is not scriptable and unused in our codebase. MozReview-Commit-ID: 1DrTm46qbar
xpcom/ds/nsISupportsArray.idl
xpcom/ds/nsSupportsArray.cpp
xpcom/ds/nsSupportsArray.h
--- a/xpcom/ds/nsISupportsArray.idl
+++ b/xpcom/ds/nsISupportsArray.idl
@@ -60,19 +60,16 @@ interface nsISupportsArray : nsICollecti
   
   void Compact();
   
 
   nsISupportsArray clone();
 
   [notxpcom] boolean RemoveElementsAt(in unsigned long aIndex,
                                       in unsigned long aCount);
-
-  [notxpcom] boolean SizeTo(in long aSize);
-  
 };
 
 %{C++
 
 // Construct and return a default implementation of nsISupportsArray:
 extern MOZ_MUST_USE nsresult
 NS_NewISupportsArray(nsISupportsArray** aInstancePtrResult);
 
--- a/xpcom/ds/nsSupportsArray.cpp
+++ b/xpcom/ds/nsSupportsArray.cpp
@@ -391,48 +391,16 @@ nsSupportsArray::Compact(void)
     }
 
     ::memcpy(mArray, oldArray, mCount * sizeof(nsISupports*));
     delete[] oldArray;
   }
   return NS_OK;
 }
 
-NS_IMETHODIMP_(bool)
-nsSupportsArray::SizeTo(int32_t aSize)
-{
-  NS_ASSERTION(aSize >= 0, "negative aSize!");
-
-  // XXX for aSize < mCount we could resize to mCount
-  if (mArraySize == (uint32_t)aSize || (uint32_t)aSize < mCount) {
-    return true;  // nothing to do
-  }
-
-  // switch back to autoarray if possible
-  nsISupports** oldArray = mArray;
-  if ((uint32_t)aSize <= kAutoArraySize) {
-    mArray = mAutoArray;
-    mArraySize = kAutoArraySize;
-  } else {
-    mArray = new nsISupports*[aSize];
-    if (!mArray) {
-      mArray = oldArray;
-      return false;
-    }
-    mArraySize = aSize;
-  }
-
-  ::memcpy(mArray, oldArray, mCount * sizeof(nsISupports*));
-  if (oldArray != mAutoArray) {
-    delete[] oldArray;
-  }
-
-  return true;
-}
-
 NS_IMETHODIMP
 nsSupportsArray::Enumerate(nsIEnumerator** aResult)
 {
   nsSupportsArrayEnumerator* e = new nsSupportsArrayEnumerator(this);
   *aResult = e;
   NS_ADDREF(e);
   return NS_OK;
 }
--- a/xpcom/ds/nsSupportsArray.h
+++ b/xpcom/ds/nsSupportsArray.h
@@ -112,18 +112,16 @@ public:
 
   NS_IMETHOD Compact(void) override;
 
   MOZ_MUST_USE NS_IMETHOD Clone(nsISupportsArray** aResult) override;
 
   MOZ_MUST_USE NS_IMETHOD_(bool)
   RemoveElementsAt(uint32_t aIndex, uint32_t aCount) override;
 
-  MOZ_MUST_USE NS_IMETHOD_(bool)
-  SizeTo(int32_t aSize) override;
 protected:
   void DeleteArray(void);
 
   bool GrowArrayBy(uint32_t aGrowBy);
 
   nsISupports** mArray;
   uint32_t mArraySize;
   uint32_t mCount;