|
|
Created:
6 years, 9 months ago by ltilve Modified:
6 years, 8 months ago CC:
chromium-reviews, arv+watch_chromium.org, oshima+watch_chromium.org Base URL:
https://chromium.googlesource.com/chromium/src.git@master Visibility:
Public. |
DescriptionShow time in hours, minutes and seconds in chrome://memory-internals
BUG=279653
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=260082
Patch Set 1 #
Total comments: 1
Patch Set 2 : Applied suggested correction #
Total comments: 7
Patch Set 3 : Moved modified secondsToHMS function to memory_internals.js #
Total comments: 2
Patch Set 4 : Moved secondsToHMS() into the annonymous function #Messages
Total messages: 38 (0 generated)
Added a new secondsToHMS(totalSeconds) function to produce a readable string to represent the equivalent to a total of seconds. I'm using this function on time measures representations at chrome://memory-internals.
lgtm with nits. thank you for the fixes. https://codereview.chromium.org/208833003/diff/1/ui/webui/resources/js/util.js File ui/webui/resources/js/util.js (right): https://codereview.chromium.org/208833003/diff/1/ui/webui/resources/js/util.j... ui/webui/resources/js/util.js:440: var sec = Math.floor(totalSeconds % 3600 % 60); remove "% 3600"
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/20001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_p...
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/20001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_p...
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/20001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_p...
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/20001
The CQ bit was unchecked by commit-bot@chromium.org
Retried try job too often on chromium_presubmit for step(s) presubmit http://build.chromium.org/p/tryserver.chromium/buildstatus?builder=chromium_p...
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/20001
The CQ bit was unchecked by ltilve@igalia.com
Adding more reviewers, as the chromium_presubmit bot was failing due to the need of validation from an ui/webui/resources/js/util.js owner.
https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... File ui/webui/resources/js/util.js (right): https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:436: { { on previous line https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:441: return ((hour > 0 ? (hour + (hour > 1 ? ' hours ':' hour ')) : '') + Maybe use Intl.DateTimeFormat instead? https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:441: return ((hour > 0 ? (hour + (hour > 1 ? ' hours ':' hour ')) : '') + too many parentheses (the return expression is wrapped in one which is not needed) return (expr); => return expr;
Urgh, forgot to publish comments :-( https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... File ui/webui/resources/js/util.js (right): https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:430: * Produces a readable HH hours MM min. SS sec. string representing Nit: This sentence reads a big bumpy. How about "[...] a readable string in the format '<HH> hours <MM> min. <SS> sec.' [...]"? https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:436: { Opening braces goes on the previous line. https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:441: return ((hour > 0 ? (hour + (hour > 1 ? ' hours ':' hour ')) : '') + This is of course an i18n nightmare. But the page where it is included is also not i18nized, so I guess functionality-wise it's okay. I'm just a bit worried about adding this method to a general utility library (and Web UI in general is definitely i18n-aware). Maybe it would actually be better to move this back to memory_internals.js?
https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... File ui/webui/resources/js/util.js (right): https://codereview.chromium.org/208833003/diff/20001/ui/webui/resources/js/ut... ui/webui/resources/js/util.js:441: return ((hour > 0 ? (hour + (hour > 1 ? ' hours ':' hour ')) : '') + On 2014/03/25 16:36:10, Bernhard Bauer wrote: > This is of course an i18n nightmare. But the page where it is included is also > not i18nized, so I guess functionality-wise it's okay. I'm just a bit worried > about adding this method to a general utility library (and Web UI in general is > definitely i18n-aware). Maybe it would actually be better to move this back to > memory_internals.js? I didn't even notice that this was in util.js Please move to another file. util.js is used in a lot of places.
Thanks for the reviews. I have applied the suggested modifications, moving the function to memory_internals.js, omitting the Intl change for the reason mentioned wrt the rest of the page not having i18n support.
On 2014/03/25 23:32:27, ltilve wrote: > Thanks for the reviews. I have applied the suggested modifications, moving the > function to memory_internals.js, omitting the Intl change for the reason > mentioned wrt the rest of the page not having i18n support. I was thinking that using Intl.DataFormat('en') might lead to code simplification too.
I have some doubt about this. IMHO, as we would still need to calculate the total number of hours both for the uptime or for the open tabs, I think that we would have to do in any case the calculation like Math.floor(totalSeconds / 3600), so I guess we couldn't directly use a date formatter. I could still get the minutes/seconds for the return string creating a new date=Date(totalSeconds*1000) and getting date.getMinutes()/date.getSeconds(), but I'm not sure it's worth. More code simplification could be done if the format is always like HHH:MM:SS, but I was trying to get the string to be as short as possible when there were only seconds or minutes. In any case if you consider better some of these changes just tell me.
https://codereview.chromium.org/208833003/diff/70001/chrome/browser/resources... File chrome/browser/resources/memory_internals/memory_internals.js (right): https://codereview.chromium.org/208833003/diff/70001/chrome/browser/resources... chrome/browser/resources/memory_internals/memory_internals.js:164: function secondsToHMS(totalSeconds) { Move this into the anonymous function on lines 10 - 149?
LGTM
https://codereview.chromium.org/208833003/diff/70001/chrome/browser/resources... File chrome/browser/resources/memory_internals/memory_internals.js (right): https://codereview.chromium.org/208833003/diff/70001/chrome/browser/resources... chrome/browser/resources/memory_internals/memory_internals.js:164: function secondsToHMS(totalSeconds) { On 2014/03/26 12:41:09, Bernhard Bauer wrote: > Move this into the anonymous function on lines 10 - 149? Done.
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/160001
The CQ bit was unchecked by commit-bot@chromium.org
Commit queue rejected this change because the description was changed between the time the change entered the commit queue and the time it was ready to commit. You can safely check the commit box again.
The CQ bit was checked by ltilve@igalia.com
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/ltilve@igalia.com/208833003/160001
Message was sent while issue was closed.
Change committed as 260082 |