Index: base/process/process_handle.h |
diff --git a/base/process/process_handle.h b/base/process/process_handle.h |
index 77f2c585cfcc71087596855fa6f83ac643ce9a6c..aaa28ecf3fe2451656607d40d034945bbb34a5b4 100644 |
--- a/base/process/process_handle.h |
+++ b/base/process/process_handle.h |
@@ -34,9 +34,26 @@ const ProcessHandle kNullProcessHandle = 0; |
const ProcessId kNullProcessId = 0; |
#endif // defined(OS_WIN) |
+// This is not a valid process ID on Linux, Mac, or Windows. |
+const uint32 kInvalidUniqueId = 0; |
+ |
// Returns the id of the current process. |
BASE_EXPORT ProcessId GetCurrentProcId(); |
+// Returns a unique ID for the current process. The ID will be unique across all |
+// currently running processes within the chrome session, but note that IDs of |
+// terminated processes may be reused. This defaults to the process's process |
+// ID, but may return a different value if SetUniqueIdForProcess has been |
+// called. |
+BASE_EXPORT uint32 GetUniqueIdForProcess(); |
+ |
+// Sets the unique ID for the current process. |unique_id| may not be |
+// kInvalidUniqueId. Not thread safe. |
+// WARNING: To avoid inconsistent results from GetUniqueIdForProcess, this |
+// should only be called very early after process startup - ideally as soon |
+// after process creation as possible. |
+BASE_EXPORT void SetUniqueIdForProcess(uint32 unique_id); |
+ |
// Returns the ProcessHandle of the current process. |
BASE_EXPORT ProcessHandle GetCurrentProcessHandle(); |