| 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 <stddef.h> | 7 #include <stddef.h> |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 #include <sys/mman.h> // For |PROT_...|. | 9 #include <sys/mman.h> // For |PROT_...|. |
| 10 #include <sys/types.h> // For |off_t|. | 10 #include <sys/types.h> // For |off_t|. |
| 11 | |
| 12 #include <limits> | 11 #include <limits> |
| 12 #include <utility> |
| 13 | 13 |
| 14 #include "base/files/scoped_file.h" | 14 #include "base/files/scoped_file.h" |
| 15 #include "base/logging.h" | 15 #include "base/logging.h" |
| 16 #include "mojo/edk/embedder/platform_handle.h" | 16 #include "mojo/edk/embedder/platform_handle.h" |
| 17 #include "third_party/ashmem/ashmem.h" | 17 #include "third_party/ashmem/ashmem.h" |
| 18 | 18 |
| 19 namespace mojo { | 19 namespace mojo { |
| 20 namespace edk { | 20 namespace edk { |
| 21 | 21 |
| 22 // SimplePlatformSharedBuffer -------------------------------------------------- | 22 // SimplePlatformSharedBuffer -------------------------------------------------- |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 if (size < 0) { | 58 if (size < 0) { |
| 59 DPLOG(ERROR) << "ashmem_get_size_region()"; | 59 DPLOG(ERROR) << "ashmem_get_size_region()"; |
| 60 return false; | 60 return false; |
| 61 } | 61 } |
| 62 | 62 |
| 63 if (static_cast<size_t>(size) != num_bytes_) { | 63 if (static_cast<size_t>(size) != num_bytes_) { |
| 64 LOG(ERROR) << "Shared memory region has the wrong size"; | 64 LOG(ERROR) << "Shared memory region has the wrong size"; |
| 65 return false; | 65 return false; |
| 66 } | 66 } |
| 67 | 67 |
| 68 handle_ = platform_handle.Pass(); | 68 handle_ = std::move(platform_handle); |
| 69 return true; | 69 return true; |
| 70 } | 70 } |
| 71 | 71 |
| 72 } // namespace edk | 72 } // namespace edk |
| 73 } // namespace mojo | 73 } // namespace mojo |
| OLD | NEW |