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

Unified Diff: cc/raster/staging_buffer_pool.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 | « no previous file | cc/resources/resource_pool.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cc/raster/staging_buffer_pool.cc
diff --git a/cc/raster/staging_buffer_pool.cc b/cc/raster/staging_buffer_pool.cc
index 0e2a88a14a7f84fa26e17b42c8e320c702438eca..ef78e4d317e60f4a8f3b3b5ca1298a05446fb60d 100644
--- a/cc/raster/staging_buffer_pool.cc
+++ b/cc/raster/staging_buffer_pool.cc
@@ -17,6 +17,10 @@
#include "gpu/command_buffer/client/gles2_interface.h"
#include "ui/gfx/gpu_memory_buffer_tracing.h"
+using base::trace_event::MemoryAllocatorDump;
+using base::trace_event::MemoryAllocatorDumpGuid;
+using base::trace_event::MemoryDumpLevelOfDetail;
+
namespace cc {
namespace {
@@ -96,23 +100,21 @@ void StagingBuffer::OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
gfx::GpuMemoryBufferId buffer_id = gpu_memory_buffer->GetId();
std::string buffer_dump_name =
base::StringPrintf("cc/one_copy/staging_memory/buffer_%d", buffer_id.id);
- base::trace_event::MemoryAllocatorDump* buffer_dump =
- pmd->CreateAllocatorDump(buffer_dump_name);
+ MemoryAllocatorDump* buffer_dump = pmd->CreateAllocatorDump(buffer_dump_name);
uint64_t buffer_size_in_bytes =
ResourceUtil::UncheckedSizeInBytes<uint64_t>(size, format);
- buffer_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ buffer_dump->AddScalar(MemoryAllocatorDump::kNameSize,
+ MemoryAllocatorDump::kUnitsBytes,
buffer_size_in_bytes);
- buffer_dump->AddScalar("free_size",
- base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ buffer_dump->AddScalar("free_size", MemoryAllocatorDump::kUnitsBytes,
in_free_list ? buffer_size_in_bytes : 0);
// Emit an ownership edge towards a global allocator dump node.
const uint64_t tracing_process_id =
base::trace_event::MemoryDumpManager::GetInstance()
->GetTracingProcessId();
- base::trace_event::MemoryAllocatorDumpGuid shared_buffer_guid =
+ MemoryAllocatorDumpGuid shared_buffer_guid =
gfx::GetGpuMemoryBufferGUIDForTracing(tracing_process_id, buffer_id);
pmd->CreateSharedGlobalAllocatorDump(shared_buffer_guid);
@@ -187,16 +189,23 @@ bool StagingBufferPool::OnMemoryDump(
base::trace_event::ProcessMemoryDump* pmd) {
base::AutoLock lock(lock_);
- for (const auto* buffer : buffers_) {
- auto in_free_buffers =
- std::find_if(free_buffers_.begin(), free_buffers_.end(),
- [buffer](const std::unique_ptr<StagingBuffer>& b) {
- return b.get() == buffer;
- });
- buffer->OnMemoryDump(pmd, buffer->format,
- in_free_buffers != free_buffers_.end());
+ if (args.level_of_detail == MemoryDumpLevelOfDetail::BACKGROUND) {
+ std::string dump_name("cc/one_copy/staging_memory");
+ MemoryAllocatorDump* dump = pmd->CreateAllocatorDump(dump_name);
+ dump->AddScalar(MemoryAllocatorDump::kNameSize,
+ MemoryAllocatorDump::kUnitsBytes,
+ staging_buffer_usage_in_bytes_);
+ } else {
+ for (const auto* buffer : buffers_) {
+ auto in_free_buffers =
+ std::find_if(free_buffers_.begin(), free_buffers_.end(),
+ [buffer](const std::unique_ptr<StagingBuffer>& b) {
+ return b.get() == buffer;
+ });
+ buffer->OnMemoryDump(pmd, buffer->format,
+ in_free_buffers != free_buffers_.end());
+ }
}
-
return true;
}
« no previous file with comments | « no previous file | cc/resources/resource_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698