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..9f657752846616e032cd0f3119dff0987688df1a 100644 |
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart |
@@ -535,6 +535,18 @@ class Primitives { |
static num dateNow() => JS('num', r'Date.now()'); |
+ static num numMicroseconds() { |
+ var theWindow = JS('var', 'window'); |
Lasse Reichstein Nielsen
2012/11/22 11:26:48
This read will throw if 'window' is not there.
Con
ahe
2012/11/22 12:54:46
You don't have to call the variable theWindow. We
|
+ if (theWindow != null) { |
+ var performance = JS('var', 'window.performance'); |
+ if (performance != null && |
+ JS('bool', 'typeof #.webkitNow == "function"', performance)) { |
+ return JS('num', '#.webkitNow()', performance); |
+ } |
+ } |
+ return 1000 * dateNow(); |
+ } |
+ |
static String stringFromCharCodes(charCodes) { |
for (var i in charCodes) { |
if (i is !int) throw new ArgumentError(i); |