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 import 'dart:_internal' hide Symbol; |
| 6 |
5 // Timer heap implemented as a array-based binary heap[0]. | 7 // Timer heap implemented as a array-based binary heap[0]. |
6 // 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)) |
7 // `add`. | 9 // `add`. |
8 // | 10 // |
9 // To ensure the timers are ordered by insertion time, the _Timer class has a | 11 // To ensure the timers are ordered by insertion time, the _Timer class has a |
10 // `_id` field set when added to the heap. | 12 // `_id` field set when added to the heap. |
11 // | 13 // |
12 // [0] http://en.wikipedia.org/wiki/Binary_heap | 14 // [0] http://en.wikipedia.org/wiki/Binary_heap |
13 class _TimerHeap { | 15 class _TimerHeap { |
14 List<_Timer> _list; | 16 List<_Timer> _list; |
(...skipping 448 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
463 return new _Timer.periodic(milliSeconds, callback); | 465 return new _Timer.periodic(milliSeconds, callback); |
464 } | 466 } |
465 return new _Timer(milliSeconds, callback); | 467 return new _Timer(milliSeconds, callback); |
466 } | 468 } |
467 } | 469 } |
468 | 470 |
469 | 471 |
470 _setupHooks() { | 472 _setupHooks() { |
471 VMLibraryHooks.timerFactory = _Timer._factory; | 473 VMLibraryHooks.timerFactory = _Timer._factory; |
472 } | 474 } |
OLD | NEW |