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

Issue 2734883003: base: Make TimeDurationFormat* report failures. (Closed)

Created:
3 years, 9 months ago by Daniel Erat
Modified:
3 years, 9 months ago
CC:
chromium-reviews, kalyank, sadrul, oshima+watch_chromium.org, vmpstr+watch_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

base: Make TimeDurationFormat* report failures. Update base::TimeDurationFormat() and base::TimeDurationFormatWithSeconds() to return boolean "success" values and use out-params to return formatted strings. ICU errors were formerly swallowed, which makes it impossible for the UI to handle them gracefully or for developers to investigate their causes. BUG=698802, 677043 Review-Url: https://codereview.chromium.org/2734883003 Cr-Commit-Position: refs/heads/master@{#455144} Committed: https://chromium.googlesource.com/chromium/src/+/efcd30ca164e0e1bbcfe402840d8c23aa9d40fd9

Patch Set 1 #

Total comments: 10

Patch Set 2 : add WARN_UNUSED_RESULT #

Total comments: 4

Patch Set 3 : add/remove logging #

Total comments: 2

Patch Set 4 : avoid msvc compilation error, hopefully #

Total comments: 2

Patch Set 5 : include utypes.h #

Total comments: 2

Patch Set 6 : log locale #

Unified diffs Side-by-side diffs Delta from patch set Stats (+116 lines, -48 lines) Patch
M ash/common/system/chromeos/power/battery_notification.cc View 1 chunk +4 lines, -2 lines 0 comments Download
M ash/common/system/chromeos/power/power_status_view.cc View 1 chunk +5 lines, -1 line 0 comments Download
M base/i18n/time_formatting.h View 1 3 chunks +16 lines, -8 lines 0 comments Download
M base/i18n/time_formatting.cc View 1 2 3 4 5 3 chunks +33 lines, -6 lines 0 comments Download
M base/i18n/time_formatting_unittest.cc View 5 chunks +53 lines, -29 lines 0 comments Download
M chrome/browser/ui/task_manager/task_manager_table_model.cc View 1 2 1 chunk +5 lines, -2 lines 0 comments Download

Messages

Total messages: 49 (26 generated)
Daniel Erat
https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.cc#newcode191 base/i18n/time_formatting.cc:191: icu::Measure(minutes, icu::MeasureUnit::createMinute(status), status)}; it seems to be undocumented, but ...
3 years, 9 months ago (2017-03-06 20:14:58 UTC) #3
bruthig
lgtm https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.h File base/i18n/time_formatting.h (right): https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.h#newcode110 base/i18n/time_formatting.h:110: BASE_I18N_EXPORT bool TimeDurationFormat(const TimeDelta time, Consider using the ...
3 years, 9 months ago (2017-03-06 21:12:38 UTC) #5
Daniel Erat
https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.h File base/i18n/time_formatting.h (right): https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.h#newcode110 base/i18n/time_formatting.h:110: BASE_I18N_EXPORT bool TimeDurationFormat(const TimeDelta time, On 2017/03/06 21:12:38, bruthig ...
3 years, 9 months ago (2017-03-06 21:24:32 UTC) #8
Daniel Erat
ahmed or nick, mind doing an owner review for chrome/browser/ui/task_manager/task_manager_table_model.cc?
3 years, 9 months ago (2017-03-06 21:26:26 UTC) #10
Greg Levin
https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.cc#newcode191 base/i18n/time_formatting.cc:191: icu::Measure(minutes, icu::MeasureUnit::createMinute(status), status)}; On 2017/03/06 20:14:58, Daniel Erat wrote: ...
3 years, 9 months ago (2017-03-06 21:40:07 UTC) #13
ncarter (slow)
https://codereview.chromium.org/2734883003/diff/20001/chrome/browser/ui/task_manager/task_manager_table_model.cc File chrome/browser/ui/task_manager/task_manager_table_model.cc (right): https://codereview.chromium.org/2734883003/diff/20001/chrome/browser/ui/task_manager/task_manager_table_model.cc#newcode147 chrome/browser/ui/task_manager/task_manager_table_model.cc:147: LOG(ERROR) << "Failed to format duration " << cpu_time.ToInternalValue(); ...
3 years, 9 months ago (2017-03-06 21:52:37 UTC) #14
Daniel Erat
https://codereview.chromium.org/2734883003/diff/20001/chrome/browser/ui/task_manager/task_manager_table_model.cc File chrome/browser/ui/task_manager/task_manager_table_model.cc (right): https://codereview.chromium.org/2734883003/diff/20001/chrome/browser/ui/task_manager/task_manager_table_model.cc#newcode147 chrome/browser/ui/task_manager/task_manager_table_model.cc:147: LOG(ERROR) << "Failed to format duration " << cpu_time.ToInternalValue(); ...
3 years, 9 months ago (2017-03-06 22:47:10 UTC) #17
ncarter (slow)
https://codereview.chromium.org/2734883003/diff/20001/chrome/browser/ui/task_manager/task_manager_table_model.cc File chrome/browser/ui/task_manager/task_manager_table_model.cc (right): https://codereview.chromium.org/2734883003/diff/20001/chrome/browser/ui/task_manager/task_manager_table_model.cc#newcode147 chrome/browser/ui/task_manager/task_manager_table_model.cc:147: LOG(ERROR) << "Failed to format duration " << cpu_time.ToInternalValue(); ...
3 years, 9 months ago (2017-03-06 23:04:52 UTC) #18
ncarter (slow)
task_manager lgtm assuming you remove the LOG()
3 years, 9 months ago (2017-03-06 23:05:14 UTC) #19
Daniel Erat
https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/1/base/i18n/time_formatting.cc#newcode192 base/i18n/time_formatting.cc:192: icu::MeasureFormat measure_format(icu::Locale::getDefault(), u_width, status); On 2017/03/06 21:40:06, Greg Levin ...
3 years, 9 months ago (2017-03-06 23:19:34 UTC) #20
Greg Levin
LGTM, except for comment https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc#newcode238 base/i18n/time_formatting.cc:238: return U_SUCCESS(status); I think this ...
3 years, 9 months ago (2017-03-06 23:43:21 UTC) #23
Daniel Erat
https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc#newcode238 base/i18n/time_formatting.cc:238: return U_SUCCESS(status); On 2017/03/06 23:43:21, Greg Levin wrote: > ...
3 years, 9 months ago (2017-03-06 23:50:56 UTC) #24
jungshik at Google
On 2017/03/06 23:50:56, Daniel Erat wrote: > https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc > File base/i18n/time_formatting.cc (right): > > https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc#newcode238 ...
3 years, 9 months ago (2017-03-07 03:27:11 UTC) #29
jungshik at Google
On 2017/03/06 23:50:56, Daniel Erat wrote: > https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc > File base/i18n/time_formatting.cc (right): > > https://codereview.chromium.org/2734883003/diff/40001/base/i18n/time_formatting.cc#newcode238 ...
3 years, 9 months ago (2017-03-07 03:27:15 UTC) #30
jungshik at Google
https://codereview.chromium.org/2734883003/diff/60001/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/60001/base/i18n/time_formatting.cc#newcode19 base/i18n/time_formatting.cc:19: #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" Nit: care to explicitly include an ICU ...
3 years, 9 months ago (2017-03-07 04:48:54 UTC) #33
Daniel Erat
thanks! https://codereview.chromium.org/2734883003/diff/60001/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/60001/base/i18n/time_formatting.cc#newcode19 base/i18n/time_formatting.cc:19: #include "third_party/icu/source/i18n/unicode/smpdtfmt.h" On 2017/03/07 04:48:54, jungshik at Google ...
3 years, 9 months ago (2017-03-07 05:01:36 UTC) #34
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2734883003/80001
3 years, 9 months ago (2017-03-07 05:03:28 UTC) #37
commit-bot: I haz the power
Try jobs failed on following builders: win_chromium_x64_rel_ng on master.tryserver.chromium.win (JOB_FAILED, http://build.chromium.org/p/tryserver.chromium.win/builders/win_chromium_x64_rel_ng/builds/379319)
3 years, 9 months ago (2017-03-07 08:13:53 UTC) #39
jungshik at Google
https://codereview.chromium.org/2734883003/diff/80001/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/80001/base/i18n/time_formatting.cc#newcode203 base/i18n/time_formatting.cc:203: LOG(ERROR) << "Creating MeasureFormat failed: " << u_errorName(status); I ...
3 years, 9 months ago (2017-03-07 08:44:46 UTC) #40
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2734883003/80001
3 years, 9 months ago (2017-03-07 15:33:54 UTC) #42
Daniel Erat
https://codereview.chromium.org/2734883003/diff/80001/base/i18n/time_formatting.cc File base/i18n/time_formatting.cc (right): https://codereview.chromium.org/2734883003/diff/80001/base/i18n/time_formatting.cc#newcode203 base/i18n/time_formatting.cc:203: LOG(ERROR) << "Creating MeasureFormat failed: " << u_errorName(status); On ...
3 years, 9 months ago (2017-03-07 15:53:34 UTC) #43
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2734883003/100001
3 years, 9 months ago (2017-03-07 15:54:36 UTC) #46
commit-bot: I haz the power
3 years, 9 months ago (2017-03-07 18:26:32 UTC) #49
Message was sent while issue was closed.
Committed patchset #6 (id:100001) as
https://chromium.googlesource.com/chromium/src/+/efcd30ca164e0e1bbcfe402840d8...

Powered by Google App Engine
This is Rietveld 408576698