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

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

Issue 2496783002: gpu: Reuse existing code for shared memory allocation. (Closed)
Patch Set: nacl 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 unified diff | Download patch
« no previous file with comments | « base/memory/shared_memory.h ('k') | base/memory/shared_memory_nacl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <mach/mach_vm.h> 7 #include <mach/mach_vm.h>
8 8
9 #include "base/files/file_util.h" 9 #include "base/files/file_util.h"
10 #include "base/files/scoped_file.h" 10 #include "base/files/scoped_file.h"
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
170 mapped_size_); 170 mapped_size_);
171 memory_ = NULL; 171 memory_ = NULL;
172 mapped_size_ = 0; 172 mapped_size_ = 0;
173 return true; 173 return true;
174 } 174 }
175 175
176 SharedMemoryHandle SharedMemory::handle() const { 176 SharedMemoryHandle SharedMemory::handle() const {
177 return shm_; 177 return shm_;
178 } 178 }
179 179
180 SharedMemoryHandle SharedMemory::TakeHandle() {
181 NOTREACHED();
sadrul 2016/11/11 02:00:30 Can I do return std::move(shm_);?
Nico 2016/11/14 18:53:51 erikchen wrote this. Erik, can you answer?
erikchen 2016/11/14 19:37:53 SharedMemoryHandle doesn't have ownership semantic
182 return SharedMemoryHandle();
183 }
184
180 void SharedMemory::Close() { 185 void SharedMemory::Close() {
181 shm_.Close(); 186 shm_.Close();
182 shm_ = SharedMemoryHandle(); 187 shm_ = SharedMemoryHandle();
183 } 188 }
184 189
185 bool SharedMemory::ShareToProcessCommon(ProcessHandle process, 190 bool SharedMemory::ShareToProcessCommon(ProcessHandle process,
186 SharedMemoryHandle* new_handle, 191 SharedMemoryHandle* new_handle,
187 bool close_self, 192 bool close_self,
188 ShareMode share_mode) { 193 ShareMode share_mode) {
189 DCHECK(shm_.IsValid()); 194 DCHECK(shm_.IsValid());
(...skipping 14 matching lines...) Expand all
204 209
205 if (close_self) { 210 if (close_self) {
206 Unmap(); 211 Unmap();
207 Close(); 212 Close();
208 } 213 }
209 214
210 return success; 215 return success;
211 } 216 }
212 217
213 } // namespace base 218 } // namespace base
OLDNEW
« no previous file with comments | « base/memory/shared_memory.h ('k') | base/memory/shared_memory_nacl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698