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

Unified Diff: content/common/host_shared_bitmap_manager.cc

Issue 1099403008: content: Add SharedBitmap MemoryDumpProvider implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: remove includes Created 5 years, 8 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 | « content/common/host_shared_bitmap_manager.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « content/common/host_shared_bitmap_manager.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698