mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 729403 (part 1, take 2) - Add Vector::sizeOf{In,Ex}cludingThis(). r=luke.
--HG-- extra : rebase_source : d745c1b1b9ca30c6836c31b03ded4dcab22a2565
This commit is contained in:
parent
a60da3f47e
commit
d6aeabe8ce
@ -499,6 +499,17 @@ class Vector : private AllocPolicy
|
||||
* shifting existing elements from |t + 1| onward one position lower.
|
||||
*/
|
||||
void erase(T *t);
|
||||
|
||||
/*
|
||||
* Measure the size of the Vector's heap-allocated storage.
|
||||
*/
|
||||
size_t sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const;
|
||||
|
||||
/*
|
||||
* Like sizeOfExcludingThis, but also measures the size of the Vector
|
||||
* object (which must be heap-allocated) itself.
|
||||
*/
|
||||
size_t sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const;
|
||||
};
|
||||
|
||||
/* This does the re-entrancy check plus several other sanity checks. */
|
||||
@ -996,6 +1007,20 @@ Vector<T,N,AP>::replaceRawBuffer(T *p, size_t length)
|
||||
#endif
|
||||
}
|
||||
|
||||
template <class T, size_t N, class AP>
|
||||
inline size_t
|
||||
Vector<T,N,AP>::sizeOfExcludingThis(JSMallocSizeOfFun mallocSizeOf) const
|
||||
{
|
||||
return usingInlineStorage() ? 0 : mallocSizeOf(beginNoCheck());
|
||||
}
|
||||
|
||||
template <class T, size_t N, class AP>
|
||||
inline size_t
|
||||
Vector<T,N,AP>::sizeOfIncludingThis(JSMallocSizeOfFun mallocSizeOf) const
|
||||
{
|
||||
return mallocSizeOf(this) + sizeOfExcludingThis(mallocSizeOf);
|
||||
}
|
||||
|
||||
} /* namespace js */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
Loading…
Reference in New Issue
Block a user