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

Unified Diff: sdk/lib/_internal/compiler/implementation/lib/js_helper.dart

Issue 11417110: Let stopwatch use window.performance.now when available. Fix for: http://code.google.com/p/dart/iss… (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: address lasse and peter's comments Created 8 years, 1 month 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 | « sdk/lib/_internal/compiler/implementation/lib/core_patch.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 161ebf1e5b89006302e41c8adcff9c1744840a3d..ad8d98c36270294e1cba181592e2c88446c1bcc2 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/js_helper.dart
@@ -535,6 +535,17 @@ class Primitives {
static num dateNow() => JS('num', r'Date.now()');
+ static num numMicroseconds() {
+ if (JS('bool', 'typeof window != "undefined" && window !== null')) {
+ var performance = JS('var', 'window.performance');
+ if (performance != null &&
+ JS('bool', 'typeof #.webkitNow == "function"', performance)) {
+ return JS('num', '#.webkitNow()', performance);
+ }
+ }
+ return 1000 * dateNow();
+ }
+
// This is to avoid stack overflows due to very large argument arrays in
// apply(). It fixes http://dartbug.com/6919
static String _fromCharCodeApply(List<int> array) {
« no previous file with comments | « sdk/lib/_internal/compiler/implementation/lib/core_patch.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698