Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(679)

Unified Diff: base/memory/shared_memory.h

Issue 2654073002: base: Introduce SharedMemoryTracker for POSIX (but not macOS) (Closed)
Patch Set: Use 1 bucket / actually no more bucket Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: base/memory/shared_memory.h
diff --git a/base/memory/shared_memory.h b/base/memory/shared_memory.h
index 3c68e90a031ff476dd7585b4d6653cc92e7b7643..29021c20b1cf7a1da786f9f8d87cd42482b99b0d 100644
--- a/base/memory/shared_memory.h
+++ b/base/memory/shared_memory.h
@@ -255,9 +255,24 @@ class BASE_EXPORT SharedMemory {
return ShareToProcessCommon(process, new_handle, true, SHARE_CURRENT_MODE);
}
+#if defined(OS_POSIX) && (!defined(OS_MACOSX) || defined(OS_IOS)) && \
+ !defined(OS_NACL)
+ using Id = std::pair<dev_t, ino_t>;
danakj 2017/02/24 15:30:28 one request, lets give this a more.. unique.. name
hajimehoshi 2017/02/27 07:51:54 Done.
+
+ struct IdHash {
+ size_t operator()(const Id& id) const {
+ return HashInts(id.first, id.second);
+ }
+ };
+
+ // Returns a unique ID for this shared memory's handle. Note this function may
+ // access file system and be slow.
+ bool GetUniqueId(Id* id) const;
+#endif
+
private:
#if defined(OS_POSIX) && !defined(OS_NACL) && !defined(OS_ANDROID) && \
- !(defined(OS_MACOSX) && !defined(OS_IOS))
+ (!defined(OS_MACOSX) || defined(OS_IOS))
bool FilePathForMemoryName(const std::string& mem_name, FilePath* path);
#endif
@@ -301,6 +316,7 @@ class BASE_EXPORT SharedMemory {
DISALLOW_COPY_AND_ASSIGN(SharedMemory);
};
+
} // namespace base
#endif // BASE_MEMORY_SHARED_MEMORY_H_

Powered by Google App Engine
This is Rietveld 408576698