| OLD | NEW |
| 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 part of dart.async; | 5 part of dart.async; |
| 6 | 6 |
| 7 abstract class Timer { | 7 abstract class Timer { |
| 8 // Internal list used to group Timer.run callbacks. | 8 // Internal list used to group Timer.run callbacks. |
| 9 static List _runCallbacks = []; | 9 static List _runCallbacks = []; |
| 10 | 10 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 _runCallbacks = []; | 54 _runCallbacks = []; |
| 55 for (int i = 0; i < runCallbacks.length; i++) { | 55 for (int i = 0; i < runCallbacks.length; i++) { |
| 56 Function callback = runCallbacks[i]; | 56 Function callback = runCallbacks[i]; |
| 57 try { | 57 try { |
| 58 callback(); | 58 callback(); |
| 59 } catch (e) { | 59 } catch (e) { |
| 60 List newCallbacks = _runCallbacks; | 60 List newCallbacks = _runCallbacks; |
| 61 _runCallbacks = []; | 61 _runCallbacks = []; |
| 62 i++; // Skip the current; | 62 i++; // Skip the current; |
| 63 _runCallbacks.addAll( | 63 _runCallbacks.addAll( |
| 64 runCallbacks.getRange(i, runCallbacks.length - i)); | 64 runCallbacks.sublist(i)); |
| 65 _runCallbacks.addAll(newCallbacks); | 65 _runCallbacks.addAll(newCallbacks); |
| 66 throw; | 66 throw; |
| 67 } | 67 } |
| 68 } | 68 } |
| 69 }); | 69 }); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 /** | 73 /** |
| 74 * Cancels the timer. | 74 * Cancels the timer. |
| 75 */ | 75 */ |
| 76 void cancel(); | 76 void cancel(); |
| 77 } | 77 } |
| OLD | NEW |