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

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

Issue 1167863002: Remove unused locking functionality from base::SharedMemory. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@shared_memory_remove_abtest
Patch Set: Created 5 years, 6 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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.h" 5 #include "base/memory/shared_memory.h"
6 6
7 #include <errno.h> 7 #include <errno.h>
8 #include <fcntl.h> 8 #include <fcntl.h>
9 #include <sys/mman.h> 9 #include <sys/mman.h>
10 #include <sys/stat.h> 10 #include <sys/stat.h>
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 } 126 }
127 127
128 void SharedMemory::Close() { 128 void SharedMemory::Close() {
129 if (mapped_file_ > 0) { 129 if (mapped_file_ > 0) {
130 if (close(mapped_file_) < 0) 130 if (close(mapped_file_) < 0)
131 DPLOG(ERROR) << "close"; 131 DPLOG(ERROR) << "close";
132 mapped_file_ = -1; 132 mapped_file_ = -1;
133 } 133 }
134 } 134 }
135 135
136 void SharedMemory::LockDeprecated() {
137 NOTIMPLEMENTED();
138 }
139
140 void SharedMemory::UnlockDeprecated() {
141 NOTIMPLEMENTED();
142 }
143
144 bool SharedMemory::ShareToProcessCommon(ProcessHandle process, 136 bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
145 SharedMemoryHandle *new_handle, 137 SharedMemoryHandle *new_handle,
146 bool close_self, 138 bool close_self,
147 ShareMode share_mode) { 139 ShareMode share_mode) {
148 if (share_mode == SHARE_READONLY) { 140 if (share_mode == SHARE_READONLY) {
149 // Untrusted code can't create descriptors or handles, which is needed to 141 // Untrusted code can't create descriptors or handles, which is needed to
150 // drop permissions. 142 // drop permissions.
151 return false; 143 return false;
152 } 144 }
153 const int new_fd = dup(mapped_file_); 145 const int new_fd = dup(mapped_file_);
154 if (new_fd < 0) { 146 if (new_fd < 0) {
155 DPLOG(ERROR) << "dup() failed."; 147 DPLOG(ERROR) << "dup() failed.";
156 return false; 148 return false;
157 } 149 }
158 150
159 new_handle->fd = new_fd; 151 new_handle->fd = new_fd;
160 new_handle->auto_close = true; 152 new_handle->auto_close = true;
161 153
162 if (close_self) { 154 if (close_self) {
163 Unmap(); 155 Unmap();
164 Close(); 156 Close();
165 } 157 }
166 return true; 158 return true;
167 } 159 }
168 160
169 } // namespace base 161 } // namespace base
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698