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

Unified Diff: base/process/process_handle.h

Issue 1186873006: Add Get/SetUniqueIdForProcess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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/process/process_handle.h
diff --git a/base/process/process_handle.h b/base/process/process_handle.h
index 77f2c585cfcc71087596855fa6f83ac643ce9a6c..b3e296f5355c423d6468e06d3c8683722a8872c5 100644
--- a/base/process/process_handle.h
+++ b/base/process/process_handle.h
@@ -34,9 +34,24 @@ 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 globally unique ID for the current process. This defaults to the
mdempsky 2015/06/15 21:53:09 I think "globally" might be misinterpretable. It
rickyz (no longer on Chrome) 2015/06/15 22:09:47 Ah, good point, changed.
+// process process ID, but may return a different value if SetUniqueIdForProcess
mdempsky 2015/06/15 21:53:09 Should "process process ID" be "process's process
rickyz (no longer on Chrome) 2015/06/15 22:09:46 Done.
+// has been called.
+BASE_EXPORT uint32 GetUniqueIdForProcess();
+
+// Sets the unique ID for the current process. |unique_id| may not be
+// kInvalidUniqueId.
+// WARNING: To avoid inconsistent results from GetUniqueIdForProcess, this
+// should only be called very early after process startup - ideally immediately
+// after fork.
+BASE_EXPORT void SetUniqueIdForProcess(uint32 unique_id);
+
// Returns the ProcessHandle of the current process.
BASE_EXPORT ProcessHandle GetCurrentProcessHandle();

Powered by Google App Engine
This is Rietveld 408576698