提交 e2a00dd4 编写于 作者: E Eric Seidel

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
上级 b161df2f
......@@ -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) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册