Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/process/process_handle.h" | |
| 6 | |
| 7 namespace base { | |
| 8 | |
| 9 namespace { | |
| 10 uint32 g_unique_id = kInvalidUniqueId; | |
| 11 } // namespace | |
| 12 | |
| 13 uint32 GetUniqueIdForProcess() { | |
| 14 if (g_unique_id == kInvalidUniqueId) { | |
| 15 return static_cast<uint32>(GetCurrentProcId()); | |
| 16 } | |
| 17 | |
| 18 return g_unique_id; | |
| 19 } | |
| 20 | |
| 21 void SetUniqueIdForProcess(uint32 unique_id) { | |
| 22 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
| |
| 23 } | |
| 24 | |
| 25 } // namespace base | |
| OLD | NEW |