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

Unified Diff: components/html_viewer/discardable_memory_allocator.cc

Issue 1306243003: Add support to create memory allocator dump in base::DiscardableMemory (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix html_viewer. Created 5 years, 4 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
Index: components/html_viewer/discardable_memory_allocator.cc
diff --git a/components/html_viewer/discardable_memory_allocator.cc b/components/html_viewer/discardable_memory_allocator.cc
index 7f362239b2d5f0c4bebd6be4c01913b4f0ee06a4..87f58e94d67864aea6fea09ef42604b21c1fd00f 100644
--- a/components/html_viewer/discardable_memory_allocator.cc
+++ b/components/html_viewer/discardable_memory_allocator.cc
@@ -6,6 +6,9 @@
#include "base/memory/discardable_memory.h"
#include "base/stl_util.h"
+#include "base/trace_event/memory_allocator_dump.h"
+#include "base/trace_event/memory_dump_manager.h"
+#include "base/trace_event/process_memory_dump.h"
namespace html_viewer {
@@ -53,6 +56,21 @@ class DiscardableMemoryAllocator::DiscardableMemoryChunkImpl
return nullptr;
}
+ base::trace_event::MemoryAllocatorDump* CreateMemoryAllocatorDump(
+ const char* name,
+ base::trace_event::ProcessMemoryDump* pmd) const override {
+ base::trace_event::MemoryAllocatorDump* dump =
+ pmd->CreateAllocatorDump(name);
+ dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes, size_);
+
+ // Memory is allocated from system allocator (malloc).
+ pmd->AddSuballocation(dump->guid(),
+ base::trace_event::MemoryDumpManager::GetInstance()
+ ->system_allocator_pool_name());
+ return dump;
+ }
+
size_t size() const { return size_; }
void Discard() {
« no previous file with comments | « base/test/test_discardable_memory_allocator.cc ('k') | content/child/child_discardable_shared_memory_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698