OLD | NEW |
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/embedder/simple_platform_shared_buffer.h" | 5 #include "mojo/embedder/simple_platform_shared_buffer.h" |
6 | 6 |
7 #include <windows.h> | 7 #include <windows.h> |
8 | 8 |
9 #include <limits> | 9 #include <limits> |
10 | 10 |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 FILE_MAP_READ | FILE_MAP_WRITE, | 72 FILE_MAP_READ | FILE_MAP_WRITE, |
73 0, | 73 0, |
74 static_cast<DWORD>(real_offset), | 74 static_cast<DWORD>(real_offset), |
75 real_length); | 75 real_length); |
76 if (!real_base) { | 76 if (!real_base) { |
77 PLOG(ERROR) << "MapViewOfFile"; | 77 PLOG(ERROR) << "MapViewOfFile"; |
78 return scoped_ptr<PlatformSharedBufferMapping>(); | 78 return scoped_ptr<PlatformSharedBufferMapping>(); |
79 } | 79 } |
80 | 80 |
81 void* base = static_cast<char*>(real_base) + offset_rounding; | 81 void* base = static_cast<char*>(real_base) + offset_rounding; |
82 return scoped_ptr<PlatformSharedBufferMapping>( | 82 return make_scoped_ptr(new SimplePlatformSharedBufferMapping( |
83 new SimplePlatformSharedBufferMapping( | 83 base, length, real_base, real_length)); |
84 base, length, real_base, real_length)); | |
85 } | 84 } |
86 | 85 |
87 // SimplePlatformSharedBufferMapping ------------------------------------------- | 86 // SimplePlatformSharedBufferMapping ------------------------------------------- |
88 | 87 |
89 void SimplePlatformSharedBufferMapping::Unmap() { | 88 void SimplePlatformSharedBufferMapping::Unmap() { |
90 BOOL result = UnmapViewOfFile(real_base_); | 89 BOOL result = UnmapViewOfFile(real_base_); |
91 PLOG_IF(ERROR, !result) << "UnmapViewOfFile"; | 90 PLOG_IF(ERROR, !result) << "UnmapViewOfFile"; |
92 } | 91 } |
93 | 92 |
94 } // namespace embedder | 93 } // namespace embedder |
95 } // namespace mojo | 94 } // namespace mojo |
OLD | NEW |