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

Unified Diff: base/memory/shared_memory_posix.cc

Issue 2496783002: gpu: Reuse existing code for shared memory allocation. (Closed)
Patch Set: . Created 4 years, 1 month 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 6e1175e85f762d22ed14ec67d2beed75cd727815..783bdfce86cd13eec8c133ca36fdeeb419dfabab 100644
--- a/base/memory/shared_memory_posix.cc
+++ b/base/memory/shared_memory_posix.cc
@@ -379,6 +379,14 @@ SharedMemoryHandle SharedMemory::handle() const {
return FileDescriptor(mapped_file_, false);
}
+SharedMemoryHandle SharedMemory::TakeHandle() {
+ FileDescriptor handle(mapped_file_, true);
+ mapped_file_ = -1;
+ memory_ = nullptr;
+ mapped_size_ = 0;
+ return handle;
+}
+
void SharedMemory::Close() {
if (mapped_file_ > 0) {
if (IGNORE_EINTR(close(mapped_file_)) < 0)

Powered by Google App Engine
This is Rietveld 408576698