зеркало из https://github.com/mozilla/gecko-dev.git
Bug 831193 (part 5) - Don't use NS_MEMORY_REPORTER_IMPLEMENT in CanvasRenderingContext2D.cpp. r=jmuizelaar.
--HG-- extra : rebase_source : f26ea74c9c53a044d1a30f48500ae83ef005c82d
This commit is contained in:
Родитель
1b9e228bfb
Коммит
dbd2f7fec9
|
@ -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;
|
||||
|
|
Загрузка…
Ссылка в новой задаче