Index: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
diff --git a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
index e324ae2238771132d93295642084fe0955851313..f8394ec4fb237955bd58f75caea997f897af2f24 100644 |
--- a/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
+++ b/third_party/WebKit/Source/platform/graphics/BitmapImage.cpp |
@@ -35,6 +35,7 @@ |
#include "platform/graphics/ImageObserver.h" |
#include "platform/graphics/StaticBitmapImage.h" |
#include "platform/graphics/skia/SkiaUtils.h" |
+#include "public/platform/WebProcessMemoryDump.h" |
#include "third_party/skia/include/core/SkCanvas.h" |
#include "wtf/PassRefPtr.h" |
#include "wtf/text/WTFString.h" |
@@ -70,6 +71,7 @@ BitmapImage::BitmapImage(ImageObserver* observer) |
, m_hasUniformFrameSize(true) |
, m_haveFrameCount(false) |
{ |
+ Platform::current()->registerMemoryDumpProvider(this); |
} |
BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) |
@@ -95,10 +97,12 @@ BitmapImage::BitmapImage(const SkBitmap& bitmap, ImageObserver* observer) |
m_frames[0].m_hasAlpha = !bitmap.isOpaque(); |
m_frames[0].m_frame = adoptRef(SkImage::NewFromBitmap(bitmap)); |
m_frames[0].m_haveMetadata = true; |
+ Platform::current()->registerMemoryDumpProvider(this); |
} |
BitmapImage::~BitmapImage() |
{ |
+ Platform::current()->unregisterMemoryDumpProvider(this); |
stopAnimation(); |
} |
@@ -456,6 +460,18 @@ ImageOrientation BitmapImage::currentFrameOrientation() |
return frameOrientationAtIndex(currentFrame()); |
} |
+bool BitmapImage::onMemoryDump(WebMemoryDumpLevelOfDetail levelOfDetail, WebProcessMemoryDump* memoryDump) |
+{ |
+ String prefix("web_cache/images/decoded/"); |
+ SkTraceMemoryDump* dump = memoryDump->CreateSkiaTraceMemoryDump(prefix); |
+ ASSERT(dump); |
+ for (size_t i = 0; i < m_frames.size(); ++i) { |
+ if (m_frames[i].m_frame) |
+ m_frames[i].m_frame->dumpMemoryStatistics(dump); |
+ } |
+ return true; |
+} |
+ |
ImageOrientation BitmapImage::frameOrientationAtIndex(size_t index) |
{ |
if (m_frames.size() <= index) |