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

Unified Diff: runtime/observatory/lib/utils.dart

Issue 2345023003: Use dartfmt on Observatory code (Closed)
Patch Set: merge Created 4 years, 3 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
« no previous file with comments | « runtime/observatory/lib/tracer.dart ('k') | runtime/observatory/tool/ensure_dartfmt.sh » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/observatory/lib/utils.dart
diff --git a/runtime/observatory/lib/utils.dart b/runtime/observatory/lib/utils.dart
index 8796e3d61c1dce1c3ac5e242425e5d15439d8028..3e1f025f4fc0de5b7370905d13bcc369947c5ede 100644
--- a/runtime/observatory/lib/utils.dart
+++ b/runtime/observatory/lib/utils.dart
@@ -8,7 +8,6 @@ import 'dart:async';
import 'dart:math';
class Utils {
-
static String formatPercentNormalized(double x) {
var percent = 100.0 * x;
return '${percent.toStringAsFixed(2)}%';
@@ -75,16 +74,16 @@ class Utils {
if (hours > 0) {
return ("${zeroPad(hours,2)}"
- ":${zeroPad(minutes,2)}"
- ":${zeroPad(seconds,2)}"
- ".${zeroPad(millis,3)}");
+ ":${zeroPad(minutes,2)}"
+ ":${zeroPad(seconds,2)}"
+ ".${zeroPad(millis,3)}");
} else if (minutes > 0) {
return ("${zeroPad(minutes,2)}"
- ":${zeroPad(seconds,2)}"
- ".${zeroPad(millis,3)}");
+ ":${zeroPad(seconds,2)}"
+ ".${zeroPad(millis,3)}");
} else {
return ("${zeroPad(seconds,2)}"
- ".${zeroPad(millis,3)}");
+ ".${zeroPad(millis,3)}");
}
}
@@ -137,9 +136,9 @@ class Utils {
static String formatDateTime(DateTime now) {
return '${now.year}-${now.month}-${now.day} '
- '${now.hour.toString().padLeft(2)}:'
- '${now.minute.toString().padLeft(2)}:'
- '${now.second.toString().padLeft(2)}';
+ '${now.hour.toString().padLeft(2)}:'
+ '${now.minute.toString().padLeft(2)}:'
+ '${now.second.toString().padLeft(2)}';
}
static String formatSeconds(double x) {
@@ -151,30 +150,40 @@ class Utils {
}
static String formatDurationInSeconds(Duration x) =>
- formatSeconds(x.inMicroseconds / Duration.MICROSECONDS_PER_SECOND);
+ formatSeconds(x.inMicroseconds / Duration.MICROSECONDS_PER_SECOND);
static String formatDurationInMilliseconds(Duration x) =>
- formatMillis(x.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND);
+ formatMillis(x.inMicroseconds / Duration.MICROSECONDS_PER_MILLISECOND);
static bool runningInJavaScript() => identical(1.0, 1);
- static formatStringAsLiteral(String value, [bool wasTruncated=false]) {
+ static formatStringAsLiteral(String value, [bool wasTruncated = false]) {
var result = new List();
result.add("'".codeUnitAt(0));
for (int codeUnit in value.codeUnits) {
- if (codeUnit == '\n'.codeUnitAt(0)) result.addAll('\\n'.codeUnits);
- else if (codeUnit == '\r'.codeUnitAt(0)) result.addAll('\\r'.codeUnits);
- else if (codeUnit == '\f'.codeUnitAt(0)) result.addAll('\\f'.codeUnits);
- else if (codeUnit == '\b'.codeUnitAt(0)) result.addAll('\\b'.codeUnits);
- else if (codeUnit == '\t'.codeUnitAt(0)) result.addAll('\\t'.codeUnits);
- else if (codeUnit == '\v'.codeUnitAt(0)) result.addAll('\\v'.codeUnits);
- else if (codeUnit == '\$'.codeUnitAt(0)) result.addAll('\\\$'.codeUnits);
- else if (codeUnit == '\\'.codeUnitAt(0)) result.addAll('\\\\'.codeUnits);
- else if (codeUnit == "'".codeUnitAt(0)) result.addAll("'".codeUnits);
+ if (codeUnit == '\n'.codeUnitAt(0))
+ result.addAll('\\n'.codeUnits);
+ else if (codeUnit == '\r'.codeUnitAt(0))
+ result.addAll('\\r'.codeUnits);
+ else if (codeUnit == '\f'.codeUnitAt(0))
+ result.addAll('\\f'.codeUnits);
+ else if (codeUnit == '\b'.codeUnitAt(0))
+ result.addAll('\\b'.codeUnits);
+ else if (codeUnit == '\t'.codeUnitAt(0))
+ result.addAll('\\t'.codeUnits);
+ else if (codeUnit == '\v'.codeUnitAt(0))
+ result.addAll('\\v'.codeUnits);
+ else if (codeUnit == '\$'.codeUnitAt(0))
+ result.addAll('\\\$'.codeUnits);
+ else if (codeUnit == '\\'.codeUnitAt(0))
+ result.addAll('\\\\'.codeUnits);
+ else if (codeUnit == "'".codeUnitAt(0))
+ result.addAll("'".codeUnits);
else if (codeUnit < 32) {
- var escapeSequence = "\\u" + codeUnit.toRadixString(16).padLeft(4, "0");
- result.addAll(escapeSequence.codeUnits);
- } else result.add(codeUnit);
+ var escapeSequence = "\\u" + codeUnit.toRadixString(16).padLeft(4, "0");
+ result.addAll(escapeSequence.codeUnits);
+ } else
+ result.add(codeUnit);
}
if (wasTruncated) {
result.addAll("...".codeUnits);
@@ -200,8 +209,8 @@ class Task {
return;
}
_timer = new Timer(Duration.ZERO, () {
- _timer = null;
- callback();
+ _timer = null;
+ callback();
});
}
}
« no previous file with comments | « runtime/observatory/lib/tracer.dart ('k') | runtime/observatory/tool/ensure_dartfmt.sh » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698