OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 case UTILITY_PROCESS: | 49 case UTILITY_PROCESS: |
50 return L"Utility"; | 50 return L"Utility"; |
51 case PROFILE_IMPORT_PROCESS: | 51 case PROFILE_IMPORT_PROCESS: |
52 return L"Profile Import helper"; | 52 return L"Profile Import helper"; |
53 case ZYGOTE_PROCESS: | 53 case ZYGOTE_PROCESS: |
54 return L"Zygote"; | 54 return L"Zygote"; |
55 case SANDBOX_HELPER_PROCESS: | 55 case SANDBOX_HELPER_PROCESS: |
56 return L"Sandbox helper"; | 56 return L"Sandbox helper"; |
57 case NACL_LOADER_PROCESS: | 57 case NACL_LOADER_PROCESS: |
58 return L"Native Client module"; | 58 return L"Native Client module"; |
| 59 case NACL_BROKER_PROCESS: |
| 60 return L"Native Client broker"; |
59 case UNKNOWN_PROCESS: | 61 case UNKNOWN_PROCESS: |
60 default: | 62 default: |
61 DCHECK(false) << "Unknown child process type!"; | 63 DCHECK(false) << "Unknown child process type!"; |
62 return L"Unknown"; | 64 return L"Unknown"; |
63 } | 65 } |
64 } | 66 } |
65 | 67 |
66 std::wstring ChildProcessInfo::GetLocalizedTitle() const { | 68 std::wstring ChildProcessInfo::GetLocalizedTitle() const { |
67 std::wstring title = name_; | 69 std::wstring title = name_; |
68 if (type_ == ChildProcessInfo::PLUGIN_PROCESS && title.empty()) | 70 if (type_ == ChildProcessInfo::PLUGIN_PROCESS && title.empty()) |
69 title = l10n_util::GetString(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); | 71 title = l10n_util::GetString(IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); |
70 | 72 |
71 int message_id; | 73 int message_id; |
72 if (type_ == ChildProcessInfo::PLUGIN_PROCESS) { | 74 if (type_ == ChildProcessInfo::PLUGIN_PROCESS) { |
73 message_id = IDS_TASK_MANAGER_PLUGIN_PREFIX; | 75 message_id = IDS_TASK_MANAGER_PLUGIN_PREFIX; |
74 } else if (type_ == ChildProcessInfo::WORKER_PROCESS) { | 76 } else if (type_ == ChildProcessInfo::WORKER_PROCESS) { |
75 message_id = IDS_TASK_MANAGER_WORKER_PREFIX; | 77 message_id = IDS_TASK_MANAGER_WORKER_PREFIX; |
76 } else if (type_ == ChildProcessInfo::UTILITY_PROCESS) { | 78 } else if (type_ == ChildProcessInfo::UTILITY_PROCESS) { |
77 message_id = IDS_TASK_MANAGER_UTILITY_PREFIX; | 79 message_id = IDS_TASK_MANAGER_UTILITY_PREFIX; |
78 } else if (type_ == ChildProcessInfo::PROFILE_IMPORT_PROCESS) { | 80 } else if (type_ == ChildProcessInfo::PROFILE_IMPORT_PROCESS) { |
79 message_id = IDS_TASK_MANAGER_PROFILE_IMPORT_PREFIX; | 81 message_id = IDS_TASK_MANAGER_PROFILE_IMPORT_PREFIX; |
80 } else if (type_ == ChildProcessInfo::NACL_LOADER_PROCESS) { | 82 } else if (type_ == ChildProcessInfo::NACL_LOADER_PROCESS) { |
81 message_id = IDS_TASK_MANAGER_NACL_PREFIX; | 83 message_id = IDS_TASK_MANAGER_NACL_PREFIX; |
| 84 } else if (type_ == ChildProcessInfo::NACL_BROKER_PROCESS) { |
| 85 message_id = IDS_TASK_MANAGER_NACL_BROKER_PREFIX; |
82 } else { | 86 } else { |
83 DCHECK(false) << "Need localized name for child process type."; | 87 DCHECK(false) << "Need localized name for child process type."; |
84 return title; | 88 return title; |
85 } | 89 } |
86 | 90 |
87 // Explicitly mark name as LTR if there is no strong RTL character, | 91 // Explicitly mark name as LTR if there is no strong RTL character, |
88 // to avoid the wrong concatenation result similar to "!Yahoo! Mail: the | 92 // to avoid the wrong concatenation result similar to "!Yahoo! Mail: the |
89 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew | 93 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew |
90 // or Arabic word for "plugin". | 94 // or Arabic word for "plugin". |
91 l10n_util::AdjustStringForLocaleDirection(title, &title); | 95 l10n_util::AdjustStringForLocaleDirection(title, &title); |
(...skipping 18 matching lines...) Expand all Loading... |
110 base::GetCurrentProcId(), instance, | 114 base::GetCurrentProcId(), instance, |
111 base::RandInt(0, std::numeric_limits<int>::max())); | 115 base::RandInt(0, std::numeric_limits<int>::max())); |
112 } | 116 } |
113 | 117 |
114 // static | 118 // static |
115 int ChildProcessInfo::GenerateChildProcessUniqueId() { | 119 int ChildProcessInfo::GenerateChildProcessUniqueId() { |
116 // This function must be threadsafe. | 120 // This function must be threadsafe. |
117 static base::subtle::Atomic32 last_unique_child_id = 0; | 121 static base::subtle::Atomic32 last_unique_child_id = 0; |
118 return base::subtle::NoBarrier_AtomicIncrement(&last_unique_child_id, 1); | 122 return base::subtle::NoBarrier_AtomicIncrement(&last_unique_child_id, 1); |
119 } | 123 } |
OLD | NEW |