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

Unified Diff: dart/lib/isolate/timer.dart

Issue 11116009: Restore _TimerFactory class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 2 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/lib/isolate/timer.dart
diff --git a/dart/lib/isolate/timer.dart b/dart/lib/isolate/timer.dart
index a90c2d000aacb2265752f44bd54354e8ce848316..6449d0be4092707dc75e71f21c1ab5c032486cf7 100644
--- a/dart/lib/isolate/timer.dart
+++ b/dart/lib/isolate/timer.dart
@@ -8,10 +8,10 @@ abstract class Timer {
* [milliSeconds] milliseconds.
*/
factory Timer(int milliSeconds, void callback(Timer timer)) {
- if (_factory == null) {
+ if (_TimerFactory._factory == null) {
throw new UnsupportedOperationException("Timer interface not supported.");
}
- return _factory(milliSeconds, callback, false);
+ return _TimerFactory._factory(milliSeconds, callback, false);
}
/**
@@ -19,18 +19,16 @@ abstract class Timer {
* [milliSeconds] millisecond until cancelled.
*/
factory Timer.repeating(int milliSeconds, void callback(Timer timer)) {
- if (_factory == null) {
+ if (_TimerFactory._factory == null) {
throw new UnsupportedOperationException("Timer interface not supported.");
}
- return _factory(milliSeconds, callback, true);
+ return _TimerFactory._factory(milliSeconds, callback, true);
}
/**
* Cancels the timer.
*/
void cancel();
-
- static _TimerFactoryClosure _factory;
}
// TODO(ajohnsen): Patch timer once we have support for patching named
@@ -40,6 +38,10 @@ typedef Timer _TimerFactoryClosure(int milliSeconds,
void callback(Timer timer),
bool repeating);
+class _TimerFactory {
+ static _TimerFactoryClosure _factory;
+}
+
void _setTimerFactoryClosure(_TimerFactoryClosure closure) {
- Timer._factory = closure;
+ _TimerFactory._factory = closure;
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698