| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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.io; | 5 part of dart.io; |
| 6 | 6 |
| 7 class _Timer extends LinkedListEntry<_Timer> implements Timer { | 7 class _Timer extends LinkedListEntry<_Timer> implements Timer { |
| 8 // Disables the timer. | 8 // Disables the timer. |
| 9 static const int _NO_TIMER = -1; | 9 static const int _NO_TIMER = -1; |
| 10 | 10 |
| (...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 157 } | 157 } |
| 158 } | 158 } |
| 159 } finally { | 159 } finally { |
| 160 _handling_callbacks = false; | 160 _handling_callbacks = false; |
| 161 _notifyEventHandler(); | 161 _notifyEventHandler(); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 if(_receivePort == null) { | 165 if(_receivePort == null) { |
| 166 _receivePort = new ReceivePort(); | 166 _receivePort = new ReceivePort(); |
| 167 _receivePort.receive((var message, ignored) { | 167 _receivePort.listen((var message) { |
| 168 _handleTimeout(); | 168 _handleTimeout(); |
| 169 }); | 169 }); |
| 170 } | 170 } |
| 171 } | 171 } |
| 172 | 172 |
| 173 void _shutdownTimerHandler() { | 173 void _shutdownTimerHandler() { |
| 174 _receivePort.close(); | 174 _receivePort.close(); |
| 175 _receivePort = null; | 175 _receivePort = null; |
| 176 } | 176 } |
| 177 } | 177 } |
| 178 | 178 |
| 179 // Provide a closure which will allocate a Timer object to be able to hook | 179 // Provide a closure which will allocate a Timer object to be able to hook |
| 180 // up the Timer interface in dart:isolate with the implementation here. | 180 // up the Timer interface in dart:isolate with the implementation here. |
| 181 _getTimerFactoryClosure() { | 181 _getTimerFactoryClosure() { |
| 182 return (int milliSeconds, void callback(Timer timer), bool repeating) { | 182 return (int milliSeconds, void callback(Timer timer), bool repeating) { |
| 183 if (repeating) { | 183 if (repeating) { |
| 184 return new _Timer.periodic(milliSeconds, callback); | 184 return new _Timer.periodic(milliSeconds, callback); |
| 185 } | 185 } |
| 186 return new _Timer(milliSeconds, callback); | 186 return new _Timer(milliSeconds, callback); |
| 187 }; | 187 }; |
| 188 } | 188 } |
| 189 | 189 |
| 190 | 190 |
| OLD | NEW |