Index: content/common/host_shared_bitmap_manager.cc |
diff --git a/content/common/host_shared_bitmap_manager.cc b/content/common/host_shared_bitmap_manager.cc |
index b95820c2f32c44867d7b3abba5f2b05d70f1d00d..3237a992fdbb67a1259b7548ac327474e9407dbc 100644 |
--- a/content/common/host_shared_bitmap_manager.cc |
+++ b/content/common/host_shared_bitmap_manager.cc |
@@ -6,6 +6,8 @@ |
#include "base/lazy_instance.h" |
#include "base/memory/ref_counted.h" |
+#include "base/strings/string_number_conversions.h" |
+#include "base/trace_event/process_memory_dump.h" |
#include "content/common/view_messages.h" |
#include "ui/gfx/geometry/size.h" |
@@ -50,6 +52,8 @@ class HostSharedBitmap : public cc::SharedBitmap { |
HostSharedBitmapManager* manager_; |
}; |
+const char kMemoryAllocatorName[] = "sharedbitmap"; |
+ |
} // namespace |
base::LazyInstance<HostSharedBitmapManager> g_shared_memory_manager = |
@@ -146,6 +150,26 @@ scoped_ptr<cc::SharedBitmap> HostSharedBitmapManager::GetSharedBitmapFromId( |
static_cast<uint8*>(data->memory->memory()), data, id, nullptr)); |
} |
+bool HostSharedBitmapManager::OnMemoryDump( |
+ base::trace_event::ProcessMemoryDump* pmd) { |
+ base::AutoLock lock(lock_); |
+ |
+ for (const auto& bitmap : handle_map_) { |
+ base::trace_event::MemoryAllocatorDump* dump = pmd->CreateAllocatorDump( |
+ base::StringPrintf("%s/%s", kMemoryAllocatorName, |
+ base::HexEncode(bitmap.first.name, |
+ sizeof(bitmap.first.name)).c_str())); |
+ if (!dump) |
+ return false; |
+ |
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameOuterSize, |
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, |
+ bitmap.second->buffer_size); |
+ } |
+ |
+ return true; |
+} |
+ |
void HostSharedBitmapManager::ChildAllocatedSharedBitmap( |
size_t buffer_size, |
const base::SharedMemoryHandle& handle, |