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) {