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

Unified Diff: base/memory/shared_memory.h

Issue 2654073002: base: Introduce SharedMemoryTracker for POSIX (but not macOS) (Closed)
Patch Set: Fix PRESUBMIT.py Created 3 years, 9 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..4b66cc6edd2c61ab12d28a00e3b0d8a53daad877 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)) && \
danakj 2017/03/06 16:07:06 Oh, also the BUILD.gn is now: if (is_posix && !is
hajimehoshi 2017/03/07 06:22:34 These should match. IIUC, * is_mac in BUILD.gn inc
+ !defined(OS_NACL)
+ using UniqueId = std::pair<dev_t, ino_t>;
+
+ struct UniqueIdHash {
+ size_t operator()(const UniqueId& 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(UniqueId* 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