OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/browser/task_management/providers/child_process_task.h" | 5 #include "chrome/browser/task_management/providers/child_process_task.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/numerics/safe_conversions.h" | 10 #include "base/numerics/safe_conversions.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 } | 39 } |
40 | 40 |
41 return g_default_icon; | 41 return g_default_icon; |
42 } | 42 } |
43 | 43 |
44 base::string16 GetLocalizedTitle(const base::string16& title, | 44 base::string16 GetLocalizedTitle(const base::string16& title, |
45 int process_type) { | 45 int process_type) { |
46 base::string16 result_title = title; | 46 base::string16 result_title = title; |
47 if (result_title.empty()) { | 47 if (result_title.empty()) { |
48 switch (process_type) { | 48 switch (process_type) { |
49 case content::PROCESS_TYPE_PLUGIN: | |
50 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 49 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
51 case content::PROCESS_TYPE_PPAPI_BROKER: | 50 case content::PROCESS_TYPE_PPAPI_BROKER: |
52 result_title = l10n_util::GetStringUTF16( | 51 result_title = l10n_util::GetStringUTF16( |
53 IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); | 52 IDS_TASK_MANAGER_UNKNOWN_PLUGIN_NAME); |
54 break; | 53 break; |
55 default: | 54 default: |
56 // Nothing to do for non-plugin processes. | 55 // Nothing to do for non-plugin processes. |
57 break; | 56 break; |
58 } | 57 } |
59 } | 58 } |
60 | 59 |
61 // Explicitly mark name as LTR if there is no strong RTL character, | 60 // Explicitly mark name as LTR if there is no strong RTL character, |
62 // to avoid the wrong concatenation result similar to "!Yahoo Mail: the | 61 // to avoid the wrong concatenation result similar to "!Yahoo Mail: the |
63 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew | 62 // best web-based Email: NIGULP", in which "NIGULP" stands for the Hebrew |
64 // or Arabic word for "plugin". | 63 // or Arabic word for "plugin". |
65 base::i18n::AdjustStringForLocaleDirection(&result_title); | 64 base::i18n::AdjustStringForLocaleDirection(&result_title); |
66 | 65 |
67 switch (process_type) { | 66 switch (process_type) { |
68 case content::PROCESS_TYPE_UTILITY: | 67 case content::PROCESS_TYPE_UTILITY: |
69 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, | 68 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, |
70 result_title); | 69 result_title); |
71 case content::PROCESS_TYPE_GPU: | 70 case content::PROCESS_TYPE_GPU: |
72 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX); | 71 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_GPU_PREFIX); |
73 case content::PROCESS_TYPE_PLUGIN: | |
74 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 72 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
75 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, | 73 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_PREFIX, |
76 result_title); | 74 result_title); |
77 case content::PROCESS_TYPE_PPAPI_BROKER: | 75 case content::PROCESS_TYPE_PPAPI_BROKER: |
78 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_BROKER_PREFIX, | 76 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_PLUGIN_BROKER_PREFIX, |
79 result_title); | 77 result_title); |
80 case PROCESS_TYPE_NACL_BROKER: | 78 case PROCESS_TYPE_NACL_BROKER: |
81 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); | 79 return l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NACL_BROKER_PREFIX); |
82 case PROCESS_TYPE_NACL_LOADER: { | 80 case PROCESS_TYPE_NACL_LOADER: { |
83 auto* profile_manager = g_browser_process->profile_manager(); | 81 auto* profile_manager = g_browser_process->profile_manager(); |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 | 197 |
200 v8_memory_allocated_ = base::saturated_cast<int64_t>( | 198 v8_memory_allocated_ = base::saturated_cast<int64_t>( |
201 process_resources_sampler_->GetV8MemoryAllocated()); | 199 process_resources_sampler_->GetV8MemoryAllocated()); |
202 v8_memory_used_ = base::saturated_cast<int64_t>( | 200 v8_memory_used_ = base::saturated_cast<int64_t>( |
203 process_resources_sampler_->GetV8MemoryUsed()); | 201 process_resources_sampler_->GetV8MemoryUsed()); |
204 } | 202 } |
205 | 203 |
206 Task::Type ChildProcessTask::GetType() const { | 204 Task::Type ChildProcessTask::GetType() const { |
207 // Convert |content::ProcessType| to |task_management::Task::Type|. | 205 // Convert |content::ProcessType| to |task_management::Task::Type|. |
208 switch (process_type_) { | 206 switch (process_type_) { |
209 case content::PROCESS_TYPE_PLUGIN: | |
210 case content::PROCESS_TYPE_PPAPI_PLUGIN: | 207 case content::PROCESS_TYPE_PPAPI_PLUGIN: |
211 case content::PROCESS_TYPE_PPAPI_BROKER: | 208 case content::PROCESS_TYPE_PPAPI_BROKER: |
212 return Task::PLUGIN; | 209 return Task::PLUGIN; |
213 case content::PROCESS_TYPE_UTILITY: | 210 case content::PROCESS_TYPE_UTILITY: |
214 return Task::UTILITY; | 211 return Task::UTILITY; |
215 case content::PROCESS_TYPE_ZYGOTE: | 212 case content::PROCESS_TYPE_ZYGOTE: |
216 return Task::ZYGOTE; | 213 return Task::ZYGOTE; |
217 case content::PROCESS_TYPE_SANDBOX_HELPER: | 214 case content::PROCESS_TYPE_SANDBOX_HELPER: |
218 return Task::SANDBOX_HELPER; | 215 return Task::SANDBOX_HELPER; |
219 case content::PROCESS_TYPE_GPU: | 216 case content::PROCESS_TYPE_GPU: |
(...skipping 16 matching lines...) Expand all Loading... |
236 | 233 |
237 int64_t ChildProcessTask::GetV8MemoryAllocated() const { | 234 int64_t ChildProcessTask::GetV8MemoryAllocated() const { |
238 return v8_memory_allocated_; | 235 return v8_memory_allocated_; |
239 } | 236 } |
240 | 237 |
241 int64_t ChildProcessTask::GetV8MemoryUsed() const { | 238 int64_t ChildProcessTask::GetV8MemoryUsed() const { |
242 return v8_memory_used_; | 239 return v8_memory_used_; |
243 } | 240 } |
244 | 241 |
245 } // namespace task_management | 242 } // namespace task_management |
OLD | NEW |