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

Unified Diff: base/memory/shared_memory_posix.cc

Issue 1143243007: Extract some logic from transport_dib into shared_memory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
Index: base/memory/shared_memory_posix.cc
diff --git a/base/memory/shared_memory_posix.cc b/base/memory/shared_memory_posix.cc
index c80032e05ba73dd5d9c5a6781aeb287a6da00fd6..94b3ee98f46dc4b2269f6451d66cbcfa5e0411ea 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -205,6 +205,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 st.st_size;
+ return -1;
+}
+
// 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

Powered by Google App Engine
This is Rietveld 408576698