Index: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
diff --git a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
index 279ee270849d8dd3f34dc94de87ee8f05a6af0d6..52d2f67198d0cfcede2005bf2f66f1deb950975d 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
@@ -535,6 +535,16 @@ class Primitives { |
static num dateNow() => JS('num', r'Date.now()'); |
+ static num numMicroseconds() { |
+ var performance = JS('var', 'window.performance'); |
ngeoffray
2012/11/21 08:32:53
Shouldn't you check that window is defined too?
|
+ if (performance != null && |
+ JS('bool', 'typeof #.webkitNow == "function"', performance)) { |
+ return JS('num', '#.webkitNow()', performance); |
+ } else { |
+ return 1000 * dateNow(); |
+ } |
+ } |
+ |
static String stringFromCharCodes(charCodes) { |
for (var i in charCodes) { |
if (i is !int) throw new ArgumentError(i); |