Bug 1228885 - Implement WebGLTexture::MemoryUsage. - r=kamidphish a=ritu
authorJeff Gilbert <jgilbert@mozilla.com>
Mon, 14 Dec 2015 15:58:29 -0800
changeset 297983 994008e15a24c0029b2151a378fe18581a8b48b2
parent 297982 01fd84681a25a4ca896fb242755d7b6cd21dfc4f
child 297984 b9ff38c7274ad086272918f4aa86d62838f61421
push id8838
push userkwierso@gmail.com
push dateTue, 22 Dec 2015 20:14:39 +0000
treeherdermozilla-aurora@0b2767ccaff5 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskamidphish, ritu
bugs1228885
milestone45.0a2
Bug 1228885 - Implement WebGLTexture::MemoryUsage. - r=kamidphish a=ritu
dom/canvas/WebGLTexture.cpp
--- a/dom/canvas/WebGLTexture.cpp
+++ b/dom/canvas/WebGLTexture.cpp
@@ -159,19 +159,21 @@ WebGLTexture::Delete()
 }
 
 size_t
 WebGLTexture::MemoryUsage() const
 {
     if (IsDeleted())
         return 0;
 
-    size_t result = 0;
-    MOZ_CRASH("todo");
-    return result;
+    size_t accum = 0;
+    for (const auto& cur : mImageInfoArr) {
+        accum += cur.MemoryUsage();
+    }
+    return accum;
 }
 
 void
 WebGLTexture::SetImageInfo(ImageInfo* target, const ImageInfo& newInfo)
 {
     *target = newInfo;
 
     InvalidateResolveCache();