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

Unified Diff: base/memory/shared_memory_nacl.cc

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Implement buckets Created 3 years, 11 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: base/memory/shared_memory_nacl.cc
diff --git a/base/memory/shared_memory_nacl.cc b/base/memory/shared_memory_nacl.cc
index 945fc61375a901187ced95dbc5ece779e479c4cf..a91d3856dbc2c5c844c81a228ad8ffc650b755b5 100644
--- a/base/memory/shared_memory_nacl.cc
+++ b/base/memory/shared_memory_nacl.cc
@@ -14,6 +14,7 @@
#include <limits>
#include "base/logging.h"
+#include "base/memory/shared_memory_tracker.h"
namespace base {
@@ -99,7 +100,8 @@ bool SharedMemory::MapAt(off_t offset, size_t bytes) {
if (mmap_succeeded) {
mapped_size_ = bytes;
DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) &
- (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+ (SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
+ SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
} else {
memory_ = NULL;
}
@@ -113,6 +115,7 @@ bool SharedMemory::Unmap() {
if (munmap(memory_, mapped_size_) < 0)
DPLOG(ERROR) << "munmap";
+ SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
memory_ = NULL;
mapped_size_ = 0;
return true;

Powered by Google App Engine
This is Rietveld 408576698