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

Unified Diff: sky/framework/fn.dart

Issue 983973005: Add an assert that we don't schedule a render during render (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Don't die in production Created 5 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/framework/fn.dart
diff --git a/sky/framework/fn.dart b/sky/framework/fn.dart
index c481aee5fb8ef9bcae67b177ac4374d75bfcc939..e3d39eb1f2b9f30b363df9ac89feb593c2532540 100644
--- a/sky/framework/fn.dart
+++ b/sky/framework/fn.dart
@@ -503,24 +503,34 @@ class Anchor extends Element {
List<Component> _dirtyComponents = new List<Component>();
bool _renderScheduled = false;
+bool _inRenderDirtyComponents = false;
void _renderDirtyComponents() {
- Stopwatch sw = new Stopwatch()..start();
+ try {
+ _inRenderDirtyComponents = true;
+ Stopwatch sw = new Stopwatch()..start();
- _dirtyComponents.sort((a, b) => a._order - b._order);
- for (var comp in _dirtyComponents) {
- comp._renderIfDirty();
- }
+ _dirtyComponents.sort((a, b) => a._order - b._order);
+ for (var comp in _dirtyComponents) {
+ comp._renderIfDirty();
+ }
- _dirtyComponents.clear();
- _renderScheduled = false;
+ _dirtyComponents.clear();
+ _renderScheduled = false;
- sw.stop();
- if (_shouldLogRenderDuration)
- print("Render took ${sw.elapsedMicroseconds} microseconds");
+ sw.stop();
+ if (_shouldLogRenderDuration)
+ print("Render took ${sw.elapsedMicroseconds} microseconds");
+ } finally {
+ _inRenderDirtyComponents = false;
+ }
}
void _scheduleComponentForRender(Component c) {
+ assert(!_inRenderDirtyComponents);
+ if (_inRenderDirtyComponents)
+ return;
+
_dirtyComponents.add(c);
if (!_renderScheduled) {
« 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