Skip to content

Commit

Permalink
Bug 1492930 - Part 2. Expose the external image ID for surfaces' memo…
Browse files Browse the repository at this point in the history
…ry reporting. r=nical
  • Loading branch information
aosmond committed Sep 25, 2018
1 parent 300f791 commit c1c4901
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 8 deletions.
5 changes: 3 additions & 2 deletions gfx/2d/2D.h
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ class SourceSurface : public external::AtomicRefCounted<SourceSurface>
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) {
Expand Down Expand Up @@ -587,7 +587,8 @@ class DataSourceSurface : public SourceSurface
virtual void AddSizeOfExcludingThis(MallocSizeOf aMallocSizeOf,
size_t& aHeapSizeOut,
size_t& aNonHeapSizeOut,
size_t& aExtHandlesOut) const
size_t& aExtHandlesOut,
uint64_t& aExtIdOut) const
{
}

Expand Down
3 changes: 2 additions & 1 deletion gfx/2d/SourceSurfaceRawData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down
3 changes: 2 additions & 1 deletion gfx/2d/SourceSurfaceRawData.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ class SourceSurfaceAlignedRawData : public DataSourceSurface
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
{
Expand Down
7 changes: 6 additions & 1 deletion gfx/layers/SourceSurfaceSharedData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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*
Expand Down
3 changes: 2 additions & 1 deletion gfx/layers/SourceSurfaceSharedData.h
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,8 @@ class SourceSurfaceSharedData final : public DataSourceSurface
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
{
Expand Down
3 changes: 2 additions & 1 deletion gfx/layers/SourceSurfaceVolatileData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 2 additions & 1 deletion gfx/layers/SourceSurfaceVolatileData.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,8 @@ class SourceSurfaceVolatileData : public DataSourceSurface
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
{
Expand Down

0 comments on commit c1c4901

Please sign in to comment.