зеркало из https://github.com/mozilla/gecko-dev.git
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:
Родитель
9be4258264
Коммит
5eb6276d7f
|
@ -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++
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -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);
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче