OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "chrome/common/child_process_info.h" | 5 #include "chrome/common/child_process_info.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 | 8 |
9 #include "app/l10n_util.h" | 9 #include "app/l10n_util.h" |
10 #include "base/atomicops.h" | 10 #include "base/atomicops.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 } else if (type_ == ChildProcessInfo::WORKER_PROCESS) { | 90 } else if (type_ == ChildProcessInfo::WORKER_PROCESS) { |
91 message_id = IDS_TASK_MANAGER_WORKER_PREFIX; | 91 message_id = IDS_TASK_MANAGER_WORKER_PREFIX; |
92 } else if (type_ == ChildProcessInfo::UTILITY_PROCESS) { | 92 } else if (type_ == ChildProcessInfo::UTILITY_PROCESS) { |
93 message_id = IDS_TASK_MANAGER_UTILITY_PREFIX; | 93 message_id = IDS_TASK_MANAGER_UTILITY_PREFIX; |
94 } else if (type_ == ChildProcessInfo::PROFILE_IMPORT_PROCESS) { | 94 } else if (type_ == ChildProcessInfo::PROFILE_IMPORT_PROCESS) { |
95 message_id = IDS_TASK_MANAGER_PROFILE_IMPORT_PREFIX; | 95 message_id = IDS_TASK_MANAGER_PROFILE_IMPORT_PREFIX; |
96 } else if (type_ == ChildProcessInfo::NACL_LOADER_PROCESS) { | 96 } else if (type_ == ChildProcessInfo::NACL_LOADER_PROCESS) { |
97 message_id = IDS_TASK_MANAGER_NACL_PREFIX; | 97 message_id = IDS_TASK_MANAGER_NACL_PREFIX; |
98 } else if (type_ == ChildProcessInfo::NACL_BROKER_PROCESS) { | 98 } else if (type_ == ChildProcessInfo::NACL_BROKER_PROCESS) { |
99 message_id = IDS_TASK_MANAGER_NACL_BROKER_PREFIX; | 99 message_id = IDS_TASK_MANAGER_NACL_BROKER_PREFIX; |
| 100 } else if (type_ == ChildProcessInfo::GPU_PROCESS) { |
| 101 message_id = IDS_TASK_MANAGER_GPU_PREFIX; |
100 } else { | 102 } else { |
101 DCHECK(false) << "Need localized name for child process type."; | 103 DCHECK(false) << "Need localized name for child process type."; |
102 return title; | 104 return title; |
103 } | 105 } |
104 | 106 |
105 return l10n_util::GetStringFUTF16(message_id, title); | 107 return l10n_util::GetStringFUTF16(message_id, title); |
106 } | 108 } |
107 | 109 |
108 ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : type_(type) { | 110 ChildProcessInfo::ChildProcessInfo(ProcessType type, int id) : type_(type) { |
109 if (id == -1) | 111 if (id == -1) |
(...skipping 13 matching lines...) Expand all Loading... |
123 base::GetCurrentProcId(), instance, | 125 base::GetCurrentProcId(), instance, |
124 base::RandInt(0, std::numeric_limits<int>::max())); | 126 base::RandInt(0, std::numeric_limits<int>::max())); |
125 } | 127 } |
126 | 128 |
127 // static | 129 // static |
128 int ChildProcessInfo::GenerateChildProcessUniqueId() { | 130 int ChildProcessInfo::GenerateChildProcessUniqueId() { |
129 // This function must be threadsafe. | 131 // This function must be threadsafe. |
130 static base::subtle::Atomic32 last_unique_child_id = 0; | 132 static base::subtle::Atomic32 last_unique_child_id = 0; |
131 return base::subtle::NoBarrier_AtomicIncrement(&last_unique_child_id, 1); | 133 return base::subtle::NoBarrier_AtomicIncrement(&last_unique_child_id, 1); |
132 } | 134 } |
OLD | NEW |