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

Unified Diff: base/memory/shared_memory_nacl.cc

Issue 2867193004: Recode shared memory usage on Windows, macOS and NaCl (Closed)
Patch Set: Move decrementing before unmapping Created 3 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
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_nacl.cc
diff --git a/base/memory/shared_memory_nacl.cc b/base/memory/shared_memory_nacl.cc
index 3ed42913680d7291845883458e44b086e20540dc..510932d56222002aa145678fdd6a66b927d51afb 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 {
@@ -85,6 +86,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));
+ SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
} else {
memory_ = NULL;
}
@@ -96,6 +98,7 @@ bool SharedMemory::Unmap() {
if (memory_ == NULL)
return false;
+ SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
if (munmap(memory_, mapped_size_) < 0)
DPLOG(ERROR) << "munmap";
memory_ = NULL;
« no previous file with comments | « base/memory/shared_memory_mac.cc ('k') | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698