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

Side by Side Diff: base/memory/shared_memory_handle_posix.cc

Issue 2854853007: Add logging for dup() failure in SharedMemoryHandle. (Closed)
Patch Set: Created 3 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 unified diff | Download patch
« no previous file with comments | « base/memory/shared_memory_handle_mac.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/memory/shared_memory_handle.h" 5 #include "base/memory/shared_memory_handle.h"
6 6
7 #include <unistd.h> 7 #include <unistd.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/posix/eintr_wrapper.h" 10 #include "base/posix/eintr_wrapper.h"
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
50 int old_fd = file_descriptor_.fd; 50 int old_fd = file_descriptor_.fd;
51 file_descriptor_.fd = -1; 51 file_descriptor_.fd = -1;
52 return old_fd; 52 return old_fd;
53 } 53 }
54 54
55 SharedMemoryHandle SharedMemoryHandle::Duplicate() const { 55 SharedMemoryHandle SharedMemoryHandle::Duplicate() const {
56 if (!IsValid()) 56 if (!IsValid())
57 return SharedMemoryHandle(); 57 return SharedMemoryHandle();
58 58
59 int duped_handle = HANDLE_EINTR(dup(file_descriptor_.fd)); 59 int duped_handle = HANDLE_EINTR(dup(file_descriptor_.fd));
60 if (duped_handle < 0) 60 if (duped_handle < 0) {
61 DPLOG(ERROR) << "dup() failed.";
61 return SharedMemoryHandle(); 62 return SharedMemoryHandle();
63 }
62 return SharedMemoryHandle(FileDescriptor(duped_handle, true)); 64 return SharedMemoryHandle(FileDescriptor(duped_handle, true));
63 } 65 }
64 66
65 void SharedMemoryHandle::SetOwnershipPassesToIPC(bool ownership_passes) { 67 void SharedMemoryHandle::SetOwnershipPassesToIPC(bool ownership_passes) {
66 file_descriptor_.auto_close = ownership_passes; 68 file_descriptor_.auto_close = ownership_passes;
67 } 69 }
68 70
69 bool SharedMemoryHandle::OwnershipPassesToIPC() const { 71 bool SharedMemoryHandle::OwnershipPassesToIPC() const {
70 return file_descriptor_.auto_close; 72 return file_descriptor_.auto_close;
71 } 73 }
72 74
73 } // namespace base 75 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory_handle_mac.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698