Bug 1308317 - Part 3: Remove nsSupportsArray::SizeTo. r=froydnj

|SizeTo| is not scriptable and unused in our codebase.

MozReview-Commit-ID: 1DrTm46qbar
This commit is contained in:
Eric Rahm 2016-10-13 22:04:35 -07:00
parent a3599628c0
commit 23dd90cee5
3 changed files with 0 additions and 37 deletions

View File

@ -65,9 +65,6 @@ interface nsISupportsArray : nsICollection {
[notxpcom] boolean RemoveElementsAt(in unsigned long aIndex,
in unsigned long aCount);
[notxpcom] boolean SizeTo(in long aSize);
};
%{C++

View File

@ -396,38 +396,6 @@ nsSupportsArray::Compact(void)
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)
{

View File

@ -117,8 +117,6 @@ public:
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);