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

Unified Diff: cc/tiles/software_image_decode_controller.cc

Issue 2382573002: Add BACKGROUND dump mode to various GPU/CC MemoryDumpProviders (Closed)
Patch Set: rebase Created 4 years, 2 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
« no previous file with comments | « cc/tiles/software_image_decode_controller.h ('k') | gpu/command_buffer/client/cmd_buffer_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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());
}
}
« no previous file with comments | « cc/tiles/software_image_decode_controller.h ('k') | gpu/command_buffer/client/cmd_buffer_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698