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

Unified Diff: base/shared_memory.h

Issue 21485: Bitmap transport (Closed)
Patch Set: Fix some mac crashes Created 11 years, 10 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 | « no previous file | base/shared_memory_posix.cc » ('j') | chrome/browser/renderer_host/backing_store_win.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/shared_memory.h
diff --git a/base/shared_memory.h b/base/shared_memory.h
index b44367a7fcc875e16e91e6e486f73c0316debd15..744b3489e7d9d7fb21c6d7d5878019faa7091a86 100644
--- a/base/shared_memory.h
+++ b/base/shared_memory.h
@@ -8,6 +8,7 @@
#include "build/build_config.h"
#if defined(OS_POSIX)
+#include <sys/types.h>
#include <semaphore.h>
#include "base/file_descriptor_posix.h"
#endif
@@ -24,7 +25,10 @@ namespace base {
typedef HANDLE SharedMemoryHandle;
typedef HANDLE SharedMemoryLock;
#elif defined(OS_POSIX)
+// A SharedMemoryId is sufficient to identify a given shared memory segment on a
+// system, but insufficient to map it.
typedef FileDescriptor SharedMemoryHandle;
+typedef ino_t SharedMemoryId;
// On POSIX, the lock is implemented as a lockf() on the mapped file,
// so no additional member (or definition of SharedMemoryLock) is
// needed.
@@ -99,6 +103,14 @@ class SharedMemory {
// identifier is not portable.
SharedMemoryHandle handle() const;
+#if defined(OS_POSIX)
+ // Return a unique identifier for this shared memory segment. Inode numbers
+ // are technically only unique to a single filesystem. However, we always
+ // allocate shared memory backing files from the same directory, so will end
+ // up on the same filesystem.
+ SharedMemoryId id() const { return inode_; }
+#endif
+
// Closes the open shared memory segment.
// It is safe to call Close repeatedly.
void Close();
@@ -153,9 +165,10 @@ class SharedMemory {
std::wstring name_;
#if defined(OS_WIN)
- HANDLE mapped_file_;
+ HANDLE mapped_file_;
#elif defined(OS_POSIX)
- int mapped_file_;
+ int mapped_file_;
+ ino_t inode_;
#endif
void* memory_;
bool read_only_;
« no previous file with comments | « no previous file | base/shared_memory_posix.cc » ('j') | chrome/browser/renderer_host/backing_store_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698