mirror of
https://github.com/flutter/flutter.git
synced 2026-02-20 02:29:02 +08:00
Add an assert that we don't schedule a render during render
In production I added an early return. I don't bother to log in production since no one is looking at the log anyway. Unfortunately this currently only fires when using a debug build we should fix our Release build to have a checked-mode option or consider hacks like having all localhost urls enable checked mode, etc. R=ianh@google.com, rafaelw@chromium.org BUG= Review URL: https://codereview.chromium.org/983973005
This commit is contained in:
parent
b161df2fe4
commit
e2a00dd49d
@ -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;
|
||||
|
||||
sw.stop();
|
||||
if (_shouldLogRenderDuration)
|
||||
print("Render took ${sw.elapsedMicroseconds} microseconds");
|
||||
} finally {
|
||||
_inRenderDirtyComponents = false;
|
||||
}
|
||||
|
||||
_dirtyComponents.clear();
|
||||
_renderScheduled = false;
|
||||
|
||||
sw.stop();
|
||||
if (_shouldLogRenderDuration)
|
||||
print("Render took ${sw.elapsedMicroseconds} microseconds");
|
||||
}
|
||||
|
||||
void _scheduleComponentForRender(Component c) {
|
||||
assert(!_inRenderDirtyComponents);
|
||||
if (_inRenderDirtyComponents)
|
||||
return;
|
||||
|
||||
_dirtyComponents.add(c);
|
||||
|
||||
if (!_renderScheduled) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user