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

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

Issue 2734883003: base: Make TimeDurationFormat* report failures. (Closed)
Patch Set: add WARN_UNUSED_RESULT 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 str;
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();
ncarter (slow) 2017/03/06 21:52:37 Since we have a n/a string here, I think we gracef
Daniel Erat 2017/03/06 22:47:10 i don't think these failures should ever occur, so
ncarter (slow) 2017/03/06 23:04:52 Let's omit the LOG(ERROR); I don't think it's wort
Daniel Erat 2017/03/06 23:19:34 done (although i've more than offset that binary-s
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
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
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