| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/common/child_process_info.h" | 5 #include "content/common/child_process_info.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 | 8 |
| 9 #include "base/atomicops.h" | 9 #include "base/atomicops.h" |
| 10 #include "base/i18n/rtl.h" | 10 #include "base/i18n/rtl.h" |
| 11 #include "base/logging.h" | 11 #include "base/logging.h" |
| 12 #include "base/process_util.h" | 12 #include "base/process_util.h" |
| 13 #include "base/rand_util.h" | 13 #include "base/rand_util.h" |
| 14 #include "base/string_util.h" | 14 #include "base/stringprintf.h" |
| 15 #include "base/utf_string_conversions.h" | 15 #include "base/utf_string_conversions.h" |
| 16 | 16 |
| 17 ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : | 17 ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : |
| 18 type_(type), | 18 type_(type), |
| 19 renderer_type_(RENDERER_UNKNOWN) { | 19 renderer_type_(RENDERER_UNKNOWN) { |
| 20 if (id == -1) | 20 if (id == -1) |
| 21 id_ = GenerateChildProcessUniqueId(); | 21 id_ = GenerateChildProcessUniqueId(); |
| 22 else | 22 else |
| 23 id_ = id; | 23 id_ = id; |
| 24 } | 24 } |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 130 base::GetCurrentProcId(), instance, | 130 base::GetCurrentProcId(), instance, |
| 131 base::RandInt(0, std::numeric_limits<int>::max())); | 131 base::RandInt(0, std::numeric_limits<int>::max())); |
| 132 } | 132 } |
| 133 | 133 |
| 134 // static | 134 // static |
| 135 int ChildProcessInfo::GenerateChildProcessUniqueId() { | 135 int ChildProcessInfo::GenerateChildProcessUniqueId() { |
| 136 // This function must be threadsafe. | 136 // This function must be threadsafe. |
| 137 static base::subtle::Atomic32 last_unique_child_id = 0; | 137 static base::subtle::Atomic32 last_unique_child_id = 0; |
| 138 return base::subtle::NoBarrier_AtomicIncrement(&last_unique_child_id, 1); | 138 return base::subtle::NoBarrier_AtomicIncrement(&last_unique_child_id, 1); |
| 139 } | 139 } |
| OLD | NEW |