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

Unified Diff: third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/util.js

Issue 2888263002: DevTools: Roll Lighthouse binary to 2.0.1-alpha.0 (Closed)
Patch Set: rebase Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/util.js
diff --git a/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/util.js b/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/util.js
index d032e2a1784a01a935025ac20417cc4e21883d33..7f541dbfa0154d942fe5fe21f41c5c232d1dad7b 100644
--- a/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/util.js
+++ b/third_party/WebKit/Source/devtools/front_end/audits2/lighthouse/renderer/util.js
@@ -18,6 +18,7 @@
/* globals self URL */
const ELLIPSIS = '\u2026';
+const NBSP = '\xa0';
const RATINGS = {
PASS: {label: 'pass', minScore: 75},
@@ -59,6 +60,16 @@ class Util {
return (size / 1024).toLocaleString(undefined, {maximumFractionDigits: decimalPlaces});
}
+ /**
+ * @param {number} ms
+ * @param {number=} granularity Controls how coarse the displayed value is, defaults to 10
+ * @return {string}
+ */
+ static formatMilliseconds(ms, granularity = 10) {
+ const coarseTime = Math.round(ms / granularity) * granularity;
+ return `${coarseTime.toLocaleString()}${NBSP}ms`;
+ }
+
/**
* Format time.
* @param {string} date

Powered by Google App Engine
This is Rietveld 408576698