diff --git a/gfx/thebes/gfxASurface.cpp b/gfx/thebes/gfxASurface.cpp index efdb44e30b66..c069544daace 100644 --- a/gfx/thebes/gfxASurface.cpp +++ b/gfx/thebes/gfxASurface.cpp @@ -502,12 +502,6 @@ gfxASurface::GetSubpixelAntialiasingEnabled() #endif } -gfxASurface::MemoryLocation -gfxASurface::GetMemoryLocation() const -{ - return MEMORY_IN_PROCESS_HEAP; -} - PRInt32 gfxASurface::BytePerPixelFromFormat(gfxImageFormat format) { @@ -567,54 +561,39 @@ gfxASurface::MovePixels(const nsIntRect& aSourceRect, /** Memory reporting **/ -static const char *sDefaultSurfaceDescription = - "Memory used by gfx surface of the given type."; - -struct SurfaceMemoryReporterAttrs { - const char *name; - const char *description; +static const char *sSurfaceNamesForSurfaceType[] = { + "gfx-surface-image", + "gfx-surface-pdf", + "gfx-surface-ps", + "gfx-surface-xlib", + "gfx-surface-xcb", + "gfx-surface-glitz", + "gfx-surface-quartz", + "gfx-surface-win32", + "gfx-surface-beos", + "gfx-surface-directfb", + "gfx-surface-svg", + "gfx-surface-os2", + "gfx-surface-win32printing", + "gfx-surface-quartzimage", + "gfx-surface-script", + "gfx-surface-qpainter", + "gfx-surface-recording", + "gfx-surface-vg", + "gfx-surface-gl", + "gfx-surface-drm", + "gfx-surface-tee", + "gfx-surface-xml", + "gfx-surface-skia", + "gfx-surface-subsurface", + "gfx-surface-d2d" }; -static const SurfaceMemoryReporterAttrs sSurfaceMemoryReporterAttrs[] = { - {"gfx-surface-image", nsnull}, - {"gfx-surface-pdf", nsnull}, - {"gfx-surface-ps", nsnull}, - {"gfx-surface-xlib", - "Memory used by xlib surfaces to store pixmaps. This memory lives in " - "the X server's process rather than in this application, so the bytes " - "accounted for here aren't counted in vsize, resident, explicit, or any of " - "the other measurements on this page."}, - {"gfx-surface-xcb", nsnull}, - {"gfx-surface-glitz", nsnull}, - {"gfx-surface-quartz", nsnull}, - {"gfx-surface-win32", nsnull}, - {"gfx-surface-beos", nsnull}, - {"gfx-surface-directfb", nsnull}, - {"gfx-surface-svg", nsnull}, - {"gfx-surface-os2", nsnull}, - {"gfx-surface-win32printing", nsnull}, - {"gfx-surface-quartzimage", nsnull}, - {"gfx-surface-script", nsnull}, - {"gfx-surface-qpainter", nsnull}, - {"gfx-surface-recording", nsnull}, - {"gfx-surface-vg", nsnull}, - {"gfx-surface-gl", nsnull}, - {"gfx-surface-drm", nsnull}, - {"gfx-surface-tee", nsnull}, - {"gfx-surface-xml", nsnull}, - {"gfx-surface-skia", nsnull}, - {"gfx-surface-subsurface", nsnull}, - {"gfx-surface-d2d", nsnull}, -}; - -PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sSurfaceMemoryReporterAttrs) == - gfxASurface::SurfaceTypeMax); +PR_STATIC_ASSERT(NS_ARRAY_LENGTH(sSurfaceNamesForSurfaceType) == gfxASurface::SurfaceTypeMax); #ifdef CAIRO_HAS_D2D_SURFACE -PR_STATIC_ASSERT(PRUint32(CAIRO_SURFACE_TYPE_D2D) == - PRUint32(gfxASurface::SurfaceTypeD2D)); +PR_STATIC_ASSERT(PRUint32(CAIRO_SURFACE_TYPE_D2D) == PRUint32(gfxASurface::SurfaceTypeD2D)); #endif -PR_STATIC_ASSERT(PRUint32(CAIRO_SURFACE_TYPE_SKIA) == - PRUint32(gfxASurface::SurfaceTypeSkia)); +PR_STATIC_ASSERT(PRUint32(CAIRO_SURFACE_TYPE_SKIA) == PRUint32(gfxASurface::SurfaceTypeSkia)); static const char * SurfaceMemoryReporterPathForType(gfxASurface::gfxSurfaceType aType) @@ -623,17 +602,7 @@ SurfaceMemoryReporterPathForType(gfxASurface::gfxSurfaceType aType) aType >= gfxASurface::SurfaceTypeMax) return "gfx-surface-unknown"; - return sSurfaceMemoryReporterAttrs[aType].name; -} - -static const char * -SurfaceMemoryReporterDescriptionForType(gfxASurface::gfxSurfaceType aType) -{ - if (aType >= 0 && aType < gfxASurface::SurfaceTypeMax && - sSurfaceMemoryReporterAttrs[aType].description) - return sSurfaceMemoryReporterAttrs[aType].description; - - return sDefaultSurfaceDescription; + return sSurfaceNamesForSurfaceType[aType]; } /* Surface size memory reporting */ @@ -676,7 +645,7 @@ public: } NS_IMETHOD GetDescription(nsACString &desc) { - desc.Assign(SurfaceMemoryReporterDescriptionForType(mType)); + desc.AssignLiteral("Memory used by gfx surface of the given type."); return NS_OK; } diff --git a/gfx/thebes/gfxASurface.h b/gfx/thebes/gfxASurface.h index f129cd7032bd..1ef7659df97e 100644 --- a/gfx/thebes/gfxASurface.h +++ b/gfx/thebes/gfxASurface.h @@ -206,24 +206,7 @@ public: void RecordMemoryUsed(PRInt32 aBytes); void RecordMemoryFreed(); - virtual PRInt32 KnownMemoryUsed() { return mBytesRecorded; } - - /** - * The memory used by this surface (as reported by KnownMemoryUsed()) can - * either live in this process's heap, in this process but outside the - * heap, or in another process altogether. - */ - enum MemoryLocation { - MEMORY_IN_PROCESS_HEAP, - MEMORY_IN_PROCESS_NONHEAP, - MEMORY_OUT_OF_PROCESS - }; - - /** - * Where does this surface's memory live? By default, we say it's in this - * process's heap. - */ - virtual MemoryLocation GetMemoryLocation() const; + PRInt32 KnownMemoryUsed() { return mBytesRecorded; } static PRInt32 BytePerPixelFromFormat(gfxImageFormat format); diff --git a/gfx/thebes/gfxQuartzImageSurface.cpp b/gfx/thebes/gfxQuartzImageSurface.cpp index f6d7fe87f6a2..82099e056de6 100644 --- a/gfx/thebes/gfxQuartzImageSurface.cpp +++ b/gfx/thebes/gfxQuartzImageSurface.cpp @@ -58,17 +58,6 @@ gfxQuartzImageSurface::~gfxQuartzImageSurface() { } -PRInt32 -gfxQuartzImageSurface::KnownMemoryUsed() -{ - // This surface doesn't own any memory itself, but we want to report here the - // amount of memory that the surface it wraps uses. - nsRefPtr imgSurface = GetAsImageSurface(); - if (imgSurface) - return imgSurface->KnownMemoryUsed(); - return 0; -} - already_AddRefed gfxQuartzImageSurface::GetAsImageSurface() { diff --git a/gfx/thebes/gfxQuartzImageSurface.h b/gfx/thebes/gfxQuartzImageSurface.h index 4eb3843182ce..81440cec97e9 100644 --- a/gfx/thebes/gfxQuartzImageSurface.h +++ b/gfx/thebes/gfxQuartzImageSurface.h @@ -49,7 +49,6 @@ public: virtual ~gfxQuartzImageSurface(); already_AddRefed GetAsImageSurface(); - virtual PRInt32 KnownMemoryUsed(); }; #endif /* GFX_QUARTZIMAGESURFACE_H */ diff --git a/gfx/thebes/gfxWindowsSurface.cpp b/gfx/thebes/gfxWindowsSurface.cpp index 92aa907ef344..d8f6843b96da 100644 --- a/gfx/thebes/gfxWindowsSurface.cpp +++ b/gfx/thebes/gfxWindowsSurface.cpp @@ -328,9 +328,3 @@ gfxWindowsSurface::GetDefaultContextFlags() const return 0; } - -gfxASurface::MemoryLocation -gfxWindowsSurface::GetMemoryLocation() const -{ - return MEMORY_IN_PROCESS_NONHEAP; -} diff --git a/gfx/thebes/gfxWindowsSurface.h b/gfx/thebes/gfxWindowsSurface.h index 3c671180c10b..0ebf8d3c360d 100644 --- a/gfx/thebes/gfxWindowsSurface.h +++ b/gfx/thebes/gfxWindowsSurface.h @@ -98,10 +98,6 @@ public: FastMovePixels(aSourceRect, aDestTopLeft); } - // The memory used by this surface lives in this process's address space, - // but not in the heap. - virtual gfxASurface::MemoryLocation GetMemoryLocation() const; - private: PRPackedBool mOwnsDC; PRPackedBool mForPrinting; diff --git a/gfx/thebes/gfxXlibSurface.cpp b/gfx/thebes/gfxXlibSurface.cpp index e4575e404f7d..062a35b27971 100644 --- a/gfx/thebes/gfxXlibSurface.cpp +++ b/gfx/thebes/gfxXlibSurface.cpp @@ -104,7 +104,6 @@ gfxXlibSurface::gfxXlibSurface(cairo_surface_t *csurf) gfxXlibSurface::~gfxXlibSurface() { - // gfxASurface's destructor calls RecordMemoryFreed(). if (mPixmapTaken) { XFreePixmap (mDisplay, mDrawable); } @@ -128,26 +127,6 @@ CreatePixmap(Screen *screen, const gfxIntSize& size, unsigned int depth, depth); } -void -gfxXlibSurface::TakePixmap() -{ - NS_ASSERTION(!mPixmapTaken, "I already own the Pixmap!"); - mPixmapTaken = PR_TRUE; - - // Divide by 8 because surface_get_depth gives us the number of *bits* per - // pixel. - RecordMemoryUsed(mSize.width * mSize.height * - cairo_xlib_surface_get_depth(CairoSurface()) / 8); -} - -Drawable -gfxXlibSurface::ReleasePixmap() { - NS_ASSERTION(mPixmapTaken, "I don't own the Pixmap!"); - mPixmapTaken = PR_FALSE; - RecordMemoryFreed(); - return mDrawable; -} - /* static */ already_AddRefed gfxXlibSurface::Create(Screen *screen, Visual *visual, @@ -523,8 +502,3 @@ gfxXlibSurface::XRenderFormat() return cairo_xlib_surface_get_xrender_format(CairoSurface()); } -gfxASurface::MemoryLocation -gfxXlibSurface::GetMemoryLocation() const -{ - return MEMORY_OUT_OF_PROCESS; -} diff --git a/gfx/thebes/gfxXlibSurface.h b/gfx/thebes/gfxXlibSurface.h index 50aa558aa587..4f50ed8683ac 100644 --- a/gfx/thebes/gfxXlibSurface.h +++ b/gfx/thebes/gfxXlibSurface.h @@ -90,20 +90,23 @@ public: // take ownership of a passed-in Pixmap, calling XFreePixmap on it // when the gfxXlibSurface is destroyed. - void TakePixmap(); + void TakePixmap() { + NS_ASSERTION(!mPixmapTaken, "I already own the Pixmap!"); + mPixmapTaken = PR_TRUE; + } // Release ownership of this surface's Pixmap. This is only valid // on gfxXlibSurfaces for which the user called TakePixmap(), or // on those created by a Create() factory method. - Drawable ReleasePixmap(); + Drawable ReleasePixmap() { + NS_ASSERTION(mPixmapTaken, "I don't own the Pixmap!"); + mPixmapTaken = PR_FALSE; + return mDrawable; + } // Find a visual and colormap pair suitable for rendering to this surface. PRBool GetColormapAndVisual(Colormap* colormap, Visual **visual); - // This surface is a wrapper around X pixmaps, which are stored in the X - // server, not the main application. - virtual gfxASurface::MemoryLocation GetMemoryLocation() const; - protected: // if TakePixmap() has been called on this PRBool mPixmapTaken; diff --git a/modules/libpr0n/src/Image.cpp b/modules/libpr0n/src/Image.cpp index 82f7d2065dfd..5ff5cadf6bad 100644 --- a/modules/libpr0n/src/Image.cpp +++ b/modules/libpr0n/src/Image.cpp @@ -63,7 +63,7 @@ Image::GetDataSize() if (mError) return 0; - return GetSourceHeapSize() + GetDecodedHeapSize() + GetDecodedNonheapSize(); + return GetSourceDataSize() + GetDecodedDataSize(); } // Translates a mimetype into a concrete decoder diff --git a/modules/libpr0n/src/Image.h b/modules/libpr0n/src/Image.h index 547a439c1740..d10369459698 100644 --- a/modules/libpr0n/src/Image.h +++ b/modules/libpr0n/src/Image.h @@ -102,9 +102,8 @@ public: /** * The components that make up GetDataSize(). */ - virtual PRUint32 GetDecodedHeapSize() = 0; - virtual PRUint32 GetDecodedNonheapSize() = 0; - virtual PRUint32 GetSourceHeapSize() = 0; + virtual PRUint32 GetDecodedDataSize() = 0; + virtual PRUint32 GetSourceDataSize() = 0; // Mimetype translation enum eDecoderType { diff --git a/modules/libpr0n/src/RasterImage.cpp b/modules/libpr0n/src/RasterImage.cpp index f3790d860de1..e86e7fbf9357 100644 --- a/modules/libpr0n/src/RasterImage.cpp +++ b/modules/libpr0n/src/RasterImage.cpp @@ -745,45 +745,21 @@ RasterImage::GetFrame(PRUint32 aWhichFrame, return rv; } -namespace { - -enum DecodedSizeType { - DECODED_SIZE_HEAP, - DECODED_SIZE_NONHEAP -}; - PRUint32 -GetDecodedSize(const nsTArray &aFrames, DecodedSizeType aType) +RasterImage::GetDecodedDataSize() { PRUint32 val = 0; - for (PRUint32 i = 0; i < aFrames.Length(); ++i) { - imgFrame *frame = aFrames.SafeElementAt(i, nsnull); + for (PRUint32 i = 0; i < mFrames.Length(); ++i) { + imgFrame *frame = mFrames.SafeElementAt(i, nsnull); NS_ABORT_IF_FALSE(frame, "Null frame in frame array!"); - if (aType == DECODED_SIZE_HEAP) - val += frame->EstimateHeapMemoryUsed(); - else - val += frame->EstimateNonheapMemoryUsed(); + val += frame->EstimateMemoryUsed(); } return val; } -} // anonymous namespace - PRUint32 -RasterImage::GetDecodedNonheapSize() -{ - return GetDecodedSize(mFrames, DECODED_SIZE_NONHEAP); -} - -PRUint32 -RasterImage::GetDecodedHeapSize() -{ - return GetDecodedSize(mFrames, DECODED_SIZE_HEAP); -} - -PRUint32 -RasterImage::GetSourceHeapSize() +RasterImage::GetSourceDataSize() { PRUint32 sourceDataSize = mSourceData.Length(); diff --git a/modules/libpr0n/src/RasterImage.h b/modules/libpr0n/src/RasterImage.h index d4b0c85015d2..bb2208f49e25 100644 --- a/modules/libpr0n/src/RasterImage.h +++ b/modules/libpr0n/src/RasterImage.h @@ -209,9 +209,8 @@ public: /* The total number of frames in this image. */ PRUint32 GetNumFrames(); - virtual PRUint32 GetDecodedHeapSize(); - virtual PRUint32 GetDecodedNonheapSize(); - virtual PRUint32 GetSourceHeapSize(); + PRUint32 GetDecodedDataSize(); + PRUint32 GetSourceDataSize(); /* Triggers discarding. */ void Discard(bool force = false); diff --git a/modules/libpr0n/src/VectorImage.cpp b/modules/libpr0n/src/VectorImage.cpp index aa495e6ba0ba..fbe1e8134319 100644 --- a/modules/libpr0n/src/VectorImage.cpp +++ b/modules/libpr0n/src/VectorImage.cpp @@ -249,20 +249,14 @@ VectorImage::GetCurrentFrameRect(nsIntRect& aRect) } PRUint32 -VectorImage::GetDecodedHeapSize() +VectorImage::GetDecodedDataSize() { // XXXdholbert TODO: return num bytes used by helper SVG doc. (bug 590790) return sizeof(*this); } PRUint32 -VectorImage::GetDecodedNonheapSize() -{ - return 0; -} - -PRUint32 -VectorImage::GetSourceHeapSize() +VectorImage::GetSourceDataSize() { // We're not storing the source data -- we just feed that directly to // our helper SVG document as we receive it, for it to parse. diff --git a/modules/libpr0n/src/VectorImage.h b/modules/libpr0n/src/VectorImage.h index e0a0cb2a543f..c1e275fcb6e0 100644 --- a/modules/libpr0n/src/VectorImage.h +++ b/modules/libpr0n/src/VectorImage.h @@ -87,10 +87,8 @@ public: const char* aURIString, PRUint32 aFlags); void GetCurrentFrameRect(nsIntRect& aRect); - - virtual PRUint32 GetDecodedHeapSize(); - virtual PRUint32 GetDecodedNonheapSize(); - virtual PRUint32 GetSourceHeapSize(); + PRUint32 GetDecodedDataSize(); + PRUint32 GetSourceDataSize(); // Callback for SVGRootRenderingObserver void InvalidateObserver(); diff --git a/modules/libpr0n/src/imgFrame.cpp b/modules/libpr0n/src/imgFrame.cpp index 6ce53f833bec..995eb460528e 100644 --- a/modules/libpr0n/src/imgFrame.cpp +++ b/modules/libpr0n/src/imgFrame.cpp @@ -778,7 +778,7 @@ void imgFrame::SetCompositingFailed(PRBool val) mCompositingFailed = val; } -PRUint32 imgFrame::EstimateHeapMemoryUsed() const +PRUint32 imgFrame::EstimateMemoryUsed() const { PRUint32 size = 0; @@ -791,8 +791,7 @@ PRUint32 imgFrame::EstimateHeapMemoryUsed() const } #ifdef USE_WIN_SURFACE - if (mWinSurface && mWinSurface->GetMemoryLocation() == - gfxASurface::MEMORY_IN_PROCESS_HEAP) { + if (mWinSurface) { size += mWinSurface->KnownMemoryUsed(); } else #endif @@ -801,38 +800,18 @@ PRUint32 imgFrame::EstimateHeapMemoryUsed() const size += mSize.width * mSize.height * 4; } else #endif - if (mImageSurface && mImageSurface->GetMemoryLocation() == - gfxASurface::MEMORY_IN_PROCESS_HEAP) { + if (mImageSurface) { size += mImageSurface->KnownMemoryUsed(); } - if (mOptSurface && mOptSurface->GetMemoryLocation() == - gfxASurface::MEMORY_IN_PROCESS_HEAP) { - size += mOptSurface->KnownMemoryUsed(); - } - - return size; -} - -PRUint32 imgFrame::EstimateNonheapMemoryUsed() const -{ - PRUint32 size = 0; - -#ifdef USE_WIN_SURFACE - if (mWinSurface && mWinSurface->GetMemoryLocation() == - gfxASurface::MEMORY_IN_PROCESS_NONHEAP) { - size += mWinSurface->KnownMemoryUsed(); - } else -#endif - if (mImageSurface && mImageSurface->GetMemoryLocation() == - gfxASurface::MEMORY_IN_PROCESS_NONHEAP) { - size += mImageSurface->KnownMemoryUsed(); - } - - if (mOptSurface && mOptSurface->GetMemoryLocation() == - gfxASurface::MEMORY_IN_PROCESS_NONHEAP) { + if (mOptSurface) { size += mOptSurface->KnownMemoryUsed(); } + // fall back to pessimistic/approximate size + if (size == 0) { + size = mSize.width * mSize.height * 4; + } + return size; } diff --git a/modules/libpr0n/src/imgFrame.h b/modules/libpr0n/src/imgFrame.h index 6d2fad507cab..f3366946aa07 100644 --- a/modules/libpr0n/src/imgFrame.h +++ b/modules/libpr0n/src/imgFrame.h @@ -135,12 +135,8 @@ public: return mImageSurface; } - // These functions estimate how much heap and non-heap memory the imgFrame is - // using. Note that these only report memory within the current process; an - // imgFrame's surface might be using memory outside the current process (e.g. - // gfxXlibSurface). - PRUint32 EstimateHeapMemoryUsed() const; - PRUint32 EstimateNonheapMemoryUsed() const; + // returns an estimate of the memory used by this imgFrame + PRUint32 EstimateMemoryUsed() const; PRUint8 GetPaletteDepth() const { return mPaletteDepth; } diff --git a/modules/libpr0n/src/imgLoader.cpp b/modules/libpr0n/src/imgLoader.cpp index 0488b1650f6f..e379a2626c7b 100644 --- a/modules/libpr0n/src/imgLoader.cpp +++ b/modules/libpr0n/src/imgLoader.cpp @@ -143,30 +143,20 @@ public: CHROME_BIT = PR_BIT(0), USED_BIT = PR_BIT(1), RAW_BIT = PR_BIT(2), - HEAP_BIT = PR_BIT(3), - ChromeUsedRaw = CHROME_BIT | USED_BIT | RAW_BIT | HEAP_BIT, - ChromeUsedUncompressedHeap = CHROME_BIT | USED_BIT | HEAP_BIT, - ChromeUsedUncompressedNonheap = CHROME_BIT | USED_BIT, - ChromeUnusedRaw = CHROME_BIT | RAW_BIT | HEAP_BIT, - ChromeUnusedUncompressedHeap = CHROME_BIT | HEAP_BIT, - ChromeUnusedUncompressedNonheap = CHROME_BIT, - ContentUsedRaw = USED_BIT | RAW_BIT | HEAP_BIT, - ContentUsedUncompressedHeap = USED_BIT | HEAP_BIT, - ContentUsedUncompressedNonheap = USED_BIT, - ContentUnusedRaw = RAW_BIT | HEAP_BIT, - ContentUnusedUncompressedHeap = HEAP_BIT, - ContentUnusedUncompressedNonheap = 0 + ChromeUsedRaw = CHROME_BIT | USED_BIT | RAW_BIT, + ChromeUsedUncompressed = CHROME_BIT | USED_BIT, + ChromeUnusedRaw = CHROME_BIT | RAW_BIT, + ChromeUnusedUncompressed = CHROME_BIT, + ContentUsedRaw = USED_BIT | RAW_BIT, + ContentUsedUncompressed = USED_BIT, + ContentUnusedRaw = RAW_BIT, + ContentUnusedUncompressed = 0 }; imgMemoryReporter(ReporterType aType) : mType(aType) - { - // If the RAW bit is set, HEAP should also be set, because we don't - // currently understand storing compressed image data off the heap. - NS_ASSERTION(!(aType & RAW_BIT) || (aType & HEAP_BIT), - "RAW bit should imply HEAP bit."); - } + { } NS_DECL_ISUPPORTS @@ -180,40 +170,27 @@ public: { if (mType == ChromeUsedRaw) { path.AssignLiteral("explicit/images/chrome/used/raw"); - } else if (mType == ChromeUsedUncompressedHeap) { - path.AssignLiteral("explicit/images/chrome/used/uncompressed-heap"); - } else if (mType == ChromeUsedUncompressedNonheap) { - path.AssignLiteral("explicit/images/chrome/used/uncompressed-nonheap"); + } else if (mType == ChromeUsedUncompressed) { + path.AssignLiteral("explicit/images/chrome/used/uncompressed"); } else if (mType == ChromeUnusedRaw) { path.AssignLiteral("explicit/images/chrome/unused/raw"); - } else if (mType == ChromeUnusedUncompressedHeap) { - path.AssignLiteral("explicit/images/chrome/unused/uncompressed-heap"); - } else if (mType == ChromeUnusedUncompressedNonheap) { - path.AssignLiteral("explicit/images/chrome/unused/uncompressed-nonheap"); + } else if (mType == ChromeUnusedUncompressed) { + path.AssignLiteral("explicit/images/chrome/unused/uncompressed"); } else if (mType == ContentUsedRaw) { path.AssignLiteral("explicit/images/content/used/raw"); - } else if (mType == ContentUsedUncompressedHeap) { - path.AssignLiteral("explicit/images/content/used/uncompressed-heap"); - } else if (mType == ContentUsedUncompressedNonheap) { - path.AssignLiteral("explicit/images/content/used/uncompressed-nonheap"); + } else if (mType == ContentUsedUncompressed) { + path.AssignLiteral("explicit/images/content/used/uncompressed"); } else if (mType == ContentUnusedRaw) { path.AssignLiteral("explicit/images/content/unused/raw"); - } else if (mType == ContentUnusedUncompressedHeap) { - path.AssignLiteral("explicit/images/content/unused/uncompressed-heap"); - } else if (mType == ContentUnusedUncompressedNonheap) { - path.AssignLiteral("explicit/images/content/unused/uncompressed-nonheap"); + } else if (mType == ContentUnusedUncompressed) { + path.AssignLiteral("explicit/images/content/unused/uncompressed"); } return NS_OK; } NS_IMETHOD GetKind(PRInt32 *kind) { - if (mType & HEAP_BIT) { - *kind = KIND_HEAP; - } - else { - *kind = KIND_MAPPED; - } + *kind = KIND_HEAP; return NS_OK; } @@ -253,11 +230,9 @@ public: return PL_DHASH_NEXT; if (rtype & RAW_BIT) { - arg->value += image->GetSourceHeapSize(); - } else if (rtype & HEAP_BIT) { - arg->value += image->GetDecodedHeapSize(); + arg->value += image->GetSourceDataSize(); } else { - arg->value += image->GetDecodedNonheapSize(); + arg->value += image->GetDecodedDataSize(); } return PL_DHASH_NEXT; @@ -280,27 +255,19 @@ public: { if (mType == ChromeUsedRaw) { desc.AssignLiteral("Memory used by in-use chrome images (compressed data)."); - } else if (mType == ChromeUsedUncompressedHeap) { - desc.AssignLiteral("Memory used by in-use chrome images (uncompressed data)."); - } else if (mType == ChromeUsedUncompressedNonheap) { + } else if (mType == ChromeUsedUncompressed) { desc.AssignLiteral("Memory used by in-use chrome images (uncompressed data)."); } else if (mType == ChromeUnusedRaw) { desc.AssignLiteral("Memory used by not in-use chrome images (compressed data)."); - } else if (mType == ChromeUnusedUncompressedHeap) { - desc.AssignLiteral("Memory used by not in-use chrome images (uncompressed data)."); - } else if (mType == ChromeUnusedUncompressedNonheap) { + } else if (mType == ChromeUnusedUncompressed) { desc.AssignLiteral("Memory used by not in-use chrome images (uncompressed data)."); } else if (mType == ContentUsedRaw) { desc.AssignLiteral("Memory used by in-use content images (compressed data)."); - } else if (mType == ContentUsedUncompressedHeap) { - desc.AssignLiteral("Memory used by in-use content images (uncompressed data)."); - } else if (mType == ContentUsedUncompressedNonheap) { + } else if (mType == ContentUsedUncompressed) { desc.AssignLiteral("Memory used by in-use content images (uncompressed data)."); } else if (mType == ContentUnusedRaw) { desc.AssignLiteral("Memory used by not in-use content images (compressed data)."); - } else if (mType == ContentUnusedUncompressedHeap) { - desc.AssignLiteral("Memory used by not in-use content images (uncompressed data)."); - } else if (mType == ContentUnusedUncompressedNonheap) { + } else if (mType == ContentUnusedUncompressed) { desc.AssignLiteral("Memory used by not in-use content images (uncompressed data)."); } return NS_OK; @@ -914,17 +881,13 @@ nsresult imgLoader::InitCache() sCacheMaxSize = 5 * 1024 * 1024; NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUsedRaw)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUsedUncompressedHeap)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUsedUncompressedNonheap)); + NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUsedUncompressed)); NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUnusedRaw)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUnusedUncompressedHeap)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUnusedUncompressedNonheap)); + NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ChromeUnusedUncompressed)); NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUsedRaw)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUsedUncompressedHeap)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUsedUncompressedNonheap)); + NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUsedUncompressed)); NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUnusedRaw)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUnusedUncompressedHeap)); - NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUnusedUncompressedNonheap)); + NS_RegisterMemoryReporter(new imgMemoryReporter(imgMemoryReporter::ContentUnusedUncompressed)); return NS_OK; }