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

Unified Diff: base/shared_memory_posix.cc

Issue 12537014: Make SharedMemory track the size that was actually mapped (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 9 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/shared_memory_nacl.cc ('k') | base/shared_memory_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory_posix.cc
===================================================================
--- base/shared_memory_posix.cc (revision 190994)
+++ base/shared_memory_posix.cc (working copy)
@@ -42,20 +42,20 @@
SharedMemory::SharedMemory()
: mapped_file_(-1),
+ inode_(0),
mapped_size_(0),
- inode_(0),
memory_(NULL),
read_only_(false),
- created_size_(0) {
+ requested_size_(0) {
}
SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only)
: mapped_file_(handle.fd),
+ inode_(0),
mapped_size_(0),
- inode_(0),
memory_(NULL),
read_only_(read_only),
- created_size_(0) {
+ requested_size_(0) {
struct stat st;
if (fstat(handle.fd, &st) == 0) {
// If fstat fails, then the file descriptor is invalid and we'll learn this
@@ -67,11 +67,11 @@
SharedMemory::SharedMemory(SharedMemoryHandle handle, bool read_only,
ProcessHandle process)
: mapped_file_(handle.fd),
+ inode_(0),
mapped_size_(0),
- inode_(0),
memory_(NULL),
read_only_(read_only),
- created_size_(0) {
+ requested_size_(0) {
// We don't handle this case yet (note the ignored parameter); let's die if
// someone comes calling.
NOTREACHED();
@@ -164,7 +164,7 @@
return false;
}
}
- created_size_ = options.size;
+ requested_size_ = options.size;
}
if (fp == NULL) {
#if !defined(OS_MACOSX)
@@ -235,7 +235,7 @@
// TODO(port): we set the created size here so that it is available in
// transport_dib_android.cc. We should use ashmem_get_size_region()
// in transport_dib_android.cc.
- created_size_ = ashmem_bytes;
+ mapped_size_ = ashmem_bytes;
}
#endif
@@ -244,7 +244,9 @@
bool mmap_succeeded = memory_ != (void*)-1 && memory_ != NULL;
if (mmap_succeeded) {
+#if !defined(OS_ANDROID)
mapped_size_ = bytes;
+#endif
DCHECK_EQ(0U, reinterpret_cast<uintptr_t>(memory_) &
(SharedMemory::MAP_MINIMUM_ALIGNMENT - 1));
} else {
« no previous file with comments | « base/shared_memory_nacl.cc ('k') | base/shared_memory_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698