| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 #ifndef BASE_MEMORY_SHARED_MEMORY_H_ | 5 #ifndef BASE_MEMORY_SHARED_MEMORY_H_ |
| 6 #define BASE_MEMORY_SHARED_MEMORY_H_ | 6 #define BASE_MEMORY_SHARED_MEMORY_H_ |
| 7 | 7 |
| 8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 | 77 |
| 78 // Create a new SharedMemory object from an existing, open | 78 // Create a new SharedMemory object from an existing, open |
| 79 // shared memory file. | 79 // shared memory file. |
| 80 // | 80 // |
| 81 // WARNING: This does not reduce the OS-level permissions on the handle; it | 81 // WARNING: This does not reduce the OS-level permissions on the handle; it |
| 82 // only affects how the SharedMemory will be mmapped. Use | 82 // only affects how the SharedMemory will be mmapped. Use |
| 83 // ShareReadOnlyToProcess to drop permissions. TODO(jln,jyasskin): DCHECK | 83 // ShareReadOnlyToProcess to drop permissions. TODO(jln,jyasskin): DCHECK |
| 84 // that |read_only| matches the permissions of the handle. | 84 // that |read_only| matches the permissions of the handle. |
| 85 SharedMemory(const SharedMemoryHandle& handle, bool read_only); | 85 SharedMemory(const SharedMemoryHandle& handle, bool read_only); |
| 86 | 86 |
| 87 #if defined(OS_WIN) |
| 87 // Create a new SharedMemory object from an existing, open | 88 // Create a new SharedMemory object from an existing, open |
| 88 // shared memory file that was created by a remote process and not shared | 89 // shared memory file that was created by a remote process and not shared |
| 89 // to the current process. | 90 // to the current process. |
| 90 SharedMemory(const SharedMemoryHandle& handle, | 91 SharedMemory(const SharedMemoryHandle& handle, |
| 91 bool read_only, | 92 bool read_only, |
| 92 ProcessHandle process); | 93 ProcessHandle process); |
| 94 #endif |
| 93 | 95 |
| 94 // Closes any open files. | 96 // Closes any open files. |
| 95 ~SharedMemory(); | 97 ~SharedMemory(); |
| 96 | 98 |
| 97 // Return true iff the given handle is valid (i.e. not the distingished | 99 // Return true iff the given handle is valid (i.e. not the distingished |
| 98 // invalid value; NULL for a HANDLE and -1 for a file descriptor) | 100 // invalid value; NULL for a HANDLE and -1 for a file descriptor) |
| 99 static bool IsHandleValid(const SharedMemoryHandle& handle); | 101 static bool IsHandleValid(const SharedMemoryHandle& handle); |
| 100 | 102 |
| 101 // Returns invalid handle (see comment above for exact definition). | 103 // Returns invalid handle (see comment above for exact definition). |
| 102 static SharedMemoryHandle NULLHandle(); | 104 static SharedMemoryHandle NULLHandle(); |
| (...skipping 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 300 size_t mapped_size_; | 302 size_t mapped_size_; |
| 301 void* memory_; | 303 void* memory_; |
| 302 bool read_only_; | 304 bool read_only_; |
| 303 size_t requested_size_; | 305 size_t requested_size_; |
| 304 | 306 |
| 305 DISALLOW_COPY_AND_ASSIGN(SharedMemory); | 307 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
| 306 }; | 308 }; |
| 307 } // namespace base | 309 } // namespace base |
| 308 | 310 |
| 309 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 311 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
| OLD | NEW |