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/ui/task_manager/task_manager_table_model.h" | 5 #include "chrome/browser/ui/task_manager/task_manager_table_model.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/i18n/number_formatting.h" | 10 #include "base/i18n/number_formatting.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
134 if (start_time.is_null()) | 134 if (start_time.is_null()) |
135 return n_a_string_; | 135 return n_a_string_; |
136 | 136 |
137 return base::TimeFormatShortDateAndTime(start_time); | 137 return base::TimeFormatShortDateAndTime(start_time); |
138 } | 138 } |
139 | 139 |
140 base::string16 GetCpuTimeText(base::TimeDelta cpu_time) { | 140 base::string16 GetCpuTimeText(base::TimeDelta cpu_time) { |
141 if (cpu_time.is_zero()) | 141 if (cpu_time.is_zero()) |
142 return n_a_string_; | 142 return n_a_string_; |
143 | 143 |
144 return base::TimeDurationFormatWithSeconds(cpu_time, | 144 base::string16 str; |
Greg Levin
2017/03/06 21:40:07
nit: Maybe something more descriptive, like |durat
Daniel Erat
2017/03/06 23:19:34
Done.
| |
145 base::DURATION_WIDTH_NARROW); | 145 if (!base::TimeDurationFormatWithSeconds( |
146 cpu_time, base::DURATION_WIDTH_NARROW, &str)) { | |
147 LOG(ERROR) << "Failed to format duration " << cpu_time.ToInternalValue(); | |
148 return n_a_string_; | |
149 } | |
150 return str; | |
146 } | 151 } |
147 | 152 |
148 base::string16 GetMemoryUsageText(int64_t memory_usage, bool has_duplicates) { | 153 base::string16 GetMemoryUsageText(int64_t memory_usage, bool has_duplicates) { |
149 if (memory_usage == -1) | 154 if (memory_usage == -1) |
150 return n_a_string_; | 155 return n_a_string_; |
151 | 156 |
152 #if defined(OS_MACOSX) | 157 #if defined(OS_MACOSX) |
153 // System expectation is to show "100 kB", "200 MB", etc. | 158 // System expectation is to show "100 kB", "200 MB", etc. |
154 // TODO(thakis): [This TODO has been taken as is from the old task manager]: | 159 // TODO(thakis): [This TODO has been taken as is from the old task manager]: |
155 // Switch to metric units (as opposed to powers of two). | 160 // Switch to metric units (as opposed to powers of two). |
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
929 | 934 |
930 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { | 935 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { |
931 if (row_index == 0) | 936 if (row_index == 0) |
932 return true; | 937 return true; |
933 | 938 |
934 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != | 939 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != |
935 observed_task_manager()->GetProcessId(tasks_[row_index]); | 940 observed_task_manager()->GetProcessId(tasks_[row_index]); |
936 } | 941 } |
937 | 942 |
938 } // namespace task_manager | 943 } // namespace task_manager |
OLD | NEW |