Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(32)

Side by Side Diff: chrome/browser/ui/task_manager/task_manager_table_model.cc

Issue 2736363002: base: Make TimeDurationFormat* report failures. (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « base/i18n/time_formatting_unittest.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 duration;
145 base::DURATION_WIDTH_NARROW); 145 return base::TimeDurationFormatWithSeconds(
146 cpu_time, base::DURATION_WIDTH_NARROW, &duration)
147 ? duration
148 : n_a_string_;
146 } 149 }
147 150
148 base::string16 GetMemoryUsageText(int64_t memory_usage, bool has_duplicates) { 151 base::string16 GetMemoryUsageText(int64_t memory_usage, bool has_duplicates) {
149 if (memory_usage == -1) 152 if (memory_usage == -1)
150 return n_a_string_; 153 return n_a_string_;
151 154
152 #if defined(OS_MACOSX) 155 #if defined(OS_MACOSX)
153 // System expectation is to show "100 kB", "200 MB", etc. 156 // 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]: 157 // 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). 158 // Switch to metric units (as opposed to powers of two).
(...skipping 773 matching lines...) Expand 10 before | Expand all | Expand 10 after
929 932
930 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const { 933 bool TaskManagerTableModel::IsTaskFirstInGroup(int row_index) const {
931 if (row_index == 0) 934 if (row_index == 0)
932 return true; 935 return true;
933 936
934 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) != 937 return observed_task_manager()->GetProcessId(tasks_[row_index - 1]) !=
935 observed_task_manager()->GetProcessId(tasks_[row_index]); 938 observed_task_manager()->GetProcessId(tasks_[row_index]);
936 } 939 }
937 940
938 } // namespace task_manager 941 } // namespace task_manager
OLDNEW
« no previous file with comments | « base/i18n/time_formatting_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698