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

Unified Diff: cc/tiles/software_image_decode_controller.cc

Issue 2382573002: Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: Created 4 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: cc/tiles/software_image_decode_controller.cc
diff --git a/cc/tiles/software_image_decode_controller.cc b/cc/tiles/software_image_decode_controller.cc
index be626eb53e490edd03f8fda131da0c912a5be9ec..70ed031fbb30dd2c6a02214f19f1a489daa612f9 100644
--- a/cc/tiles/software_image_decode_controller.cc
+++ b/cc/tiles/software_image_decode_controller.cc
@@ -28,6 +28,9 @@
#include "third_party/skia/include/core/SkPixmap.h"
#include "ui/gfx/skia_util.h"
+using base::trace_event::MemoryAllocatorDump;
+using base::trace_event::MemoryDumpLevelOfDetail;
+
namespace cc {
namespace {
@@ -777,9 +780,18 @@ bool SoftwareImageDecodeController::OnMemoryDump(
base::trace_event::ProcessMemoryDump* pmd) {
base::AutoLock lock(lock_);
- // Dump each of our caches.
- DumpImageMemoryForCache(decoded_images_, "cached", pmd);
- DumpImageMemoryForCache(at_raster_decoded_images_, "at_raster", pmd);
+ if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
+ std::string dump_name =
+ base::StringPrintf("cc/image_memory/controller_0x%" PRIXPTR,
+ reinterpret_cast<uintptr_t>(this));
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes,
+ locked_images_budget_.GetCurrentUsageSafe());
+ } else {
+ // Dump each of our caches.
+ DumpImageMemoryForCache(decoded_images_, "cached", pmd);
+ DumpImageMemoryForCache(at_raster_decoded_images_, "at_raster", pmd);
+ }
// Memory dump can't fail, always return true.
return true;
@@ -796,13 +808,12 @@ void SoftwareImageDecodeController::DumpImageMemoryForCache(
"cc/image_memory/controller_0x%" PRIXPTR "/%s/image_%" PRIu64 "_id_%d",
reinterpret_cast<uintptr_t>(this), cache_name,
image_pair.second->tracing_id(), image_pair.first.image_id());
- base::trace_event::MemoryAllocatorDump* dump =
+ MemoryAllocatorDump* dump =
image_pair.second->memory()->CreateMemoryAllocatorDump(
dump_name.c_str(), pmd);
DCHECK(dump);
if (image_pair.second->is_locked()) {
- dump->AddScalar("locked_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes,
image_pair.first.locked_bytes());
}
}

Powered by Google App Engine
This is Rietveld 408576698