diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /dom/canvas/WebGLMemoryTracker.cpp | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'dom/canvas/WebGLMemoryTracker.cpp')
-rw-r--r-- | dom/canvas/WebGLMemoryTracker.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/dom/canvas/WebGLMemoryTracker.cpp b/dom/canvas/WebGLMemoryTracker.cpp index 361d1be695..19d3847acc 100644 --- a/dom/canvas/WebGLMemoryTracker.cpp +++ b/dom/canvas/WebGLMemoryTracker.cpp @@ -12,8 +12,9 @@ #include "WebGLTexture.h" namespace mozilla { - -MOZ_DEFINE_MALLOC_SIZE_OF(WebGLShaderMallocSizeOf) +namespace webgl { +MOZ_DEFINE_MALLOC_SIZE_OF(MallocSizeOf) +} // namespace webgl void WebGLMemoryTracker::EnsureRegistered() { static bool sIsRegistered = []() { @@ -42,6 +43,7 @@ WebGLMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, int64_t shaderCpuSize = 0; size_t texCount = 0; + size_t texHeapOverhead = 0; int64_t texGpuSize = 0; for (const auto& context : contexts) { @@ -70,7 +72,7 @@ WebGLMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, shaderCount += context->mShaderMap.size(); for (const auto& pair : context->mShaderMap) { const auto& shader = pair.second; - shaderCpuSize += shader->SizeOfIncludingThis(WebGLShaderMallocSizeOf); + shaderCpuSize += shader->SizeOfIncludingThis(webgl::MallocSizeOf); } // - @@ -79,6 +81,7 @@ WebGLMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, for (const auto& pair : context->mTextureMap) { const auto& texture = pair.second; texGpuSize += texture->MemoryUsage(); + texHeapOverhead += texture->SizeOfIncludingThis(webgl::MallocSizeOf); } } @@ -126,10 +129,14 @@ WebGLMemoryTracker::CollectReports(nsIHandleReportCallback* aHandleReport, "Number of WebGL renderbuffers."); MOZ_COLLECT_REPORT( - "explicit/webgl/shader", KIND_HEAP, UNITS_BYTES, shaderCpuSize, + "explicit/webgl/shaders", KIND_HEAP, UNITS_BYTES, shaderCpuSize, "Combined size of WebGL shader ASCII sources and translation logs " "cached on the heap."); + MOZ_COLLECT_REPORT("explicit/webgl/textures", KIND_HEAP, UNITS_BYTES, + texHeapOverhead, + "WebGLTexture implementation detail overhead."); + MOZ_COLLECT_REPORT("webgl-shader-count", KIND_OTHER, UNITS_COUNT, static_cast<int64_t>(shaderCount), "Number of WebGL shaders."); |