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

Unified Diff: base/memory/shared_memory_win.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_posix.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_win.cc
diff --git a/base/memory/shared_memory_win.cc b/base/memory/shared_memory_win.cc
index 3839f447abb3f98f4b6347ee32ba35f601d29604..83a5b5100433a959f8fc3e8575210940a0ab662f 100644
--- a/base/memory/shared_memory_win.cc
+++ b/base/memory/shared_memory_win.cc
@@ -9,6 +9,7 @@
#include <stdint.h>
#include "base/logging.h"
+#include "base/memory/shared_memory_tracker.h"
#include "base/metrics/histogram_macros.h"
#include "base/rand_util.h"
#include "base/strings/stringprintf.h"
@@ -309,6 +310,7 @@ bool SharedMemory::MapAt(off_t offset, size_t bytes) {
DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) &
(SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
mapped_size_ = GetMemorySectionSize(memory_);
+ SharedMemoryTracker::GetInstance()->IncrementMemoryUsage(*this);
return true;
}
return false;
@@ -318,6 +320,7 @@ bool SharedMemory::Unmap() {
if (memory_ == NULL)
return false;
+ SharedMemoryTracker::GetInstance()->DecrementMemoryUsage(*this);
UnmapViewOfFile(memory_);
memory_ = NULL;
return true;
« no previous file with comments | « base/memory/shared_memory_posix.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698