Bug 1492930 - Part 2. Expose the external image ID for surfaces' memory reporting. r=nical

This commit is contained in:
Andrew Osmond 2018-09-25 09:13:51 -04:00
parent 3aedcdc649
commit 64e9e7e583
7 changed files with 19 additions and 8 deletions

View File

@ -420,7 +420,7 @@ public:
void AddUserData(UserDataKey *key, void *userData, void (*destroy)(void*)) {
mUserData.Add(key, userData, destroy);
}
void *GetUserData(UserDataKey *key) {
void *GetUserData(UserDataKey *key) const {
return mUserData.Get(key);
}
void RemoveUserData(UserDataKey *key) {
@ -587,7 +587,8 @@ public:
virtual void AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const
{
}

View File

@ -83,7 +83,8 @@ void
SourceSurfaceAlignedRawData::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const
{
aHeapSizeOut += mArray.HeapSizeOfExcludingThis(aMallocSizeOf);
}

View File

@ -131,7 +131,8 @@ public:
void AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const override;
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const override;
virtual bool Map(MapType, MappedSurface *aMappedSurface) override
{

View File

@ -97,7 +97,8 @@ void
SourceSurfaceSharedData::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const
{
MutexAutoLock lock(mMutex);
if (mBuf) {
@ -106,6 +107,10 @@ SourceSurfaceSharedData::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
if (!mClosed) {
++aExtHandlesOut;
}
Maybe<wr::ExternalImageId> extId = SharedSurfacesChild::GetExternalId(this);
if (extId) {
aExtIdOut = wr::AsUint64(extId.ref());
}
}
uint8_t*

View File

@ -175,7 +175,8 @@ public:
void AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const override;
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const override;
bool OnHeap() const override
{

View File

@ -42,7 +42,8 @@ void
SourceSurfaceVolatileData::AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const
{
if (mVBuf) {
aHeapSizeOut += mVBuf->HeapSizeOfExcludingThis(aMallocSizeOf);

View File

@ -53,7 +53,8 @@ public:
void AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const override;
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const override;
bool OnHeap() const override
{