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

Side by Side Diff: lib/isolate/timer.dart

Issue 11235054: Removed IllegalAccessException and UnsupportedOperationException. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: ADded test expectations. Created 8 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 abstract class Timer { 5 abstract class Timer {
6 /** 6 /**
7 * Creates a new timer. The [callback] callback is invoked after 7 * Creates a new timer. The [callback] callback is invoked after
8 * [milliSeconds] milliseconds. 8 * [milliSeconds] milliseconds.
9 */ 9 */
10 factory Timer(int milliSeconds, void callback(Timer timer)) { 10 factory Timer(int milliSeconds, void callback(Timer timer)) {
11 if (_TimerFactory._factory == null) { 11 if (_TimerFactory._factory == null) {
12 throw new UnsupportedOperationException("Timer interface not supported."); 12 throw new UnsupportedError("Timer interface not supported.");
13 } 13 }
14 return _TimerFactory._factory(milliSeconds, callback, false); 14 return _TimerFactory._factory(milliSeconds, callback, false);
15 } 15 }
16 16
17 /** 17 /**
18 * Creates a new repeating timer. The [callback] is invoked every 18 * Creates a new repeating timer. The [callback] is invoked every
19 * [milliSeconds] millisecond until cancelled. 19 * [milliSeconds] millisecond until cancelled.
20 */ 20 */
21 factory Timer.repeating(int milliSeconds, void callback(Timer timer)) { 21 factory Timer.repeating(int milliSeconds, void callback(Timer timer)) {
22 if (_TimerFactory._factory == null) { 22 if (_TimerFactory._factory == null) {
23 throw new UnsupportedOperationException("Timer interface not supported."); 23 throw new UnsupportedError("Timer interface not supported.");
24 } 24 }
25 return _TimerFactory._factory(milliSeconds, callback, true); 25 return _TimerFactory._factory(milliSeconds, callback, true);
26 } 26 }
27 27
28 /** 28 /**
29 * Cancels the timer. 29 * Cancels the timer.
30 */ 30 */
31 void cancel(); 31 void cancel();
32 } 32 }
33 33
34 // TODO(ajohnsen): Patch timer once we have support for patching named 34 // TODO(ajohnsen): Patch timer once we have support for patching named
35 // factory constructors in the VM. 35 // factory constructors in the VM.
36 36
37 typedef Timer _TimerFactoryClosure(int milliSeconds, 37 typedef Timer _TimerFactoryClosure(int milliSeconds,
38 void callback(Timer timer), 38 void callback(Timer timer),
39 bool repeating); 39 bool repeating);
40 40
41 class _TimerFactory { 41 class _TimerFactory {
42 static _TimerFactoryClosure _factory; 42 static _TimerFactoryClosure _factory;
43 } 43 }
44 44
45 // TODO(ahe): Warning: this is NOT called by Dartium. Instead, it sets 45 // TODO(ahe): Warning: this is NOT called by Dartium. Instead, it sets
46 // [_TimerFactory._factory] directly. 46 // [_TimerFactory._factory] directly.
47 void _setTimerFactoryClosure(_TimerFactoryClosure closure) { 47 void _setTimerFactoryClosure(_TimerFactoryClosure closure) {
48 _TimerFactory._factory = closure; 48 _TimerFactory._factory = closure;
49 } 49 }
OLDNEW
« no previous file with comments | « lib/html/templates/immutable_list_mixin.darttemplate ('k') | pkg/dartdoc/lib/src/mirrors/dart2js_mirror.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698