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 af3551be408ad967d5a13eac6724612019847926..227aa97e9c25aa606b3ab381ce5038fc0167fa4d 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; |
@@ -792,17 +804,17 @@ void SoftwareImageDecodeController::DumpImageMemoryForCache( |
lock_.AssertAcquired(); |
for (const auto& image_pair : cache) { |
- std::string dump_name = base::StringPrintf( |
- "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 = |
- 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, |
+ std::string dump_name = base::StringPrintf( |
+ "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()); |
+ MemoryAllocatorDump* dump = |
+ image_pair.second->memory()->CreateMemoryAllocatorDump( |
+ dump_name.c_str(), pmd); |
+ DCHECK(dump); |
+ dump->AddScalar("locked_size", MemoryAllocatorDump::kUnitsBytes, |
image_pair.first.locked_bytes()); |
} |
} |