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

Unified Diff: base/memory/shared_memory_posix.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Remove unneeded calls Created 4 years, 1 month 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: base/memory/shared_memory_posix.cc
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index 783bdfce86cd13eec8c133ca36fdeeb419dfabab..b3de60f8c350021933b5f13b5105d71bc56e1f74 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -14,6 +14,7 @@
#include "base/files/file_util.h"
#include "base/files/scoped_file.h"
#include "base/logging.h"
+#include "base/memory/shared_memory_dump_provider.h"
#include "base/posix/eintr_wrapper.h"
#include "base/posix/safe_strerror.h"
#include "base/process/process_metrics.h"
@@ -358,6 +359,7 @@ bool SharedMemory::MapAt(off_t offset, size_t bytes) {
mapped_size_ = bytes;
DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) &
(SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+ SharedMemoryDumpProvider::GetInstance()->IncrementMemoryUsage(mapped_size_);
haraken 2016/11/30 04:39:26 We want to get not only the mmaped size but also t
} else {
memory_ = NULL;
}
@@ -370,6 +372,7 @@ bool SharedMemory::Unmap() {
return false;
munmap(memory_, mapped_size_);
+ SharedMemoryDumpProvider::GetInstance()->DecrementMemoryUsage(mapped_size_);
memory_ = NULL;
mapped_size_ = 0;
return true;
« no previous file with comments | « base/memory/shared_memory_dump_provider.cc ('k') | components/discardable_memory/common/discardable_shared_memory_heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698