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

Unified Diff: sdk/lib/_internal/js_runtime/lib/isolate_helper.dart

Issue 3011503002: Revert "Add ticks counter to Timer." (Closed)
Patch Set: Created 3 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 | « runtime/lib/timer_impl.dart ('k') | sdk/lib/_internal/js_runtime/lib/preambles/d8.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
diff --git a/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart b/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
index 856a442bfec9452bd8d9e59b4028fd6d7adf0638..c12a746848bbc09d5bb255ba60978763ce08824d 100644
--- a/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/js_runtime/lib/isolate_helper.dart
@@ -1366,7 +1366,6 @@ class TimerImpl implements Timer {
final bool _once;
bool _inEventLoop = false;
int _handle;
- int _tick = 0;
TimerImpl(int milliseconds, void callback()) : _once = true {
if (milliseconds == 0 && (!hasTimer() || _globalState.isWorker)) {
@@ -1392,7 +1391,6 @@ class TimerImpl implements Timer {
void internalCallback() {
_handle = null;
leaveJsAsync();
- this._tick = 1;
callback();
}
@@ -1410,19 +1408,10 @@ class TimerImpl implements Timer {
: _once = false {
if (hasTimer()) {
enterJsAsync();
- int start = JS('int', 'Date.now()');
_handle = JS(
'int',
'self.setInterval(#, #)',
convertDartClosureToJS(() {
- int tick = this._tick + 1;
- if (milliseconds > 0) {
- int duration = JS('int', 'Date.now()') - start;
- if (duration > (tick + 1) * milliseconds) {
- tick = duration ~/ milliseconds;
- }
- }
- this._tick = tick;
callback(this);
}, 0),
milliseconds);
@@ -1431,8 +1420,6 @@ class TimerImpl implements Timer {
}
}
- int get tick => _tick;
-
void cancel() {
if (hasTimer()) {
if (_inEventLoop) {
« no previous file with comments | « runtime/lib/timer_impl.dart ('k') | sdk/lib/_internal/js_runtime/lib/preambles/d8.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698