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

Unified Diff: base/memory/shared_memory_posix.cc

Issue 812543002: Update from https://crrev.com/308331 (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years 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_nacl.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory_posix.cc
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index 0358e63e33843be8973fd0f3d01097e038bbb818..fd26ad19ffbe1e3268d9b4165dd3591b4b0f6042 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -80,6 +80,7 @@ SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only,
}
SharedMemory::~SharedMemory() {
+ Unmap();
Close();
}
@@ -331,8 +332,6 @@ SharedMemoryHandle SharedMemory::handle() const {
}
void SharedMemory::Close() {
- Unmap();
-
if (mapped_file_ > 0) {
if (close(mapped_file_) < 0)
PLOG(ERROR) << "close";
@@ -468,8 +467,10 @@ bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
new_handle->fd = new_fd;
new_handle->auto_close = true;
- if (close_self)
+ if (close_self) {
+ Unmap();
Close();
+ }
return true;
}
« no previous file with comments | « base/memory/shared_memory_nacl.cc ('k') | base/memory/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698