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

Unified Diff: base/process/process_handle.cc

Issue 1186873006: Add Get/SetUniqueIdForProcess. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Respond to comments. 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.cc
diff --git a/base/process/process_handle.cc b/base/process/process_handle.cc
new file mode 100644
index 0000000000000000000000000000000000000000..2321c216688ccc43063b25ec6d6a7dc3f072e2ee
--- /dev/null
+++ b/base/process/process_handle.cc
@@ -0,0 +1,25 @@
+// Copyright (c) 2013 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/process/process_handle.h"
+
+namespace base {
+
+namespace {
+uint32 g_unique_id = kInvalidUniqueId;
+} // namespace
+
+uint32 GetUniqueIdForProcess() {
+ if (g_unique_id == kInvalidUniqueId) {
+ return static_cast<uint32>(GetCurrentProcId());
+ }
+
+ return g_unique_id;
+}
+
+void SetUniqueIdForProcess(uint32 unique_id) {
+ g_unique_id = unique_id;
jln (very slow on Chromium) 2015/06/15 23:25:08 This is not thread_safe. How about using a lazy in
rickyz (no longer on Chrome) 2015/06/17 00:50:33 Does it suffice to just document that it is not th
+}
+
+} // namespace base

Powered by Google App Engine
This is Rietveld 408576698