Commit 0b392665 authored by Ian Hickson's avatar Ian Hickson Committed by GitHub

More debug help. (#11308)

parent 05ccad7d
...@@ -95,9 +95,6 @@ HSVColor debugCurrentRepaintColor = _kDebugCurrentRepaintColor; ...@@ -95,9 +95,6 @@ HSVColor debugCurrentRepaintColor = _kDebugCurrentRepaintColor;
/// The amount to increment the hue of the current repaint color. /// The amount to increment the hue of the current repaint color.
double debugRepaintRainbowHueIncrement = _kDebugRepaintRainbowHueIncrement; double debugRepaintRainbowHueIncrement = _kDebugRepaintRainbowHueIncrement;
/// Log the call stacks that mark render objects as needing paint.
bool debugPrintMarkNeedsPaintStacks = false;
/// Log the call stacks that mark render objects as needing layout. /// Log the call stacks that mark render objects as needing layout.
/// ///
/// For sanity, this only logs the stack traces of cases where an object is /// For sanity, this only logs the stack traces of cases where an object is
...@@ -106,6 +103,29 @@ bool debugPrintMarkNeedsPaintStacks = false; ...@@ -106,6 +103,29 @@ bool debugPrintMarkNeedsPaintStacks = false;
/// up the tree. /// up the tree.
bool debugPrintMarkNeedsLayoutStacks = false; bool debugPrintMarkNeedsLayoutStacks = false;
/// Log the call stacks that mark render objects as needing paint.
bool debugPrintMarkNeedsPaintStacks = false;
/// Log the dirty render objects that are laid out each frame.
///
/// Combined with [debugPrintBeginFrameBanner], this allows you to distinguish
/// layouts triggered by the initial mounting of a render tree (e.g. in a call
/// to [runApp]) from the regular layouts triggered by the pipeline.
///
/// Combined with [debugPrintMarkNeedsLayoutStacks], this lets you watch a
/// render object's dirty/clean lifecycle.
///
/// See also:
///
/// * [debugProfilePaintsEnabled], which does something similar for
/// painting but using the timeline view.
///
/// * [debugPrintRebuildDirtyWidgets], which does something similar for widgets
/// being rebuilt.
///
/// * The discussion at [RendererBinding.drawFrame].
bool debugPrintLayouts = false;
/// Check the intrinsic sizes of each [RenderBox] during layout. /// Check the intrinsic sizes of each [RenderBox] during layout.
/// ///
/// By default this is turned off since these checks are expensive, but it is /// By default this is turned off since these checks are expensive, but it is
...@@ -121,6 +141,16 @@ bool debugCheckIntrinsicSizes = false; ...@@ -121,6 +141,16 @@ bool debugCheckIntrinsicSizes = false;
/// For details on how to use [dart:developer.Timeline] events in the Dart /// For details on how to use [dart:developer.Timeline] events in the Dart
/// Observatory to optimize your app, see: /// Observatory to optimize your app, see:
/// <https://fuchsia.googlesource.com/sysui/+/master/docs/performance.md> /// <https://fuchsia.googlesource.com/sysui/+/master/docs/performance.md>
///
/// See also:
///
/// * [debugPrintLayouts], which does something similar for layout but using
/// console output.
///
/// * [debugPrintRebuildDirtyWidgets], which does something similar for widgets
/// being rebuilt.
///
/// * The discussion at [RendererBinding.drawFrame].
bool debugProfilePaintsEnabled = false; bool debugProfilePaintsEnabled = false;
...@@ -184,8 +214,9 @@ bool debugAssertAllRenderVarsUnset(String reason, { bool debugCheckIntrinsicSize ...@@ -184,8 +214,9 @@ bool debugAssertAllRenderVarsUnset(String reason, { bool debugCheckIntrinsicSize
debugPaintPointersEnabled || debugPaintPointersEnabled ||
debugRepaintRainbowEnabled || debugRepaintRainbowEnabled ||
debugRepaintTextRainbowEnabled || debugRepaintTextRainbowEnabled ||
debugPrintMarkNeedsPaintStacks ||
debugPrintMarkNeedsLayoutStacks || debugPrintMarkNeedsLayoutStacks ||
debugPrintMarkNeedsPaintStacks ||
debugPrintLayouts ||
debugCheckIntrinsicSizes != debugCheckIntrinsicSizesOverride || debugCheckIntrinsicSizes != debugCheckIntrinsicSizesOverride ||
debugProfilePaintsEnabled || debugProfilePaintsEnabled ||
debugPaintSizeColor != _kDebugPaintSizeColor || debugPaintSizeColor != _kDebugPaintSizeColor ||
......
...@@ -754,6 +754,8 @@ class PhysicalModelLayer extends ContainerLayer { ...@@ -754,6 +754,8 @@ class PhysicalModelLayer extends ContainerLayer {
void debugFillDescription(List<String> description) { void debugFillDescription(List<String> description) {
super.debugFillDescription(description); super.debugFillDescription(description);
description.add('clipRRect: $clipRRect'); description.add('clipRRect: $clipRRect');
description.add('elevation: $elevation');
description.add('color: $color');
} }
} }
......
...@@ -1743,6 +1743,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -1743,6 +1743,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
_debugDoingThisLayout = true; _debugDoingThisLayout = true;
debugPreviousActiveLayout = _debugActiveLayout; debugPreviousActiveLayout = _debugActiveLayout;
_debugActiveLayout = this; _debugActiveLayout = this;
if (debugPrintLayouts)
debugPrint('Laying out (without resize) $this');
return true; return true;
}); });
try { try {
...@@ -1849,6 +1851,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget { ...@@ -1849,6 +1851,8 @@ abstract class RenderObject extends AbstractNode implements HitTestTarget {
assert(!_doingThisLayoutWithCallback); assert(!_doingThisLayoutWithCallback);
assert(() { assert(() {
_debugMutationsLocked = true; _debugMutationsLocked = true;
if (debugPrintLayouts)
debugPrint('Laying out (${sizedByParent ? "with separate resize" : "with resize allowed"}) $this');
return true; return true;
}); });
if (sizedByParent) { if (sizedByParent) {
......
...@@ -21,7 +21,16 @@ import 'package:flutter/foundation.dart'; ...@@ -21,7 +21,16 @@ import 'package:flutter/foundation.dart';
/// intra-frame output from inter-frame output, set [debugPrintEndFrameBanner] /// intra-frame output from inter-frame output, set [debugPrintEndFrameBanner]
/// to true as well. /// to true as well.
/// ///
/// See [SchedulerBinding.handleBeginFrame]. /// See also:
///
/// * [debugProfilePaintsEnabled], which does something similar for
/// painting but using the timeline view.
///
/// * [debugPrintLayouts], which does something similar for layout but using
/// console output.
///
/// * The discussions at [WidgetsBinding.drawFrame] and at
/// [SchedulerBinding.handleBeginFrame].
bool debugPrintBeginFrameBanner = false; bool debugPrintBeginFrameBanner = false;
/// Print a banner at the end of each frame. /// Print a banner at the end of each frame.
......
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