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

Unified Diff: base/memory/shared_memory_handle.h

Issue 2535213002: [WIP] Add SharedMemoryTracker to dump base::SharedMemory usage
Patch Set: Implement buckets Created 3 years, 11 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_handle.h
diff --git a/base/memory/shared_memory_handle.h b/base/memory/shared_memory_handle.h
index dc33eeafa11faef22f73be0d44dd30447e43118b..e6abedfe6fd14f064a14267f49761b6e537a51b3 100644
--- a/base/memory/shared_memory_handle.h
+++ b/base/memory/shared_memory_handle.h
@@ -186,6 +186,29 @@ class BASE_EXPORT SharedMemoryHandle {
};
#endif
+#if defined(OS_POSIX) && !(defined(OS_MACOSX) && !defined(OS_IOS))
+struct SharedMemoryHandleID {
+ dev_t device_id;
+ ino_t file_id;
+};
+#elif defined(OS_MACOSX)
+struct SharedMemoryHandleID {
+ // TODO: On macOS, this might be mach_port_t.
+ dev_t device_id;
+ ino_t file_id;
+};
+#elif defined(OS_WIN)
+struct SharedMemoryHandleID {
+ DWORD device_id; // BY_HANDLE_FILE_INFORMATION.dwVolumeSerialNumber
+ intt64_t file_id; // BY_HANDLE_FILE_INFORMATION.nFileIndexHigh and Low
+};
+#endif
+
+bool GetIDFromSharedMemoryHandle(const SharedMemoryHandle& handle,
Primiano Tucci (use gerrit) 2017/01/20 16:34:52 should this just be a member function of SharedMem
hajimehoshi 2017/01/23 11:59:09 I like your suggestion, but on POSIX, SharedMemory
Primiano Tucci (use gerrit) 2017/01/24 01:26:40 Ahh okay I didn't notice. I think it was always so
+ SharedMemoryHandleID* id);
+
+std::string GetSharedMemoryHandleIDString(const SharedMemoryHandleID& id);
+
} // namespace base
#endif // BASE_MEMORY_SHARED_MEMORY_HANDLE_H_

Powered by Google App Engine
This is Rietveld 408576698