зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 03bdec48d0ac (bug 450881) for Windows build bustage
This commit is contained in:
Родитель
07fb65c28b
Коммит
e3dfa27d04
|
@ -6,7 +6,6 @@
|
|||
#include "nsCOMArray.h"
|
||||
|
||||
#include "mozilla/MemoryReporting.h"
|
||||
#include "mozilla/mozalloc.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
|
||||
|
@ -279,29 +278,3 @@ nsCOMArray_base::SizeOfExcludingThis(
|
|||
|
||||
return n;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
nsCOMArray_base::Adopt(nsISupports** aElements, uint32_t aSize)
|
||||
{
|
||||
Clear();
|
||||
mArray.AppendElements(aElements, aSize);
|
||||
|
||||
// Free the allocated array as well.
|
||||
moz_free(aElements);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
nsCOMArray_base::Forget(nsISupports*** elements)
|
||||
{
|
||||
uint32_t length = Length();
|
||||
size_t array_size = sizeof(nsISupports*) * length;
|
||||
nsISupports** array = static_cast<nsISupports**>(moz_xmalloc(array_size));
|
||||
memmove(array, Elements(), array_size);
|
||||
*elements = array;
|
||||
// Don't Release the contained pointers; the caller of the method will
|
||||
// do this eventually.
|
||||
mArray.Clear();
|
||||
|
||||
return length;
|
||||
}
|
||||
|
|
|
@ -89,8 +89,6 @@ protected:
|
|||
mArray.SwapElements(aOther.mArray);
|
||||
}
|
||||
|
||||
void Adopt(nsISupports** aElements, uint32_t aCount);
|
||||
uint32_t Forget(nsISupports*** aElements);
|
||||
public:
|
||||
// elements in the array (including null elements!)
|
||||
int32_t Count() const {
|
||||
|
@ -232,16 +230,8 @@ class nsCOMArray : public nsCOMArray_base
|
|||
explicit
|
||||
nsCOMArray(const nsCOMArray<T>& aOther) : nsCOMArray_base(aOther) { }
|
||||
|
||||
nsCOMArray(nsCOMArray<T>&& aOther) { SwapElements(aOther); }
|
||||
|
||||
~nsCOMArray() {}
|
||||
|
||||
// We have a move assignment operator, but no copy assignment operator.
|
||||
nsCOMArray<T>& operator=(nsCOMArray<T>&& aOther) {
|
||||
SwapElements(aOther);
|
||||
return *this;
|
||||
}
|
||||
|
||||
// these do NOT refcount on the way out, for speed
|
||||
T* ObjectAt(int32_t aIndex) const {
|
||||
return static_cast<T*>(nsCOMArray_base::ObjectAt(aIndex));
|
||||
|
@ -397,35 +387,6 @@ class nsCOMArray : public nsCOMArray_base
|
|||
aMallocSizeOf, aData);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adopt parameters that resulted from an XPIDL outparam. The aElements
|
||||
* parameter will be freed as a result of the call.
|
||||
*
|
||||
* Example usage:
|
||||
* nsCOMArray<nsISomeInterface> array;
|
||||
* nsISomeInterface** elements;
|
||||
* uint32_t length;
|
||||
* ptr->GetSomeArray(&elements, &length);
|
||||
* array.Adopt(elements, length);
|
||||
*/
|
||||
void Adopt(T** aElements, uint32_t aSize) {
|
||||
nsCOMArray_base::Adopt(reinterpret_cast<nsISupports**>(aElements),
|
||||
aSize);
|
||||
}
|
||||
|
||||
/**
|
||||
* Export the contents of this array to an XPIDL outparam. The array will be
|
||||
* Clear()'d after this operation.
|
||||
*
|
||||
* Example usage:
|
||||
* nsCOMArray<nsISomeInterface> array;
|
||||
* *length = array.Forget(retval);
|
||||
*/
|
||||
uint32_t Forget(T*** elements) {
|
||||
return nsCOMArray_base::Forget(
|
||||
reinterpret_cast<nsISupports***>(elements));
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
// don't implement these!
|
||||
|
|
Загрузка…
Ссылка в новой задаче