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

Unified Diff: runtime/lib/timer_patch.dart

Issue 15764003: Add Zone support for Timers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Reupload Created 7 years, 6 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/event_loop_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/enqueue.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/lib/timer_patch.dart
diff --git a/runtime/lib/timer_patch.dart b/runtime/lib/timer_patch.dart
index 2db2343720a1e6ad6e14c7f6b9ea351075bbd68d..87026b10c22bbb57143eadc2ed9ea8771c5de7c9 100644
--- a/runtime/lib/timer_patch.dart
+++ b/runtime/lib/timer_patch.dart
@@ -2,27 +2,26 @@
// 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.
-patch class Timer {
- /* patch */ factory Timer(Duration duration, void callback()) {
- if (_TimerFactory._factory == null) {
- throw new UnsupportedError("Timer interface not supported.");
- }
- int milliseconds = duration.inMilliseconds;
- if (milliseconds < 0) milliseconds = 0;
- return _TimerFactory._factory(milliseconds, (_) { callback(); }, false);
+patch Timer _createTimer(Duration duration, void callback()) {
+ if (_TimerFactory._factory == null) {
+ throw new UnsupportedError("Timer interface not supported.");
}
+ int milliseconds = duration.inMilliseconds;
+ if (milliseconds < 0) milliseconds = 0;
+ return _TimerFactory._factory(milliseconds, (_) { callback(); }, false);
+}
- /* patch */ factory Timer.periodic(Duration duration,
- void callback(Timer timer)) {
- if (_TimerFactory._factory == null) {
- throw new UnsupportedError("Timer interface not supported.");
- }
- int milliseconds = duration.inMilliseconds;
- if (milliseconds < 0) milliseconds = 0;
- return _TimerFactory._factory(milliseconds, callback, true);
+patch Timer _createPeriodicTimer(Duration duration,
+ void callback(Timer timer)) {
+ if (_TimerFactory._factory == null) {
+ throw new UnsupportedError("Timer interface not supported.");
}
+ int milliseconds = duration.inMilliseconds;
+ if (milliseconds < 0) milliseconds = 0;
+ return _TimerFactory._factory(milliseconds, callback, true);
}
+
typedef Timer _TimerFactoryClosure(int milliseconds,
void callback(Timer timer),
bool repeating);
« no previous file with comments | « runtime/lib/event_loop_patch.dart ('k') | sdk/lib/_internal/compiler/implementation/enqueue.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698