From dbd2f7fec919d1e07fee59a27f322483bfdd60b7 Mon Sep 17 00:00:00 2001 From: Nicholas Nethercote Date: Thu, 17 Jan 2013 16:45:11 -0800 Subject: [PATCH] Bug 831193 (part 5) - Don't use NS_MEMORY_REPORTER_IMPLEMENT in CanvasRenderingContext2D.cpp. r=jmuizelaar. --HG-- extra : rebase_source : f26ea74c9c53a044d1a30f48500ae83ef005c82d --- .../canvas/src/CanvasRenderingContext2D.cpp | 23 +++++++++---------- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/content/canvas/src/CanvasRenderingContext2D.cpp b/content/canvas/src/CanvasRenderingContext2D.cpp index dcebbcc2d351..21036799e32d 100644 --- a/content/canvas/src/CanvasRenderingContext2D.cpp +++ b/content/canvas/src/CanvasRenderingContext2D.cpp @@ -140,20 +140,19 @@ const Float SIGMA_MAX = 100; /* Memory reporter stuff */ static int64_t gCanvasAzureMemoryUsed = 0; -static int64_t GetCanvasAzureMemoryUsed() { - return gCanvasAzureMemoryUsed; -} - // This is KIND_OTHER because it's not always clear where in memory the pixels // of a canvas are stored. Furthermore, this memory will be tracked by the // underlying surface implementations. See bug 655638 for details. -NS_MEMORY_REPORTER_IMPLEMENT(CanvasAzureMemory, - "canvas-2d-pixel-bytes", - KIND_OTHER, - UNITS_BYTES, - GetCanvasAzureMemoryUsed, - "Memory used by 2D canvases. Each canvas requires (width * height * 4) " - "bytes.") +class Canvas2dPixelsReporter MOZ_FINAL : public MemoryReporterBase +{ + public: + Canvas2dPixelsReporter() + : MemoryReporterBase("canvas-2d-pixels", KIND_OTHER, UNITS_BYTES, +"Memory used by 2D canvases. Each canvas requires (width * height * 4) bytes.") + {} +private: + int64_t Amount() MOZ_OVERRIDE { return gCanvasAzureMemoryUsed; } +}; class CanvasRadialGradient : public CanvasGradient { @@ -897,7 +896,7 @@ CanvasRenderingContext2D::EnsureTarget() static bool registered = false; if (!registered) { registered = true; - NS_RegisterMemoryReporter(new NS_MEMORY_REPORTER_NAME(CanvasAzureMemory)); + NS_RegisterMemoryReporter(new Canvas2dPixelsReporter()); } gCanvasAzureMemoryUsed += mWidth * mHeight * 4;