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

Side by Side Diff: mojo/system/raw_shared_buffer_win.cc

Issue 304233005: Mojo: Implement passing of shared buffers across processes on POSIX. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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 | Annotate | Revision Log
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/system/raw_shared_buffer.h" 5 #include "mojo/system/raw_shared_buffer.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include <limits> 9 #include <limits>
10 10
(...skipping 26 matching lines...) Expand all
37 INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0, 37 INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0,
38 static_cast<DWORD>(num_bytes_), NULL))); 38 static_cast<DWORD>(num_bytes_), NULL)));
39 if (!handle_.is_valid()) { 39 if (!handle_.is_valid()) {
40 PLOG(ERROR) << "CreateFileMapping"; 40 PLOG(ERROR) << "CreateFileMapping";
41 return false; 41 return false;
42 } 42 }
43 43
44 return true; 44 return true;
45 } 45 }
46 46
47 bool RawSharedBuffer::InitFromPlatformHandleNoLock(
48 embedder::ScopedPlatformHandle platform_handle) {
49 DCHECK(!handle_.is_valid());
50
51 // TODO(vtl): Implement.
52 NOTIMPLEMENTED();
53 return false;
54 }
55
47 scoped_ptr<RawSharedBufferMapping> RawSharedBuffer::MapImplNoLock( 56 scoped_ptr<RawSharedBufferMapping> RawSharedBuffer::MapImplNoLock(
48 size_t offset, 57 size_t offset,
49 size_t length) { 58 size_t length) {
50 lock_.AssertAcquired(); 59 lock_.AssertAcquired();
51 60
52 size_t offset_rounding = offset % base::SysInfo::VMAllocationGranularity(); 61 size_t offset_rounding = offset % base::SysInfo::VMAllocationGranularity();
53 size_t real_offset = offset - offset_rounding; 62 size_t real_offset = offset - offset_rounding;
54 size_t real_length = length + offset_rounding; 63 size_t real_length = length + offset_rounding;
55 64
56 // This should hold (since we checked |num_bytes| versus the maximum value of 65 // This should hold (since we checked |num_bytes| versus the maximum value of
(...skipping 16 matching lines...) Expand all
73 82
74 // RawSharedBufferMapping ------------------------------------------------------ 83 // RawSharedBufferMapping ------------------------------------------------------
75 84
76 void RawSharedBufferMapping::Unmap() { 85 void RawSharedBufferMapping::Unmap() {
77 BOOL result = UnmapViewOfFile(real_base_); 86 BOOL result = UnmapViewOfFile(real_base_);
78 PLOG_IF(ERROR, !result) << "UnmapViewOfFile"; 87 PLOG_IF(ERROR, !result) << "UnmapViewOfFile";
79 } 88 }
80 89
81 } // namespace system 90 } // namespace system
82 } // namespace mojo 91 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698