| 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 /** | 5 /** |
| 6 * *Warning*: this library is **internal**, and APIs are subject to change. | 6 * *Warning*: this library is **internal**, and APIs are subject to change. |
| 7 * | 7 * |
| 8 * Tracks observable objects for dirty checking and testing purposes. | 8 * Tracks observable objects for dirty checking and testing purposes. |
| 9 * | 9 * |
| 10 * It can collect all observed objects, which can be used to trigger predictable | 10 * It can collect all observed objects, which can be used to trigger predictable |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 void registerObservable(Observable obj) { | 28 void registerObservable(Observable obj) { |
| 29 if (_allObservables == null) _allObservables = <Observable>[]; | 29 if (_allObservables == null) _allObservables = <Observable>[]; |
| 30 _allObservables.add(obj); | 30 _allObservables.add(obj); |
| 31 _allObservablesCount++; | 31 _allObservablesCount++; |
| 32 } | 32 } |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Synchronously deliver all change records for known observables. | 35 * Synchronously deliver all change records for known observables. |
| 36 * | 36 * |
| 37 * This will execute [Observable.deliverChanges] on objects that inherit from | 37 * This will execute [Observable.deliverChanges] on objects that inherit from |
| 38 * [ObservableMixin]. | 38 * [Observable]. |
| 39 */ | 39 */ |
| 40 // Note: this is called performMicrotaskCheckpoint in change_summary.js. | 40 // Note: this is called performMicrotaskCheckpoint in change_summary.js. |
| 41 void dirtyCheckObservables() { | 41 void dirtyCheckObservables() { |
| 42 if (_delivering) return; | 42 if (_delivering) return; |
| 43 if (_allObservables == null) return; | 43 if (_allObservables == null) return; |
| 44 | 44 |
| 45 _delivering = true; | 45 _delivering = true; |
| 46 | 46 |
| 47 int cycles = 0; | 47 int cycles = 0; |
| 48 bool anyChanged = false; | 48 bool anyChanged = false; |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 } | 83 } |
| 84 | 84 |
| 85 const MAX_DIRTY_CHECK_CYCLES = 1000; | 85 const MAX_DIRTY_CHECK_CYCLES = 1000; |
| 86 | 86 |
| 87 | 87 |
| 88 /** | 88 /** |
| 89 * Log for messages produced at runtime by this library. Logging can be | 89 * Log for messages produced at runtime by this library. Logging can be |
| 90 * configured by accessing Logger.root from the logging library. | 90 * configured by accessing Logger.root from the logging library. |
| 91 */ | 91 */ |
| 92 final Logger _logger = new Logger('Observable.dirtyCheck'); | 92 final Logger _logger = new Logger('Observable.dirtyCheck'); |
| OLD | NEW |