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

Unified Diff: base/memory/shared_memory_posix.cc

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: 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') | no next file » | 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 2dc08a14ca24ec2c441173b639dd2b5030264389..33295813ef17dfa14fa139e1ee2fa12cc0c1b10d 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -108,6 +108,26 @@ size_t SharedMemory::GetHandleLimit() {
return base::GetMaxFds();
}
+#if defined(OS_WIN) || defined(OS_POSIX)
Nico 2015/05/29 06:50:23 this is just "everywhere", right?
erikchen 2015/05/29 18:30:24 I guess so. Removed preprocessor conditionals.
+// static
+SharedMemoryHandle SharedMemory::ShallowCopyOfHandle(
+ const SharedMemoryHandle& handle) {
+ return handle;
Nico 2015/05/29 06:50:24 The CL you link to doesn't modify this function. I
erikchen 2015/05/29 18:30:24 I think it's semantically important to not use ass
+}
+#endif
+
+#if defined(OS_POSIX)
+// static
+SharedMemoryHandle SharedMemory::DeepCopyOfHandle(
Nico 2015/05/29 06:50:24 CloneHandle() maybe?
erikchen 2015/05/29 18:30:24 If you really want me to change the verb, the cano
+ const SharedMemoryHandle& handle,
+ bool clean_up_resources_on_destruction) {
+ int duped_handle = HANDLE_EINTR(dup(handle.fd));
+ if (duped_handle < 0)
+ return base::SharedMemory::NULLHandle();
+ return base::FileDescriptor(duped_handle, clean_up_resources_on_destruction);
+}
+#endif
+
bool SharedMemory::CreateAndMapAnonymous(size_t size) {
return CreateAnonymous(size) && Map(size);
}
« no previous file with comments | « base/memory/shared_memory.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698