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

Unified Diff: content/child/child_discardable_shared_memory_manager.cc

Issue 1100073004: Adding discardable memory dump provider. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Changing c_str parameter to string. Created 5 years, 7 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: content/child/child_discardable_shared_memory_manager.cc
diff --git a/content/child/child_discardable_shared_memory_manager.cc b/content/child/child_discardable_shared_memory_manager.cc
index 961733170d578d2a5e23057504a4f822be513589..6c67be86edb8bd714a19fc575b437a79ce744eb3 100644
--- a/content/child/child_discardable_shared_memory_manager.cc
+++ b/content/child/child_discardable_shared_memory_manager.cc
@@ -13,6 +13,8 @@
#include "base/process/memory.h"
#include "base/process/process_metrics.h"
#include "base/strings/string_number_conversions.h"
+#include "base/thread_task_runner_handle.h"
+#include "base/trace_event/memory_dump_manager.h"
#include "base/trace_event/trace_event.h"
#include "content/common/child_process_messages.h"
@@ -83,9 +85,13 @@ void SendDeletedDiscardableSharedMemoryMessage(
ChildDiscardableSharedMemoryManager::ChildDiscardableSharedMemoryManager(
ThreadSafeSender* sender)
: heap_(base::GetPageSize()), sender_(sender) {
+ base::trace_event::MemoryDumpManager::GetInstance()->RegisterDumpProvider(
+ this, base::ThreadTaskRunnerHandle::Get());
}
ChildDiscardableSharedMemoryManager::~ChildDiscardableSharedMemoryManager() {
+ base::trace_event::MemoryDumpManager::GetInstance()->UnregisterDumpProvider(
+ this);
// TODO(reveman): Determine if this DCHECK can be enabled. crbug.com/430533
// DCHECK_EQ(heap_.GetSize(), heap_.GetSizeOfFreeLists());
if (heap_.GetSize())
@@ -170,7 +176,7 @@ ChildDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
// Create span for allocated memory.
scoped_ptr<DiscardableSharedMemoryHeap::Span> new_span(heap_.Grow(
- shared_memory.Pass(), allocation_size_in_bytes,
+ shared_memory.Pass(), allocation_size_in_bytes, new_id,
base::Bind(&SendDeletedDiscardableSharedMemoryMessage, sender_, new_id)));
// Unlock and insert any left over memory into free lists.
@@ -189,6 +195,11 @@ ChildDiscardableSharedMemoryManager::AllocateLockedDiscardableMemory(
return make_scoped_ptr(new DiscardableMemoryImpl(this, new_span.Pass()));
}
+bool ChildDiscardableSharedMemoryManager::OnMemoryDump(
+ base::trace_event::ProcessMemoryDump* pmd) {
+ return heap_.OnMemoryDump(pmd);
+}
+
void ChildDiscardableSharedMemoryManager::ReleaseFreeMemory() {
base::AutoLock lock(lock_);
« no previous file with comments | « content/child/child_discardable_shared_memory_manager.h ('k') | content/common/discardable_shared_memory_heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698