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 // Timer heap implemented as a array-based binary heap[0]. | 7 // Timer heap implemented as a array-based binary heap[0]. |
8 // This allows for O(1) `first`, O(log(n)) `remove`/`removeFirst` and O(log(n)) | 8 // This allows for O(1) `first`, O(log(n)) `remove`/`removeFirst` and O(log(n)) |
9 // `add`. | 9 // `add`. |
10 // | 10 // |
(...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 // The Timer factory registered with the dart:async library by the embedder. | 404 // The Timer factory registered with the dart:async library by the embedder. |
405 static Timer _factory(int milliSeconds, | 405 static Timer _factory(int milliSeconds, |
406 void callback(Timer timer), | 406 void callback(Timer timer), |
407 bool repeating) { | 407 bool repeating) { |
408 if (repeating) { | 408 if (repeating) { |
409 return new _Timer.periodic(milliSeconds, callback); | 409 return new _Timer.periodic(milliSeconds, callback); |
410 } | 410 } |
411 return new _Timer(milliSeconds, callback); | 411 return new _Timer(milliSeconds, callback); |
412 } | 412 } |
413 } | 413 } |
414 | |
415 // Provide a closure which will allocate a Timer object to be able to hook | |
416 // up the Timer interface in dart:isolate with the implementation here. | |
417 _getTimerFactoryClosure() { | |
418 runTimerClosure = _Timer._handleTimeout; | |
419 return _Timer._factory; | |
420 } | |
OLD | NEW |