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

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

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 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
Index: sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
diff --git a/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart b/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
index 82a80fec9d727c178893b6a9ab69fc0a9eaffbdb..54bbdc140c44b724ca5e6aee8cf8bdd7c229f86d 100644
--- a/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
+++ b/sdk/lib/_internal/compiler/implementation/lib/isolate_helper.dart
@@ -313,7 +313,7 @@ class _EventLoop {
// Run each iteration from the browser's top event loop.
void next() {
if (!runIteration()) return;
- new Timer(0, (_) => next());
+ Timer.run(next);
}
next();
} else {
@@ -1264,7 +1264,7 @@ class TimerImpl implements Timer {
bool _inEventLoop = false;
int _handle;
- TimerImpl(int milliseconds, void callback(Timer timer))
+ TimerImpl(int milliseconds, void callback())
: _once = true {
if (milliseconds == 0 && (!hasTimer() || _globalState.isWorker)) {
// This makes a dependency between the async library and the
@@ -1273,14 +1273,13 @@ class TimerImpl implements Timer {
// TODO(7907): In case of web workers, we need to use the event
// loop instead of setTimeout, to make sure the futures get executed in
// order.
- _globalState.topEventLoop.enqueue(_globalState.currentContext, () {
- callback(this);
- }, 'timer');
+ _globalState.topEventLoop.enqueue(
+ _globalState.currentContext, callback, 'timer');
_inEventLoop = true;
} else if (hasTimer()) {
_globalState.topEventLoop.activeTimerCount++;
void internalCallback() {
- callback(this);
+ callback();
_handle = null;
_globalState.topEventLoop.activeTimerCount--;
}

Powered by Google App Engine
This is Rietveld 408576698