mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-28 23:31:56 +00:00
Bug 712835 (part 1 of 3) - Add nsStringBuffer::SizeOfIncludingThisIfUnshared(). r=khuey.
--HG-- extra : rebase_source : 44f4e4139aaefb003f95df0d9fbec7e1c06e7a9f
This commit is contained in:
parent
3c44803f6b
commit
0d33b4e71c
@ -169,6 +169,11 @@ class nsStringBuffer
|
||||
bool aMoveOwnership = false);
|
||||
void ToString(PRUint32 len, nsACString &str,
|
||||
bool aMoveOwnership = false);
|
||||
|
||||
/**
|
||||
* This measures the size only if the StringBuffer is unshared.
|
||||
*/
|
||||
size_t SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun aMallocSizeOf) const;
|
||||
};
|
||||
|
||||
#endif /* !defined(nsStringBuffer_h__ */
|
||||
|
@ -307,6 +307,16 @@ nsStringBuffer::ToString(PRUint32 len, nsACString &str,
|
||||
accessor->set(data, len, flags);
|
||||
}
|
||||
|
||||
size_t
|
||||
nsStringBuffer::SizeOfIncludingThisIfUnshared(nsMallocSizeOfFun aMallocSizeOf) const
|
||||
{
|
||||
if (!IsReadonly())
|
||||
{
|
||||
return aMallocSizeOf(this, sizeof(nsStringBuffer) + mStorageSize);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user