diff --git a/packages/flutter/lib/src/foundation/debug.dart b/packages/flutter/lib/src/foundation/debug.dart index 55969f16e3..51b1be0d10 100644 --- a/packages/flutter/lib/src/foundation/debug.dart +++ b/packages/flutter/lib/src/foundation/debug.dart @@ -82,23 +82,6 @@ Future debugInstrumentAction(String description, Future Function() acti } } -/// Argument passed to [dart:developer.Timeline] events in order to cause those -/// events to be shown in the developer-centric version of the Observatory -/// Timeline. -/// -/// Generally these indicate landmark events such as the build phase or layout. -/// -/// [DiagnosticsNode.toTimelineArguments] includes these properties in its -/// result. -/// -/// See also: -/// -/// * [dart:developer.Timeline.startSync], which typically takes this value as -/// its `arguments` argument. -const Map timelineArgumentsIndicatingLandmarkEvent = { - 'mode': 'basic', -}; - /// Configure [debugFormatDouble] using [num.toStringAsPrecision]. /// /// Defaults to null, which uses the default logic of [debugFormatDouble]. diff --git a/packages/flutter/lib/src/foundation/diagnostics.dart b/packages/flutter/lib/src/foundation/diagnostics.dart index 580e68e793..6bd4f7c3c8 100644 --- a/packages/flutter/lib/src/foundation/diagnostics.dart +++ b/packages/flutter/lib/src/foundation/diagnostics.dart @@ -1547,21 +1547,16 @@ abstract class DiagnosticsNode { /// Converts the properties ([getProperties]) of this node to a form useful /// for [Timeline] event arguments (as in [Timeline.startSync]). /// - /// The properties specified by [timelineArgumentsIndicatingLandmarkEvent] are - /// included in the result. - /// /// Children ([getChildren]) are omitted. /// /// This method is only valid in debug builds. In profile builds, this method - /// throws an exception. In release builds, it returns a copy of - /// [timelineArgumentsIndicatingLandmarkEvent] with no arguments added. + /// throws an exception. In release builds it returns null. /// /// See also: /// /// * [toJsonMap], which converts this node to a structured form intended for /// data exchange (e.g. with an IDE). - Map toTimelineArguments() { - final Map result = Map.of(timelineArgumentsIndicatingLandmarkEvent); + Map? toTimelineArguments() { if (!kReleaseMode) { // We don't throw in release builds, to avoid hurting users. We also don't do anything useful. if (kProfileMode) { @@ -1573,13 +1568,15 @@ abstract class DiagnosticsNode { 'this application is compiled in profile mode and yet still invoked the method.' ); } + final Map result = {}; for (final DiagnosticsNode property in getProperties()) { if (property.name != null) { result[property.name!] = property.toDescription(parentConfiguration: singleLineTextConfiguration); } } + return result; } - return result; + return null; } /// Serialize the node to a JSON map according to the configuration provided diff --git a/packages/flutter/lib/src/rendering/binding.dart b/packages/flutter/lib/src/rendering/binding.dart index 7a3381110a..2e59a4055f 100644 --- a/packages/flutter/lib/src/rendering/binding.dart +++ b/packages/flutter/lib/src/rendering/binding.dart @@ -513,7 +513,7 @@ mixin RendererBinding on BindingBase, ServicesBinding, SchedulerBinding, Gesture await super.performReassemble(); if (BindingBase.debugReassembleConfig?.widgetName == null) { if (!kReleaseMode) { - Timeline.startSync('Preparing Hot Reload (layout)', arguments: timelineArgumentsIndicatingLandmarkEvent); + Timeline.startSync('Preparing Hot Reload (layout)'); } try { renderView.reassemble(); diff --git a/packages/flutter/lib/src/rendering/box.dart b/packages/flutter/lib/src/rendering/box.dart index 6f1dfd2832..4c0a137b00 100644 --- a/packages/flutter/lib/src/rendering/box.dart +++ b/packages/flutter/lib/src/rendering/box.dart @@ -1369,15 +1369,15 @@ abstract class RenderBox extends RenderObject { return true; }()); if (shouldCache) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhanceLayoutTimelineArguments) { debugTimelineArguments = toDiagnosticsNode().toTimelineArguments(); } else { - debugTimelineArguments = Map.of(debugTimelineArguments); + debugTimelineArguments = {}; } - debugTimelineArguments['intrinsics dimension'] = describeEnum(dimension); - debugTimelineArguments['intrinsics argument'] = '$argument'; + debugTimelineArguments!['intrinsics dimension'] = describeEnum(dimension); + debugTimelineArguments!['intrinsics argument'] = '$argument'; return true; }()); if (!kReleaseMode) { @@ -1833,14 +1833,14 @@ abstract class RenderBox extends RenderObject { return true; }()); if (shouldCache) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhanceLayoutTimelineArguments) { debugTimelineArguments = toDiagnosticsNode().toTimelineArguments(); } else { - debugTimelineArguments = Map.of(debugTimelineArguments); + debugTimelineArguments = {}; } - debugTimelineArguments['getDryLayout constraints'] = '$constraints'; + debugTimelineArguments!['getDryLayout constraints'] = '$constraints'; return true; }()); if (!kReleaseMode) { diff --git a/packages/flutter/lib/src/rendering/object.dart b/packages/flutter/lib/src/rendering/object.dart index d8da76625d..9fc7f61de4 100644 --- a/packages/flutter/lib/src/rendering/object.dart +++ b/packages/flutter/lib/src/rendering/object.dart @@ -858,11 +858,10 @@ class PipelineOwner { /// See [RendererBinding] for an example of how this function is used. void flushLayout() { if (!kReleaseMode) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhanceLayoutTimelineArguments) { debugTimelineArguments = { - ...debugTimelineArguments, 'dirty count': '${_nodesNeedingLayout.length}', 'dirty list': '$_nodesNeedingLayout', }; @@ -931,7 +930,7 @@ class PipelineOwner { /// [flushPaint]. void flushCompositingBits() { if (!kReleaseMode) { - Timeline.startSync('UPDATING COMPOSITING BITS', arguments: timelineArgumentsIndicatingLandmarkEvent); + Timeline.startSync('UPDATING COMPOSITING BITS'); } _nodesNeedingCompositingBitsUpdate.sort((RenderObject a, RenderObject b) => a.depth - b.depth); for (final RenderObject node in _nodesNeedingCompositingBitsUpdate) { @@ -964,11 +963,10 @@ class PipelineOwner { /// See [RendererBinding] for an example of how this function is used. void flushPaint() { if (!kReleaseMode) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhancePaintTimelineArguments) { debugTimelineArguments = { - ...debugTimelineArguments, 'dirty count': '${_nodesNeedingPaint.length}', 'dirty list': '$_nodesNeedingPaint', }; @@ -1080,7 +1078,7 @@ class PipelineOwner { if (_semanticsOwner == null) return; if (!kReleaseMode) { - Timeline.startSync('SEMANTICS', arguments: timelineArgumentsIndicatingLandmarkEvent); + Timeline.startSync('SEMANTICS'); } assert(_semanticsOwner != null); assert(() { @@ -1796,7 +1794,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im void layout(Constraints constraints, { bool parentUsesSize = false }) { assert(!_debugDisposed); if (!kReleaseMode && debugProfileLayoutsEnabled) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhanceLayoutTimelineArguments) { debugTimelineArguments = toDiagnosticsNode().toTimelineArguments(); @@ -2402,7 +2400,7 @@ abstract class RenderObject extends AbstractNode with DiagnosticableTreeMixin im if (_needsLayout) return; if (!kReleaseMode && debugProfilePaintsEnabled) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhancePaintTimelineArguments) { debugTimelineArguments = toDiagnosticsNode().toTimelineArguments(); diff --git a/packages/flutter/lib/src/rendering/view.dart b/packages/flutter/lib/src/rendering/view.dart index 097f069b01..260b97fedf 100644 --- a/packages/flutter/lib/src/rendering/view.dart +++ b/packages/flutter/lib/src/rendering/view.dart @@ -221,7 +221,7 @@ class RenderView extends RenderObject with RenderObjectWithChildMixin /// Actually causes the output of the rendering pipeline to appear on screen. void compositeFrame() { if (!kReleaseMode) { - Timeline.startSync('COMPOSITING', arguments: timelineArgumentsIndicatingLandmarkEvent); + Timeline.startSync('COMPOSITING'); } try { final ui.SceneBuilder builder = ui.SceneBuilder(); diff --git a/packages/flutter/lib/src/scheduler/binding.dart b/packages/flutter/lib/src/scheduler/binding.dart index 1be5607dca..fd72136885 100644 --- a/packages/flutter/lib/src/scheduler/binding.dart +++ b/packages/flutter/lib/src/scheduler/binding.dart @@ -1023,7 +1023,7 @@ mixin SchedulerBinding on BindingBase { /// statements printed during a frame from those printed between frames (e.g. /// in response to events or timers). void handleBeginFrame(Duration? rawTimeStamp) { - _frameTimelineTask?.start('Frame', arguments: timelineArgumentsIndicatingLandmarkEvent); + _frameTimelineTask?.start('Frame'); _firstRawTimeStampInEpoch ??= rawTimeStamp; _currentFrameTimeStamp = _adjustForEpoch(rawTimeStamp ?? _lastRawTimeStamp); if (rawTimeStamp != null) @@ -1050,7 +1050,7 @@ mixin SchedulerBinding on BindingBase { _hasScheduledFrame = false; try { // TRANSIENT FRAME CALLBACKS - _frameTimelineTask?.start('Animate', arguments: timelineArgumentsIndicatingLandmarkEvent); + _frameTimelineTask?.start('Animate'); _schedulerPhase = SchedulerPhase.transientCallbacks; final Map callbacks = _transientCallbacks; _transientCallbacks = {}; diff --git a/packages/flutter/lib/src/widgets/framework.dart b/packages/flutter/lib/src/widgets/framework.dart index 75b874dc10..5bc0ecb272 100644 --- a/packages/flutter/lib/src/widgets/framework.dart +++ b/packages/flutter/lib/src/widgets/framework.dart @@ -2563,11 +2563,10 @@ class BuildOwner { return true; }()); if (!kReleaseMode) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (debugEnhanceBuildTimelineArguments) { debugTimelineArguments = { - ...debugTimelineArguments, 'dirty count': '${_dirtyElements.length}', 'dirty list': '$_dirtyElements', 'lock level': '$_debugStateLockLevel', @@ -2643,7 +2642,7 @@ class BuildOwner { }()); final bool isTimelineTracked = !kReleaseMode && _isProfileBuildsEnabledFor(element.widget); if (isTimelineTracked) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (kDebugMode && debugEnhanceBuildTimelineArguments) { debugTimelineArguments = element.widget.toDiagnosticsNode().toTimelineArguments(); @@ -2926,7 +2925,7 @@ class BuildOwner { @pragma('vm:notify-debugger-on-exception') void finalizeTree() { if (!kReleaseMode) { - Timeline.startSync('FINALIZE TREE', arguments: timelineArgumentsIndicatingLandmarkEvent); + Timeline.startSync('FINALIZE TREE'); } try { lockState(_inactiveElements._unmountAll); // this unregisters the GlobalKeys @@ -3515,7 +3514,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { updateSlotForChild(child, newSlot); final bool isTimelineTracked = !kReleaseMode && _isProfileBuildsEnabledFor(newWidget); if (isTimelineTracked) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (kDebugMode && debugEnhanceBuildTimelineArguments) { debugTimelineArguments = newWidget.toDiagnosticsNode().toTimelineArguments(); @@ -3780,7 +3779,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext { final bool isTimelineTracked = !kReleaseMode && _isProfileBuildsEnabledFor(newWidget); if (isTimelineTracked) { - Map debugTimelineArguments = timelineArgumentsIndicatingLandmarkEvent; + Map? debugTimelineArguments; assert(() { if (kDebugMode && debugEnhanceBuildTimelineArguments) { debugTimelineArguments = newWidget.toDiagnosticsNode().toTimelineArguments();