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

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

Issue 11316181: Use Window.performance.now if available, with correct frequency value (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: fix 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..0557c8a4855bdc4f8361ae928a847381ec2a3d2f 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 (1000 * JS('num', '#.webkitNow()', performance)).floor();
Emily Fortuna 2012/11/26 23:31:31 This is the line that's different. The key thing I
+ }
+ }
+ 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