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: mojo/edk/embedder/platform_shared_buffer.cc

Issue 1804353002: [mojo-edk] Switch shared buffers to use Mach on OSX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@mojo-mach-ports
Patch Set: Created 4 years, 9 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 | « no previous file | mojo/edk/system/shared_buffer_unittest.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "mojo/edk/embedder/platform_shared_buffer.h" 5 #include "mojo/edk/embedder/platform_shared_buffer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <utility> 9 #include <utility>
10 10
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 : num_bytes_(num_bytes) {} 168 : num_bytes_(num_bytes) {}
169 169
170 PlatformSharedBuffer::~PlatformSharedBuffer() {} 170 PlatformSharedBuffer::~PlatformSharedBuffer() {}
171 171
172 bool PlatformSharedBuffer::Init() { 172 bool PlatformSharedBuffer::Init() {
173 DCHECK(!shared_memory_); 173 DCHECK(!shared_memory_);
174 174
175 base::SharedMemoryCreateOptions options; 175 base::SharedMemoryCreateOptions options;
176 options.size = num_bytes_; 176 options.size = num_bytes_;
177 #if defined(OS_MACOSX) && !defined(OS_IOS) 177 #if defined(OS_MACOSX) && !defined(OS_IOS)
178 // TODO(crbug.com/582468): Support Mach shared memory. 178 options.type = base::SharedMemoryHandle::MACH;
179 options.type = base::SharedMemoryHandle::POSIX;
180 #endif 179 #endif
181 180
182 shared_memory_.reset(new base::SharedMemory); 181 shared_memory_.reset(new base::SharedMemory);
183 return shared_memory_->Create(options); 182 return shared_memory_->Create(options);
184 } 183 }
185 184
186 bool PlatformSharedBuffer::InitFromPlatformHandle( 185 bool PlatformSharedBuffer::InitFromPlatformHandle(
187 ScopedPlatformHandle platform_handle) { 186 ScopedPlatformHandle platform_handle) {
188 DCHECK(!shared_memory_); 187 DCHECK(!shared_memory_);
189 188
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 base_ = static_cast<char*>(shared_memory_.memory()) + offset_rounding; 239 base_ = static_cast<char*>(shared_memory_.memory()) + offset_rounding;
241 return true; 240 return true;
242 } 241 }
243 242
244 void PlatformSharedBufferMapping::Unmap() { 243 void PlatformSharedBufferMapping::Unmap() {
245 shared_memory_.Unmap(); 244 shared_memory_.Unmap();
246 } 245 }
247 246
248 } // namespace edk 247 } // namespace edk
249 } // namespace mojo 248 } // namespace mojo
OLDNEW
« no previous file with comments | « no previous file | mojo/edk/system/shared_buffer_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698