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

Unified Diff: base/memory/shared_memory.h

Issue 1164473003: Add methods to base::SharedMemory to replace common SharedMemoryHandle operations. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add relevant methods to shared_memory_win. 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 | « no previous file | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: base/memory/shared_memory.h
diff --git a/base/memory/shared_memory.h b/base/memory/shared_memory.h
index d76e01c6e57612024fe35dc7c430229d89cd5112..692ccf8a67cf6fbbce1dcc7682a1a347c254aba7 100644
--- a/base/memory/shared_memory.h
+++ b/base/memory/shared_memory.h
@@ -116,6 +116,20 @@ class BASE_EXPORT SharedMemory {
// Returns the maximum number of handles that can be open at once per process.
static size_t GetHandleLimit();
+ // The copy shares the same underlying OS primitives. The new
+ // SharedMemoryHandle will not clean up the OS primitives when destroyed. The
+ // original must outlive the copy.
+ static SharedMemoryHandle ShallowCopyHandle(const SharedMemoryHandle& handle);
+
+#if defined(OS_POSIX)
+ // The underlying OS primitives are duplicated.
+ // |clean_up_resources_on_destruction| indicates whether the underlying OS
+ // primitives are cleaned up on destruction.
+ static SharedMemoryHandle DeepCopyHandle(
+ const SharedMemoryHandle& handle,
+ bool clean_up_resources_on_destruction);
+#endif
+
// Creates a shared memory object as described by the options struct.
// Returns true on success and false on failure.
bool Create(const SharedMemoryCreateOptions& options);
« no previous file with comments | « no previous file | base/memory/shared_memory_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698