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

Unified Diff: corelib/src/implementation/stopwatch_implementation.dart

Issue 10831327: Update stopwatch to use patching to share sources instead of exposing (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 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 | « no previous file | lib/compiler/implementation/lib/clock.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: corelib/src/implementation/stopwatch_implementation.dart
diff --git a/corelib/src/implementation/stopwatch_implementation.dart b/corelib/src/implementation/stopwatch_implementation.dart
index 1316a27fd9573d051e20c49993e779ba244b898c..9679296d65d59a6fb6ed4f1a33d67c51401ac47e 100644
--- a/corelib/src/implementation/stopwatch_implementation.dart
+++ b/corelib/src/implementation/stopwatch_implementation.dart
@@ -1,4 +1,4 @@
-// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file
+// Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
@@ -22,14 +22,14 @@ class StopwatchImplementation implements Stopwatch {
void start() {
if (_start === null) {
// This stopwatch has never been started.
- _start = Clock.now();
+ _start = _now();
} else {
if (_stop === null) {
return;
}
// Restarting this stopwatch. Prepend the elapsed time to the current
// start time.
- _start = Clock.now() - (_stop - _start);
+ _start = _now() - (_stop - _start);
_stop = null;
}
}
@@ -38,14 +38,14 @@ class StopwatchImplementation implements Stopwatch {
if (_start === null || _stop !== null) {
return;
}
- _stop = Clock.now();
+ _stop = _now();
}
void reset() {
if (_start === null) return;
// If [_start] is not null, then the stopwatch had already been started. It
// may running right now.
- _start = Clock.now();
+ _start = _now();
if (_stop !== null) {
// The watch is not running. So simply set the [_stop] to [_start] thus
// having an elapsed time of 0.
@@ -57,7 +57,7 @@ class StopwatchImplementation implements Stopwatch {
if (_start === null) {
return 0;
}
- return (_stop === null) ? (Clock.now() - _start) : (_stop - _start);
+ return (_stop === null) ? (_now() - _start) : (_stop - _start);
}
int elapsedInUs() {
@@ -68,8 +68,8 @@ class StopwatchImplementation implements Stopwatch {
return (elapsed() * 1000) ~/ frequency();
}
- int frequency() {
- return Clock.frequency();
- }
+ int frequency() => _frequency();
+ external static int _frequency();
+ external static int _now();
}
« no previous file with comments | « no previous file | lib/compiler/implementation/lib/clock.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698