Index: base/memory/shared_memory_posix.cc |
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc |
index 904c95d6dddb801bf66aa67dc0bf724953e79987..121d4ed672b66fd1040729306941780b40a52404 100644 |
--- a/base/memory/shared_memory_posix.cc |
+++ b/base/memory/shared_memory_posix.cc |
@@ -199,6 +199,15 @@ bool SharedMemory::CreateAndMapAnonymous(size_t size) { |
} |
#if !defined(OS_ANDROID) |
+// static |
+int SharedMemory::GetSizeFromSharedMemoryHandle( |
+ const SharedMemoryHandle& handle) { |
+ struct stat st; |
+ if (fstat(handle.fd, &st) != 0) |
+ return -1; |
+ return st.st_size; |
+} |
+ |
// Chromium mostly only uses the unique/private shmem as specified by |
// "name == L"". The exception is in the StatsTable. |
// TODO(jrg): there is no way to "clean up" all unused named shmem if |