Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1251)

Unified Diff: third_party/WebKit/Source/platform/graphics/BitmapImage.cpp

Issue 1327793003: Move WebCache memory dump provider to blink for sub-allocation edges. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Moving branch. Created 5 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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)
« no previous file with comments | « third_party/WebKit/Source/platform/graphics/BitmapImage.h ('k') | third_party/WebKit/Source/web/WebCacheMemoryDumpProvider.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698