Commit 46792dc2 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

Speed up hot reload in the framework. (#7647)

parent 25223c75
...@@ -1606,7 +1606,6 @@ class BuildOwner { ...@@ -1606,7 +1606,6 @@ class BuildOwner {
void scheduleBuildFor(BuildableElement element) { void scheduleBuildFor(BuildableElement element) {
assert(element != null); assert(element != null);
assert(element.owner == this); assert(element.owner == this);
assert(element._inDirtyList == _dirtyElements.contains(element));
assert(() { assert(() {
if (debugPrintScheduleBuildForStacks) if (debugPrintScheduleBuildForStacks)
debugPrintStack(label: 'scheduleBuildFor() called for $element${_dirtyElements.contains(element) ? " (ALREADY IN LIST)" : ""}'); debugPrintStack(label: 'scheduleBuildFor() called for $element${_dirtyElements.contains(element) ? " (ALREADY IN LIST)" : ""}');
...@@ -1944,18 +1943,18 @@ abstract class Element implements BuildContext { ...@@ -1944,18 +1943,18 @@ abstract class Element implements BuildContext {
bool _active = false; bool _active = false;
void _reassemble() { void _reassemble() {
assert(_active);
visitChildren((Element child) { visitChildren((Element child) {
child._reassemble(); child._reassemble();
}); });
} }
bool _debugIsInScope(Element target) { bool _debugIsInScope(Element target) {
assert(target != null); Element current = this;
if (target == this) while (current != null) {
return true; if (target == current)
if (_parent != null) return true;
return _parent._debugIsInScope(target); current = current._parent;
}
return false; return false;
} }
...@@ -2099,13 +2098,15 @@ abstract class Element implements BuildContext { ...@@ -2099,13 +2098,15 @@ abstract class Element implements BuildContext {
/// This function is called only during the "active" lifecycle state. /// This function is called only during the "active" lifecycle state.
@mustCallSuper @mustCallSuper
void update(@checked Widget newWidget) { void update(@checked Widget newWidget) {
assert(_debugLifecycleState == _ElementLifecycle.active); // This code is hot when hot reloading, so we try to
assert(widget != null); // only call _AssertionError._evaluateAssertion once.
assert(newWidget != null); assert(_debugLifecycleState == _ElementLifecycle.active
assert(newWidget != widget); && widget != null
assert(depth != null); && newWidget != null
assert(_active); && newWidget != widget
assert(Widget.canUpdate(widget, newWidget)); && depth != null
&& _active
&& Widget.canUpdate(widget, newWidget));
_widget = newWidget; _widget = newWidget;
} }
...@@ -2795,7 +2796,6 @@ abstract class BuildableElement extends Element { ...@@ -2795,7 +2796,6 @@ abstract class BuildableElement extends Element {
@override @override
void _reassemble() { void _reassemble() {
assert(_active); // otherwise markNeedsBuild is a no-op
markNeedsBuild(); markNeedsBuild();
super._reassemble(); super._reassemble();
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment