| OLD | NEW |
| 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, 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:async'; | 5 import 'dart:async'; |
| 6 | 6 |
| 7 import 'package:observatory/src/elements/helpers/rendering_queue.dart'; | 7 import 'package:observatory/src/elements/helpers/rendering_queue.dart'; |
| 8 export 'package:observatory/src/elements/helpers/rendering_queue.dart'; | 8 export 'package:observatory/src/elements/helpers/rendering_queue.dart'; |
| 9 | 9 |
| 10 /// A generic renderable object. | 10 /// A generic renderable object. |
| 11 abstract class Renderable { | 11 abstract class Renderable { |
| 12 void render(); | 12 void render(); |
| 13 } | 13 } |
| 14 | 14 |
| 15 /// Event related to a Renderable rendering phase. | 15 /// Event related to a Renderable rendering phase. |
| 16 class RenderedEvent<T extends Renderable> { | 16 class RenderedEvent<T> { |
| 17 /// Renderable to which the event is related | 17 /// Renderable to which the event is related |
| 18 final T element; | 18 final T element; |
| 19 /// Is another rendering scheduled for this element. | 19 /// Is another rendering scheduled for this element. |
| 20 final bool otherRenderScheduled; | 20 final bool otherRenderScheduled; |
| 21 | 21 |
| 22 RenderedEvent(this.element, this.otherRenderScheduled) { | 22 RenderedEvent(this.element, this.otherRenderScheduled) { |
| 23 assert(element != null); | 23 assert(element != null); |
| 24 assert(otherRenderScheduled != null); | 24 assert(otherRenderScheduled != null); |
| 25 } | 25 } |
| 26 } | 26 } |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 if (_notificationScheduled) return; | 112 if (_notificationScheduled) return; |
| 113 _notify(); | 113 _notify(); |
| 114 _notificationScheduled = true; | 114 _notificationScheduled = true; |
| 115 } | 115 } |
| 116 | 116 |
| 117 Future _notify() async { | 117 Future _notify() async { |
| 118 _onRendered.add(new RenderedEvent<T>(element, _dirty)); | 118 _onRendered.add(new RenderedEvent<T>(element, _dirty)); |
| 119 _notificationScheduled = false; | 119 _notificationScheduled = false; |
| 120 } | 120 } |
| 121 } | 121 } |
| OLD | NEW |