Chromium Code Reviews| 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 <stddef.h> | 8 #include <stddef.h> |
| 9 | 9 |
| 10 #include <string> | 10 #include <string> |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 248 // bool ok = ShareToProcess(process, new_handle); | 248 // bool ok = ShareToProcess(process, new_handle); |
| 249 // Close(); | 249 // Close(); |
| 250 // return ok; | 250 // return ok; |
| 251 // Note that the memory is unmapped by calling this method, regardless of the | 251 // Note that the memory is unmapped by calling this method, regardless of the |
| 252 // return value. | 252 // return value. |
| 253 bool GiveToProcess(ProcessHandle process, | 253 bool GiveToProcess(ProcessHandle process, |
| 254 SharedMemoryHandle* new_handle) { | 254 SharedMemoryHandle* new_handle) { |
| 255 return ShareToProcessCommon(process, new_handle, true, SHARE_CURRENT_MODE); | 255 return ShareToProcessCommon(process, new_handle, true, SHARE_CURRENT_MODE); |
| 256 } | 256 } |
| 257 | 257 |
| 258 #if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS)) && \ | |
|
danakj
2017/01/27 16:56:42
POSIX && (!MACOSX || IOS) && !NACL avoids double n
hajimehoshi
2017/02/07 12:33:44
Done.
| |
| 259 !defined(OS_NACL) | |
| 260 using Id = std::pair<dev_t, ino_t>; | |
|
danakj
2017/01/27 16:56:42
I think the type alias just makes use of first/sec
hajimehoshi
2017/02/07 12:33:44
This can be different type among Windows, macOS an
| |
| 261 | |
| 262 bool GetUniqueId(Id* id) const; | |
|
danakj
2017/01/27 16:56:42
Can you make a comment that this goes to the file
hajimehoshi
2017/02/07 12:33:44
Done.
| |
| 263 #endif | |
| 264 | |
| 258 private: | 265 private: |
| 259 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \ | 266 #if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \ |
| 260 !(defined(OS_MACOSX) && !defined(OS_IOS)) | 267 !(defined(OS_MACOSX) && !defined(OS_IOS)) |
| 261 bool FilePathForMemoryName(const std::string& mem_name, FilePath* path); | 268 bool FilePathForMemoryName(const std::string& mem_name, FilePath* path); |
| 262 #endif | 269 #endif |
| 263 | 270 |
| 264 enum ShareMode { | 271 enum ShareMode { |
| 265 SHARE_READONLY, | 272 SHARE_READONLY, |
| 266 SHARE_CURRENT_MODE, | 273 SHARE_CURRENT_MODE, |
| 267 }; | 274 }; |
| (...skipping 26 matching lines...) Expand all Loading... | |
| 294 int mapped_file_; | 301 int mapped_file_; |
| 295 int readonly_mapped_file_; | 302 int readonly_mapped_file_; |
| 296 #endif | 303 #endif |
| 297 size_t mapped_size_; | 304 size_t mapped_size_; |
| 298 void* memory_; | 305 void* memory_; |
| 299 bool read_only_; | 306 bool read_only_; |
| 300 size_t requested_size_; | 307 size_t requested_size_; |
| 301 | 308 |
| 302 DISALLOW_COPY_AND_ASSIGN(SharedMemory); | 309 DISALLOW_COPY_AND_ASSIGN(SharedMemory); |
| 303 }; | 310 }; |
| 311 | |
| 304 } // namespace base | 312 } // namespace base |
| 305 | 313 |
| 306 #endif // BASE_MEMORY_SHARED_MEMORY_H_ | 314 #endif // BASE_MEMORY_SHARED_MEMORY_H_ |
| OLD | NEW |