Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: runtime/observatory/lib/src/elements/helpers/rendering_scheduler.dart

Issue 3002763002: Remove dynamic parameters from Observatory helpers (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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.
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 /// Set the object as dirty. A rendering will be scheduled. 84 /// Set the object as dirty. A rendering will be scheduled.
85 void dirty() { 85 void dirty() {
86 if (_dirty) return; 86 if (_dirty) return;
87 _dirty = true; 87 _dirty = true;
88 scheduleRendering(); 88 scheduleRendering();
89 } 89 }
90 90
91 /// Checks for modification during attribute set. 91 /// Checks for modification during attribute set.
92 /// If value changes a new rendering is scheduled. 92 /// If value changes a new rendering is scheduled.
93 /// set attr(T v) => _attr = _r.checkAndReact(_attr, v); 93 /// set attr(T v) => _attr = _r.checkAndReact(_attr, v);
94 dynamic checkAndReact(dynamic oldValue, dynamic newValue) { 94 T checkAndReact<T>(T oldValue, T newValue) {
95 if (oldValue != newValue) 95 if (oldValue != newValue)
96 dirty(); 96 dirty();
97 else 97 else
98 scheduleNotification(); 98 scheduleNotification();
99 return newValue; 99 return newValue;
100 } 100 }
101 101
102 /// Schedules a new rendering phase. 102 /// Schedules a new rendering phase.
103 void scheduleRendering() { 103 void scheduleRendering() {
104 if (_renderingScheduled) return; 104 if (_renderingScheduled) return;
(...skipping 25 matching lines...) Expand all
130 _wait.addAll(it); 130 _wait.addAll(it);
131 } 131 }
132 132
133 Future _notify() async { 133 Future _notify() async {
134 await Future.wait(_wait); 134 await Future.wait(_wait);
135 _wait.clear(); 135 _wait.clear();
136 _onRendered.add(new RenderedEvent<T>(element, _dirty)); 136 _onRendered.add(new RenderedEvent<T>(element, _dirty));
137 _notificationScheduled = false; 137 _notificationScheduled = false;
138 } 138 }
139 } 139 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698