From 62c762bc00cc9068d40638ec177cd7e3951eea8d Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 18 Aug 2010 05:43:49 +0200 Subject: [PATCH] Bug 587856 - Part 2: Report D2D surface VRAM usage through memory reporter. r=jrmuizel --- gfx/thebes/gfxWindowsPlatform.cpp | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index 74414ea72d7b..194f4768c282 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -107,6 +107,35 @@ public: }; NS_IMPL_ISUPPORTS1(D2DCacheReporter, nsIMemoryReporter) + +class D2DVRAMReporter : + public nsIMemoryReporter +{ +public: + D2DVRAMReporter() + { } + + NS_DECL_ISUPPORTS + + NS_IMETHOD GetPath(char **memoryPath) { + *memoryPath = strdup("gfx/d2d/surfacevram"); + return NS_OK; + } + + NS_IMETHOD GetDescription(char **desc) { + *desc = strdup("Video memory used by D2D surfaces"); + return NS_OK; + } + + NS_IMETHOD GetMemoryUsed(PRInt64 *memoryUsed) { + *memoryUsed = cairo_d2d_get_surface_vram_usage( + gfxWindowsPlatform::GetPlatform()->GetD2DDevice() + ); + return NS_OK; + } +}; + +NS_IMPL_ISUPPORTS1(D2DVRAMReporter, nsIMemoryReporter) #endif #ifdef WINCE @@ -189,6 +218,7 @@ gfxWindowsPlatform::gfxWindowsPlatform() #ifdef CAIRO_HAS_D2D_SURFACE NS_RegisterMemoryReporter(new D2DCacheReporter()); + NS_RegisterMemoryReporter(new D2DVRAMReporter()); mD2DDevice = NULL; if (isVistaOrHigher) {