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

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: Fix inverted conditional. 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
« no previous file with comments | « base/memory/shared_memory.h ('k') | ui/surface/transport_dib_posix.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 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
« no previous file with comments | « base/memory/shared_memory.h ('k') | ui/surface/transport_dib_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698