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

Side by Side Diff: mojo/edk/embedder/platform_shared_buffer.cc

Issue 2264543003: Adds sync brokering to Windows EDK (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge test interface Created 4 years, 3 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 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 base::SharedMemoryHandle handle(platform_handle.release().handle, false); 246 base::SharedMemoryHandle handle(platform_handle.release().handle, false);
247 #endif 247 #endif
248 248
249 shared_memory_.reset(new base::SharedMemory(handle, read_only_)); 249 shared_memory_.reset(new base::SharedMemory(handle, read_only_));
250 return true; 250 return true;
251 } 251 }
252 252
253 bool PlatformSharedBuffer::InitFromPlatformHandlePair( 253 bool PlatformSharedBuffer::InitFromPlatformHandlePair(
254 ScopedPlatformHandle rw_platform_handle, 254 ScopedPlatformHandle rw_platform_handle,
255 ScopedPlatformHandle ro_platform_handle) { 255 ScopedPlatformHandle ro_platform_handle) {
256 #if defined(OS_WIN) || defined(OS_MACOSX) 256 #if defined(OS_MACOSX)
257 NOTREACHED(); 257 NOTREACHED();
258 return false; 258 return false;
259 #else 259 #else // defined(OS_MACOSX)
260 DCHECK(!shared_memory_);
261 260
261 #if defined(OS_WIN)
262 base::SharedMemoryHandle handle(rw_platform_handle.release().handle,
263 base::GetCurrentProcId());
264 base::SharedMemoryHandle ro_handle(ro_platform_handle.release().handle,
265 base::GetCurrentProcId());
266 #else // defined(OS_WIN)
262 base::SharedMemoryHandle handle(rw_platform_handle.release().handle, false); 267 base::SharedMemoryHandle handle(rw_platform_handle.release().handle, false);
263 shared_memory_.reset(new base::SharedMemory(handle, false));
264
265 base::SharedMemoryHandle ro_handle(ro_platform_handle.release().handle, 268 base::SharedMemoryHandle ro_handle(ro_platform_handle.release().handle,
266 false); 269 false);
Will Harris 2016/09/13 23:54:43 I think this is correct...? as presumably you crea
Ken Rockot(use gerrit already) 2016/09/14 19:57:04 The SharedMemoryHandle constructor doesn't know an
Will Harris 2016/09/14 20:24:21 Acknowledged.
270 #endif // defined(OS_WIN)
271
272 DCHECK(!shared_memory_);
273 shared_memory_.reset(new base::SharedMemory(handle, false));
267 ro_shared_memory_.reset(new base::SharedMemory(ro_handle, true)); 274 ro_shared_memory_.reset(new base::SharedMemory(ro_handle, true));
275 return true;
268 276
269 return true; 277 #endif // defined(OS_MACOSX)
270 #endif
271 } 278 }
272 279
273 void PlatformSharedBuffer::InitFromSharedMemoryHandle( 280 void PlatformSharedBuffer::InitFromSharedMemoryHandle(
274 base::SharedMemoryHandle handle) { 281 base::SharedMemoryHandle handle) {
275 DCHECK(!shared_memory_); 282 DCHECK(!shared_memory_);
276 283
277 shared_memory_.reset(new base::SharedMemory(handle, read_only_)); 284 shared_memory_.reset(new base::SharedMemory(handle, read_only_));
278 } 285 }
279 286
280 PlatformSharedBufferMapping::~PlatformSharedBufferMapping() { 287 PlatformSharedBufferMapping::~PlatformSharedBufferMapping() {
(...skipping 28 matching lines...) Expand all
309 base_ = static_cast<char*>(shared_memory_.memory()) + offset_rounding; 316 base_ = static_cast<char*>(shared_memory_.memory()) + offset_rounding;
310 return true; 317 return true;
311 } 318 }
312 319
313 void PlatformSharedBufferMapping::Unmap() { 320 void PlatformSharedBufferMapping::Unmap() {
314 shared_memory_.Unmap(); 321 shared_memory_.Unmap();
315 } 322 }
316 323
317 } // namespace edk 324 } // namespace edk
318 } // namespace mojo 325 } // namespace mojo
OLDNEW
« no previous file with comments | « content/test/BUILD.gn ('k') | mojo/edk/system/BUILD.gn » ('j') | mojo/edk/system/broker_win.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698