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/edk/embedder/simple_platform_shared_buffer.h" | 5 #include "mojo/edk/embedder/simple_platform_shared_buffer.h" |
6 | 6 |
7 #include <stdint.h> | 7 #include <stdint.h> |
8 #include <stdio.h> // For |fileno()|. | 8 #include <stdio.h> // For |fileno()|. |
9 #include <sys/mman.h> // For |mmap()|/|munmap()|. | 9 #include <sys/mman.h> // For |mmap()|/|munmap()|. |
10 #include <sys/stat.h> | 10 #include <sys/stat.h> |
11 #include <sys/types.h> // For |off_t|. | 11 #include <sys/types.h> // For |off_t|. |
12 #include <unistd.h> | 12 #include <unistd.h> |
13 | 13 |
14 #include <limits> | 14 #include <limits> |
15 #include <utility> | 15 #include <utility> |
16 | 16 |
17 #include "base/files/file_path.h" | 17 #include "base/files/file_path.h" |
18 #include "base/files/file_util.h" | 18 #include "base/files/file_util.h" |
19 #include "base/logging.h" | 19 #include "base/logging.h" |
20 #include "base/posix/eintr_wrapper.h" | 20 #include "base/posix/eintr_wrapper.h" |
21 #include "base/threading/thread_restrictions.h" | 21 #include "base/threading/thread_restrictions.h" |
22 #include "build/build_config.h" | 22 #include "build/build_config.h" |
23 #include "mojo/edk/embedder/platform_handle_utils.h" | 23 #include "mojo/edk/embedder/platform_handle_utils.h" |
24 #include "mojo/edk/util/scoped_file.h" | 24 #include "mojo/edk/util/scoped_file.h" |
25 | 25 |
26 #if defined(OS_ANDROID) | 26 #if defined(OS_ANDROID) |
27 #include "third_party/ashmem/ashmem.h" | 27 #include "third_party/ashmem/ashmem.h" |
28 #endif // defined(OS_ANDROID) | 28 #endif // defined(OS_ANDROID) |
29 | 29 |
| 30 using mojo::platform::PlatformHandle; |
| 31 using mojo::platform::ScopedPlatformHandle; |
30 using mojo::util::RefPtr; | 32 using mojo::util::RefPtr; |
31 | 33 |
32 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a | 34 // We assume that |size_t| and |off_t| (type for |ftruncate()|) fits in a |
33 // |uint64_t|. | 35 // |uint64_t|. |
34 static_assert(sizeof(size_t) <= sizeof(uint64_t), "size_t too big"); | 36 static_assert(sizeof(size_t) <= sizeof(uint64_t), "size_t too big"); |
35 static_assert(sizeof(off_t) <= sizeof(uint64_t), "off_t too big"); | 37 static_assert(sizeof(off_t) <= sizeof(uint64_t), "off_t too big"); |
36 | 38 |
37 namespace mojo { | 39 namespace mojo { |
38 namespace embedder { | 40 namespace embedder { |
39 | 41 |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
264 | 266 |
265 // SimplePlatformSharedBufferMapping ------------------------------------------- | 267 // SimplePlatformSharedBufferMapping ------------------------------------------- |
266 | 268 |
267 void SimplePlatformSharedBufferMapping::Unmap() { | 269 void SimplePlatformSharedBufferMapping::Unmap() { |
268 int result = munmap(real_base_, real_length_); | 270 int result = munmap(real_base_, real_length_); |
269 PLOG_IF(ERROR, result != 0) << "munmap"; | 271 PLOG_IF(ERROR, result != 0) << "munmap"; |
270 } | 272 } |
271 | 273 |
272 } // namespace embedder | 274 } // namespace embedder |
273 } // namespace mojo | 275 } // namespace mojo |
OLD | NEW |