OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "ipc/ipc_channel.h" | 5 #include "ipc/ipc_channel.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
10 #include "base/process_util.h" | 10 #include "base/process_util.h" |
11 #include "base/rand_util.h" | 11 #include "base/rand_util.h" |
12 #include "base/stringprintf.h" | 12 #include "base/strings/stringprintf.h" |
13 | 13 |
14 #if !defined(OS_NACL) | 14 #if !defined(OS_NACL) |
15 namespace { | 15 namespace { |
16 | 16 |
17 // Global atomic used to guarantee channel IDs are unique. | 17 // Global atomic used to guarantee channel IDs are unique. |
18 base::StaticAtomicSequenceNumber g_last_id; | 18 base::StaticAtomicSequenceNumber g_last_id; |
19 | 19 |
20 } // namespace | 20 } // namespace |
21 #endif | 21 #endif |
22 | 22 |
(...skipping 11 matching lines...) Expand all Loading... |
34 | 34 |
35 int process_id = base::GetCurrentProcId(); | 35 int process_id = base::GetCurrentProcId(); |
36 return base::StringPrintf("%d.%u.%d", | 36 return base::StringPrintf("%d.%u.%d", |
37 process_id, | 37 process_id, |
38 g_last_id.GetNext(), | 38 g_last_id.GetNext(), |
39 base::RandInt(0, std::numeric_limits<int32>::max())); | 39 base::RandInt(0, std::numeric_limits<int32>::max())); |
40 } | 40 } |
41 | 41 |
42 } // namespace IPC | 42 } // namespace IPC |
43 | 43 |
OLD | NEW |