Clean up leak tracker instrumentation tech debt. (#164070)
Fixes https://github.com/flutter/flutter/issues/137435 Tests are not needed because it is refactoring. Requested [exempt](https://discord.com/channels/608014603317936148/608018585025118217/1343801945982505001). @goderbauer , if looks good, can you merge it please, to avoid conflicts, as there are many files here?
This commit is contained in:
parent
ad8718644c
commit
7d56be4c8d
@ -23,8 +23,6 @@ export 'package:flutter/scheduler.dart' show TickerFuture, TickerProvider;
|
|||||||
export 'animation.dart' show Animation, AnimationStatus;
|
export 'animation.dart' show Animation, AnimationStatus;
|
||||||
export 'curves.dart' show Curve;
|
export 'curves.dart' show Curve;
|
||||||
|
|
||||||
const String _flutterAnimationLibrary = 'package:flutter/animation.dart';
|
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
// late AnimationController _controller, fadeAnimationController, sizeAnimationController;
|
// late AnimationController _controller, fadeAnimationController, sizeAnimationController;
|
||||||
// late bool dismissed;
|
// late bool dismissed;
|
||||||
@ -255,9 +253,7 @@ class AnimationController extends Animation<double>
|
|||||||
required TickerProvider vsync,
|
required TickerProvider vsync,
|
||||||
}) : assert(upperBound >= lowerBound),
|
}) : assert(upperBound >= lowerBound),
|
||||||
_direction = _AnimationDirection.forward {
|
_direction = _AnimationDirection.forward {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('animation', 'AnimationController', this));
|
||||||
_maybeDispatchObjectCreation();
|
|
||||||
}
|
|
||||||
_ticker = vsync.createTicker(_tick);
|
_ticker = vsync.createTicker(_tick);
|
||||||
_internalSetValue(value ?? lowerBound);
|
_internalSetValue(value ?? lowerBound);
|
||||||
}
|
}
|
||||||
@ -289,24 +285,11 @@ class AnimationController extends Animation<double>
|
|||||||
}) : lowerBound = double.negativeInfinity,
|
}) : lowerBound = double.negativeInfinity,
|
||||||
upperBound = double.infinity,
|
upperBound = double.infinity,
|
||||||
_direction = _AnimationDirection.forward {
|
_direction = _AnimationDirection.forward {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('animation', 'AnimationController', this));
|
||||||
_maybeDispatchObjectCreation();
|
|
||||||
}
|
|
||||||
_ticker = vsync.createTicker(_tick);
|
_ticker = vsync.createTicker(_tick);
|
||||||
_internalSetValue(value);
|
_internalSetValue(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Dispatches event of object creation to [FlutterMemoryAllocations.instance].
|
|
||||||
void _maybeDispatchObjectCreation() {
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterAnimationLibrary,
|
|
||||||
className: '$AnimationController',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// The value at which this animation is deemed to be dismissed.
|
/// The value at which this animation is deemed to be dismissed.
|
||||||
final double lowerBound;
|
final double lowerBound;
|
||||||
|
|
||||||
@ -946,9 +929,7 @@ class AnimationController extends Animation<double>
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_ticker!.dispose();
|
_ticker!.dispose();
|
||||||
_ticker = null;
|
_ticker = null;
|
||||||
clearStatusListeners();
|
clearStatusListeners();
|
||||||
|
@ -505,15 +505,7 @@ class TrainHoppingAnimation extends Animation<double>
|
|||||||
this._nextTrain, {
|
this._nextTrain, {
|
||||||
this.onSwitchedTrain,
|
this.onSwitchedTrain,
|
||||||
}) {
|
}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('animation', 'TrainHoppingAnimation', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/animation.dart',
|
|
||||||
className: '$TrainHoppingAnimation',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (_nextTrain != null) {
|
if (_nextTrain != null) {
|
||||||
if (_currentTrain!.value == _nextTrain!.value) {
|
if (_currentTrain!.value == _nextTrain!.value) {
|
||||||
_currentTrain = _nextTrain;
|
_currentTrain = _nextTrain;
|
||||||
@ -598,11 +590,7 @@ class TrainHoppingAnimation extends Animation<double>
|
|||||||
/// After this is called, this object is no longer usable.
|
/// After this is called, this object is no longer usable.
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
assert(_currentTrain != null);
|
assert(_currentTrain != null);
|
||||||
_currentTrain!.removeStatusListener(_statusChangeHandler);
|
_currentTrain!.removeStatusListener(_statusChangeHandler);
|
||||||
_currentTrain!.removeListener(_valueChangeHandler);
|
_currentTrain!.removeListener(_valueChangeHandler);
|
||||||
|
@ -11,6 +11,7 @@ import 'dart:ui' show VoidCallback;
|
|||||||
import 'package:meta/meta.dart';
|
import 'package:meta/meta.dart';
|
||||||
|
|
||||||
import 'assertions.dart';
|
import 'assertions.dart';
|
||||||
|
import 'debug.dart';
|
||||||
import 'diagnostics.dart';
|
import 'diagnostics.dart';
|
||||||
import 'memory_allocations.dart';
|
import 'memory_allocations.dart';
|
||||||
|
|
||||||
@ -100,8 +101,6 @@ abstract class ValueListenable<T> extends Listenable {
|
|||||||
T get value;
|
T get value;
|
||||||
}
|
}
|
||||||
|
|
||||||
const String _flutterFoundationLibrary = 'package:flutter/foundation.dart';
|
|
||||||
|
|
||||||
/// A class that can be extended or mixed in that provides a change notification
|
/// A class that can be extended or mixed in that provides a change notification
|
||||||
/// API using [VoidCallback] for notifications.
|
/// API using [VoidCallback] for notifications.
|
||||||
///
|
///
|
||||||
@ -156,7 +155,7 @@ mixin class ChangeNotifier implements Listenable {
|
|||||||
///
|
///
|
||||||
/// As [ChangeNotifier] is used as mixin, it does not have constructor,
|
/// As [ChangeNotifier] is used as mixin, it does not have constructor,
|
||||||
/// so we use [addListener] to dispatch the event.
|
/// so we use [addListener] to dispatch the event.
|
||||||
bool _creationDispatched = false;
|
bool _debugCreationDispatched = false;
|
||||||
|
|
||||||
/// Used by subclasses to assert that the [ChangeNotifier] has not yet been
|
/// Used by subclasses to assert that the [ChangeNotifier] has not yet been
|
||||||
/// disposed.
|
/// disposed.
|
||||||
@ -232,16 +231,13 @@ mixin class ChangeNotifier implements Listenable {
|
|||||||
/// so that the method is tree-shaken away when the flag is false.
|
/// so that the method is tree-shaken away when the flag is false.
|
||||||
@protected
|
@protected
|
||||||
static void maybeDispatchObjectCreation(ChangeNotifier object) {
|
static void maybeDispatchObjectCreation(ChangeNotifier object) {
|
||||||
// Tree shaker does not include this method and the class MemoryAllocations
|
assert(() {
|
||||||
// if kFlutterMemoryAllocationsEnabled is false.
|
if (!object._debugCreationDispatched) {
|
||||||
if (kFlutterMemoryAllocationsEnabled && !object._creationDispatched) {
|
debugMaybeDispatchCreated('foundation', 'ChangeNotifier', object);
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
object._debugCreationDispatched = true;
|
||||||
library: _flutterFoundationLibrary,
|
}
|
||||||
className: '$ChangeNotifier',
|
return true;
|
||||||
object: object,
|
}());
|
||||||
);
|
|
||||||
object._creationDispatched = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Register a closure to be called when the object changes.
|
/// Register a closure to be called when the object changes.
|
||||||
@ -387,11 +383,11 @@ mixin class ChangeNotifier implements Listenable {
|
|||||||
);
|
);
|
||||||
assert(() {
|
assert(() {
|
||||||
_debugDisposed = true;
|
_debugDisposed = true;
|
||||||
|
if (_debugCreationDispatched) {
|
||||||
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled && _creationDispatched) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_listeners = _emptyListeners;
|
_listeners = _emptyListeners;
|
||||||
_count = 0;
|
_count = 0;
|
||||||
}
|
}
|
||||||
|
@ -39,15 +39,7 @@ abstract class MultiDragPointerState {
|
|||||||
/// Creates per-pointer state for a [MultiDragGestureRecognizer].
|
/// Creates per-pointer state for a [MultiDragGestureRecognizer].
|
||||||
MultiDragPointerState(this.initialPosition, this.kind, this.gestureSettings)
|
MultiDragPointerState(this.initialPosition, this.kind, this.gestureSettings)
|
||||||
: _velocityTracker = VelocityTracker.withKind(kind) {
|
: _velocityTracker = VelocityTracker.withKind(kind) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('gestures', 'MultiDragPointerState', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/gestures.dart',
|
|
||||||
className: '$MultiDragPointerState',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Device specific gesture configuration that should be preferred over
|
/// Device specific gesture configuration that should be preferred over
|
||||||
@ -195,11 +187,7 @@ abstract class MultiDragPointerState {
|
|||||||
@protected
|
@protected
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_arenaEntry?.resolve(GestureDisposition.rejected);
|
_arenaEntry?.resolve(GestureDisposition.rejected);
|
||||||
_arenaEntry = null;
|
_arenaEntry = null;
|
||||||
assert(() {
|
assert(() {
|
||||||
|
@ -142,15 +142,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
|
|||||||
this.supportedDevices,
|
this.supportedDevices,
|
||||||
this.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
this.allowedButtonsFilter = _defaultButtonAcceptBehavior,
|
||||||
}) {
|
}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('gestures', 'GestureRecognizer', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/gestures.dart',
|
|
||||||
className: '$GestureRecognizer',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The recognizer's owner.
|
/// The recognizer's owner.
|
||||||
@ -313,11 +305,7 @@ abstract class GestureRecognizer extends GestureArenaMember with DiagnosticableT
|
|||||||
/// GestureDetector widget calls this method).
|
/// GestureDetector widget calls this method).
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a very short pretty description of the gesture that the
|
/// Returns a very short pretty description of the gesture that the
|
||||||
|
@ -677,15 +677,7 @@ abstract class InkFeature {
|
|||||||
required this.referenceBox,
|
required this.referenceBox,
|
||||||
this.onRemoved,
|
this.onRemoved,
|
||||||
}) : _controller = controller as _RenderInkFeatures {
|
}) : _controller = controller as _RenderInkFeatures {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('material', 'InkFeature', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/material.dart',
|
|
||||||
className: '$InkFeature',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The [MaterialInkController] associated with this [InkFeature].
|
/// The [MaterialInkController] associated with this [InkFeature].
|
||||||
@ -711,11 +703,7 @@ abstract class InkFeature {
|
|||||||
_debugDisposed = true;
|
_debugDisposed = true;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_controller._removeFeature(this);
|
_controller._removeFeature(this);
|
||||||
onRemoved?.call();
|
onRemoved?.call();
|
||||||
}
|
}
|
||||||
|
@ -146,15 +146,7 @@ class _AnimationTuple {
|
|||||||
required this.endAnimation,
|
required this.endAnimation,
|
||||||
required this.gapAnimation,
|
required this.gapAnimation,
|
||||||
}) {
|
}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('material', '_AnimationTuple', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/material.dart',
|
|
||||||
className: '$_AnimationTuple',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final AnimationController controller;
|
final AnimationController controller;
|
||||||
@ -165,9 +157,7 @@ class _AnimationTuple {
|
|||||||
|
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
controller.dispose();
|
controller.dispose();
|
||||||
startAnimation.dispose();
|
startAnimation.dispose();
|
||||||
endAnimation.dispose();
|
endAnimation.dispose();
|
||||||
|
@ -480,15 +480,7 @@ class _IndicatorPainter extends CustomPainter {
|
|||||||
required this.indicatorAnimation,
|
required this.indicatorAnimation,
|
||||||
required this.textDirection,
|
required this.textDirection,
|
||||||
}) : super(repaint: controller.animation) {
|
}) : super(repaint: controller.animation) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('material', '_IndicatorPainter', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/material.dart',
|
|
||||||
className: '$_IndicatorPainter',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (old != null) {
|
if (old != null) {
|
||||||
saveTabOffsets(old._currentTabOffsets, old._currentTextDirection);
|
saveTabOffsets(old._currentTabOffsets, old._currentTextDirection);
|
||||||
}
|
}
|
||||||
@ -521,9 +513,7 @@ class _IndicatorPainter extends CustomPainter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_painter?.dispose();
|
_painter?.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -957,15 +957,7 @@ class _DialPainter extends CustomPainter {
|
|||||||
required this.textDirection,
|
required this.textDirection,
|
||||||
required this.selectedValue,
|
required this.selectedValue,
|
||||||
}) : super(repaint: PaintingBinding.instance.systemFonts) {
|
}) : super(repaint: PaintingBinding.instance.systemFonts) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('material', '_DialPainter', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/material.dart',
|
|
||||||
className: '$_DialPainter',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final List<_TappableLabel> primaryLabels;
|
final List<_TappableLabel> primaryLabels;
|
||||||
@ -982,9 +974,7 @@ class _DialPainter extends CustomPainter {
|
|||||||
final int selectedValue;
|
final int selectedValue;
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
for (final _TappableLabel label in primaryLabels) {
|
for (final _TappableLabel label in primaryLabels) {
|
||||||
label.painter.dispose();
|
label.painter.dispose();
|
||||||
}
|
}
|
||||||
|
@ -319,15 +319,7 @@ abstract interface class DecorationImagePainter {
|
|||||||
|
|
||||||
class _DecorationImagePainter implements DecorationImagePainter {
|
class _DecorationImagePainter implements DecorationImagePainter {
|
||||||
_DecorationImagePainter._(this._details, this._onChanged) {
|
_DecorationImagePainter._(this._details, this._onChanged) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('painting', '_DecorationImagePainter', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/painting.dart',
|
|
||||||
className: '$_DecorationImagePainter',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final DecorationImage _details;
|
final DecorationImage _details;
|
||||||
@ -438,9 +430,7 @@ class _DecorationImagePainter implements DecorationImagePainter {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_imageStream?.removeListener(ImageStreamListener(_handleImage, onError: _details.onError));
|
_imageStream?.removeListener(ImageStreamListener(_handleImage, onError: _details.onError));
|
||||||
_image?.dispose();
|
_image?.dispose();
|
||||||
_image = null;
|
_image = null;
|
||||||
@ -862,15 +852,7 @@ class _BlendedDecorationImage implements DecorationImage {
|
|||||||
|
|
||||||
class _BlendedDecorationImagePainter implements DecorationImagePainter {
|
class _BlendedDecorationImagePainter implements DecorationImagePainter {
|
||||||
_BlendedDecorationImagePainter._(this.a, this.b, this.t) {
|
_BlendedDecorationImagePainter._(this.a, this.b, this.t) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('painting', '_BlendedDecorationImagePainter', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/painting.dart',
|
|
||||||
className: '$_BlendedDecorationImagePainter',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final DecorationImagePainter? a;
|
final DecorationImagePainter? a;
|
||||||
@ -901,9 +883,7 @@ class _BlendedDecorationImagePainter implements DecorationImagePainter {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
a?.dispose();
|
a?.dispose();
|
||||||
b?.dispose();
|
b?.dispose();
|
||||||
}
|
}
|
||||||
|
@ -595,15 +595,7 @@ class ImageCacheStatus {
|
|||||||
/// [ImageCache._cache].
|
/// [ImageCache._cache].
|
||||||
abstract class _CachedImageBase {
|
abstract class _CachedImageBase {
|
||||||
_CachedImageBase(this.completer, {this.sizeBytes}) : handle = completer.keepAlive() {
|
_CachedImageBase(this.completer, {this.sizeBytes}) : handle = completer.keepAlive() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('painting', '_CachedImageBase', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/painting.dart',
|
|
||||||
className: '$_CachedImageBase',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final ImageStreamCompleter completer;
|
final ImageStreamCompleter completer;
|
||||||
@ -613,9 +605,7 @@ abstract class _CachedImageBase {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(handle != null);
|
assert(handle != null);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
// Give any interested parties a chance to listen to the stream before we
|
// Give any interested parties a chance to listen to the stream before we
|
||||||
// potentially dispose it.
|
// potentially dispose it.
|
||||||
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) {
|
SchedulerBinding.instance.addPostFrameCallback((Duration timeStamp) {
|
||||||
|
@ -16,8 +16,6 @@ import 'dart:ui' as ui show Codec, FrameInfo, Image;
|
|||||||
import 'package:flutter/foundation.dart';
|
import 'package:flutter/foundation.dart';
|
||||||
import 'package:flutter/scheduler.dart';
|
import 'package:flutter/scheduler.dart';
|
||||||
|
|
||||||
const String _flutterPaintingLibrary = 'package:flutter/painting.dart';
|
|
||||||
|
|
||||||
/// A [dart:ui.Image] object with its corresponding scale.
|
/// A [dart:ui.Image] object with its corresponding scale.
|
||||||
///
|
///
|
||||||
/// ImageInfo objects are used by [ImageStream] objects to represent the
|
/// ImageInfo objects are used by [ImageStream] objects to represent the
|
||||||
@ -47,13 +45,7 @@ class ImageInfo {
|
|||||||
///
|
///
|
||||||
/// See details for disposing contract in the class description.
|
/// See details for disposing contract in the class description.
|
||||||
ImageInfo({required this.image, this.scale = 1.0, this.debugLabel}) {
|
ImageInfo({required this.image, this.scale = 1.0, this.debugLabel}) {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('painting', 'ImageInfo', this));
|
||||||
MemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterPaintingLibrary,
|
|
||||||
className: '$ImageInfo',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates an [ImageInfo] with a cloned [image].
|
/// Creates an [ImageInfo] with a cloned [image].
|
||||||
@ -144,9 +136,7 @@ class ImageInfo {
|
|||||||
/// and no clones of it or the image it contains can be made.
|
/// and no clones of it or the image it contains can be made.
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert((image.debugGetOpenHandleStackTraces()?.length ?? 1) > 0);
|
assert((image.debugGetOpenHandleStackTraces()?.length ?? 1) > 0);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
MemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
image.dispose();
|
image.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -460,15 +450,7 @@ class ImageStream with Diagnosticable {
|
|||||||
class ImageStreamCompleterHandle {
|
class ImageStreamCompleterHandle {
|
||||||
ImageStreamCompleterHandle._(ImageStreamCompleter this._completer) {
|
ImageStreamCompleterHandle._(ImageStreamCompleter this._completer) {
|
||||||
_completer!._keepAliveHandles += 1;
|
_completer!._keepAliveHandles += 1;
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('painting', 'ImageStreamCompleterHandle', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterPaintingLibrary,
|
|
||||||
className: '$ImageStreamCompleterHandle',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ImageStreamCompleter? _completer;
|
ImageStreamCompleter? _completer;
|
||||||
@ -485,11 +467,7 @@ class ImageStreamCompleterHandle {
|
|||||||
_completer!._keepAliveHandles -= 1;
|
_completer!._keepAliveHandles -= 1;
|
||||||
_completer!._maybeDispose();
|
_completer!._maybeDispose();
|
||||||
_completer = null;
|
_completer = null;
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -561,8 +561,6 @@ class _LineCaretMetrics {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const String _flutterPaintingLibrary = 'package:flutter/painting.dart';
|
|
||||||
|
|
||||||
/// An object that paints a [TextSpan] tree into a [Canvas].
|
/// An object that paints a [TextSpan] tree into a [Canvas].
|
||||||
///
|
///
|
||||||
/// To use a [TextPainter], follow these steps:
|
/// To use a [TextPainter], follow these steps:
|
||||||
@ -628,15 +626,7 @@ class TextPainter {
|
|||||||
_strutStyle = strutStyle,
|
_strutStyle = strutStyle,
|
||||||
_textWidthBasis = textWidthBasis,
|
_textWidthBasis = textWidthBasis,
|
||||||
_textHeightBehavior = textHeightBehavior {
|
_textHeightBehavior = textHeightBehavior {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('painting', 'TextPainter', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterPaintingLibrary,
|
|
||||||
className: '$TextPainter',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Computes the width of a configured [TextPainter].
|
/// Computes the width of a configured [TextPainter].
|
||||||
@ -1786,11 +1776,7 @@ class TextPainter {
|
|||||||
_disposed = true;
|
_disposed = true;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_layoutTemplate?.dispose();
|
_layoutTemplate?.dispose();
|
||||||
_layoutTemplate = null;
|
_layoutTemplate = null;
|
||||||
_layoutCache?.paragraph.dispose();
|
_layoutCache?.paragraph.dispose();
|
||||||
|
@ -80,8 +80,6 @@ class AnnotationResult<T> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const String _flutterRenderingLibrary = 'package:flutter/rendering.dart';
|
|
||||||
|
|
||||||
/// A composited layer.
|
/// A composited layer.
|
||||||
///
|
///
|
||||||
/// During painting, the render tree generates a tree of composited layers that
|
/// During painting, the render tree generates a tree of composited layers that
|
||||||
@ -146,13 +144,7 @@ const String _flutterRenderingLibrary = 'package:flutter/rendering.dart';
|
|||||||
abstract class Layer with DiagnosticableTreeMixin {
|
abstract class Layer with DiagnosticableTreeMixin {
|
||||||
/// Creates an instance of Layer.
|
/// Creates an instance of Layer.
|
||||||
Layer() {
|
Layer() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('rendering', 'Layer', this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterRenderingLibrary,
|
|
||||||
className: '$Layer',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final Map<int, VoidCallback> _callbacks = <int, VoidCallback>{};
|
final Map<int, VoidCallback> _callbacks = <int, VoidCallback>{};
|
||||||
@ -342,9 +334,7 @@ abstract class Layer with DiagnosticableTreeMixin {
|
|||||||
_debugDisposed = true;
|
_debugDisposed = true;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_engineLayer?.dispose();
|
_engineLayer?.dispose();
|
||||||
_engineLayer = null;
|
_engineLayer = null;
|
||||||
}
|
}
|
||||||
|
@ -884,16 +884,7 @@ typedef LayoutCallback<T extends Constraints> = void Function(T constraints);
|
|||||||
|
|
||||||
class _LocalSemanticsHandle implements SemanticsHandle {
|
class _LocalSemanticsHandle implements SemanticsHandle {
|
||||||
_LocalSemanticsHandle._(PipelineOwner owner, this.listener) : _owner = owner {
|
_LocalSemanticsHandle._(PipelineOwner owner, this.listener) : _owner = owner {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('rendering', '_LocalSemanticsHandle', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/rendering.dart',
|
|
||||||
className: '$_LocalSemanticsHandle',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
_owner.semanticsOwner!.addListener(listener!);
|
_owner.semanticsOwner!.addListener(listener!);
|
||||||
}
|
}
|
||||||
@ -906,12 +897,7 @@ class _LocalSemanticsHandle implements SemanticsHandle {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
_owner.semanticsOwner!.removeListener(listener!);
|
_owner.semanticsOwner!.removeListener(listener!);
|
||||||
}
|
}
|
||||||
@ -974,15 +960,7 @@ base class PipelineOwner with DiagnosticableTreeMixin {
|
|||||||
this.onSemanticsUpdate,
|
this.onSemanticsUpdate,
|
||||||
this.onSemanticsOwnerDisposed,
|
this.onSemanticsOwnerDisposed,
|
||||||
}) {
|
}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('rendering', 'PipelineOwner', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/rendering.dart',
|
|
||||||
className: '$PipelineOwner',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called when a render object associated with this pipeline owner wishes to
|
/// Called when a render object associated with this pipeline owner wishes to
|
||||||
@ -1598,9 +1576,7 @@ base class PipelineOwner with DiagnosticableTreeMixin {
|
|||||||
assert(rootNode == null);
|
assert(rootNode == null);
|
||||||
assert(_manifold == null);
|
assert(_manifold == null);
|
||||||
assert(_debugParent == null);
|
assert(_debugParent == null);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_semanticsOwner?.dispose();
|
_semanticsOwner?.dispose();
|
||||||
_semanticsOwner = null;
|
_semanticsOwner = null;
|
||||||
_nodesNeedingLayout.clear();
|
_nodesNeedingLayout.clear();
|
||||||
@ -1664,8 +1640,6 @@ abstract class PipelineManifold implements Listenable {
|
|||||||
void requestVisualUpdate();
|
void requestVisualUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
const String _flutterRenderingLibrary = 'package:flutter/rendering.dart';
|
|
||||||
|
|
||||||
/// An object in the render tree.
|
/// An object in the render tree.
|
||||||
///
|
///
|
||||||
/// The [RenderObject] class hierarchy is the core of the rendering
|
/// The [RenderObject] class hierarchy is the core of the rendering
|
||||||
@ -1794,13 +1768,7 @@ const String _flutterRenderingLibrary = 'package:flutter/rendering.dart';
|
|||||||
abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarget {
|
abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarget {
|
||||||
/// Initializes internal fields for subclasses.
|
/// Initializes internal fields for subclasses.
|
||||||
RenderObject() {
|
RenderObject() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('rendering', 'RenderObject', this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterRenderingLibrary,
|
|
||||||
className: '$RenderObject',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
_needsCompositing = isRepaintBoundary || alwaysNeedsCompositing;
|
_needsCompositing = isRepaintBoundary || alwaysNeedsCompositing;
|
||||||
_wasRepaintBoundary = isRepaintBoundary;
|
_wasRepaintBoundary = isRepaintBoundary;
|
||||||
}
|
}
|
||||||
@ -1861,9 +1829,7 @@ abstract class RenderObject with DiagnosticableTreeMixin implements HitTestTarge
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(!_debugDisposed);
|
assert(!_debugDisposed);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_layerHandle.layer = null;
|
_layerHandle.layer = null;
|
||||||
assert(() {
|
assert(() {
|
||||||
// TODO(dnfield): Enable this assert once clients have had a chance to
|
// TODO(dnfield): Enable this assert once clients have had a chance to
|
||||||
|
@ -212,15 +212,7 @@ typedef _PerformanceModeCleanupCallback = VoidCallback;
|
|||||||
/// The component that makes the request is responsible for disposing the handle.
|
/// The component that makes the request is responsible for disposing the handle.
|
||||||
class PerformanceModeRequestHandle {
|
class PerformanceModeRequestHandle {
|
||||||
PerformanceModeRequestHandle._(_PerformanceModeCleanupCallback this._cleanup) {
|
PerformanceModeRequestHandle._(_PerformanceModeCleanupCallback this._cleanup) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('scheduler', 'PerformanceModeRequestHandle', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/scheduler.dart',
|
|
||||||
className: '$PerformanceModeRequestHandle',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_PerformanceModeCleanupCallback? _cleanup;
|
_PerformanceModeCleanupCallback? _cleanup;
|
||||||
@ -231,11 +223,7 @@ class PerformanceModeRequestHandle {
|
|||||||
/// This method must only be called once per object.
|
/// This method must only be called once per object.
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(_cleanup != null);
|
assert(_cleanup != null);
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_cleanup!();
|
_cleanup!();
|
||||||
_cleanup = null;
|
_cleanup = null;
|
||||||
}
|
}
|
||||||
|
@ -86,15 +86,7 @@ class Ticker {
|
|||||||
_debugCreationStack = StackTrace.current;
|
_debugCreationStack = StackTrace.current;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('scheduler', 'Ticker', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/scheduler.dart',
|
|
||||||
className: '$Ticker',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TickerFuture? _future;
|
TickerFuture? _future;
|
||||||
@ -354,12 +346,7 @@ class Ticker {
|
|||||||
/// with a [TickerCanceled] error.
|
/// with a [TickerCanceled] error.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_future != null) {
|
if (_future != null) {
|
||||||
final TickerFuture localFuture = _future!;
|
final TickerFuture localFuture = _future!;
|
||||||
_future = null;
|
_future = null;
|
||||||
|
@ -227,15 +227,7 @@ mixin SemanticsBinding on BindingBase {
|
|||||||
/// To obtain a [SemanticsHandle], call [SemanticsBinding.ensureSemantics].
|
/// To obtain a [SemanticsHandle], call [SemanticsBinding.ensureSemantics].
|
||||||
class SemanticsHandle {
|
class SemanticsHandle {
|
||||||
SemanticsHandle._(this._onDispose) {
|
SemanticsHandle._(this._onDispose) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('semantics', 'SemanticsHandle', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/semantics.dart',
|
|
||||||
className: '$SemanticsHandle',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
final VoidCallback _onDispose;
|
final VoidCallback _onDispose;
|
||||||
@ -246,12 +238,7 @@ class SemanticsHandle {
|
|||||||
/// framework will stop generating semantics information.
|
/// framework will stop generating semantics information.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
|
|
||||||
_onDispose();
|
_onDispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3761,15 +3761,7 @@ class _TraversalSortNode implements Comparable<_TraversalSortNode> {
|
|||||||
class SemanticsOwner extends ChangeNotifier {
|
class SemanticsOwner extends ChangeNotifier {
|
||||||
/// Creates a [SemanticsOwner] that manages zero or more [SemanticsNode] objects.
|
/// Creates a [SemanticsOwner] that manages zero or more [SemanticsNode] objects.
|
||||||
SemanticsOwner({required this.onSemanticsUpdate}) {
|
SemanticsOwner({required this.onSemanticsUpdate}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('semantics', 'SemanticsOwner', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/semantics.dart',
|
|
||||||
className: '$SemanticsOwner',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The [onSemanticsUpdate] callback is expected to dispatch [SemanticsUpdate]s
|
/// The [onSemanticsUpdate] callback is expected to dispatch [SemanticsUpdate]s
|
||||||
@ -3791,9 +3783,7 @@ class SemanticsOwner extends ChangeNotifier {
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_dirtyNodes.clear();
|
_dirtyNodes.clear();
|
||||||
_nodes.clear();
|
_nodes.clear();
|
||||||
_detachedNodes.clear();
|
_detachedNodes.clear();
|
||||||
|
@ -518,9 +518,7 @@ class RestorationBucket {
|
|||||||
_debugOwner = debugOwner;
|
_debugOwner = debugOwner;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('services', 'RestorationBucket', this));
|
||||||
_maybeDispatchObjectCreation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates the root [RestorationBucket] for the provided restoration
|
/// Creates the root [RestorationBucket] for the provided restoration
|
||||||
@ -554,9 +552,7 @@ class RestorationBucket {
|
|||||||
_debugOwner = manager;
|
_debugOwner = manager;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('services', 'RestorationBucket', this));
|
||||||
_maybeDispatchObjectCreation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Creates a child bucket initialized with the data that the provided
|
/// Creates a child bucket initialized with the data that the provided
|
||||||
@ -580,9 +576,7 @@ class RestorationBucket {
|
|||||||
_debugOwner = debugOwner;
|
_debugOwner = debugOwner;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('services', 'RestorationBucket', this));
|
||||||
_maybeDispatchObjectCreation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const String _childrenMapKey = 'c';
|
static const String _childrenMapKey = 'c';
|
||||||
@ -961,19 +955,6 @@ class RestorationBucket {
|
|||||||
_parent?._addChildData(this);
|
_parent?._addChildData(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
/// Dispatches event of object creation to [FlutterMemoryAllocations.instance].
|
|
||||||
void _maybeDispatchObjectCreation() {
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/services.dart',
|
|
||||||
className: '$RestorationBucket',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Deletes the bucket and all the data stored in it from the bucket
|
/// Deletes the bucket and all the data stored in it from the bucket
|
||||||
/// hierarchy.
|
/// hierarchy.
|
||||||
///
|
///
|
||||||
@ -988,11 +969,7 @@ class RestorationBucket {
|
|||||||
/// This method must only be called by the object's owner.
|
/// This method must only be called by the object's owner.
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(_debugAssertNotDisposed());
|
assert(_debugAssertNotDisposed());
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_visitChildren(_dropChild, concurrentModification: true);
|
_visitChildren(_dropChild, concurrentModification: true);
|
||||||
_claimedChildren.clear();
|
_claimedChildren.clear();
|
||||||
_childrenToAdd.clear();
|
_childrenToAdd.clear();
|
||||||
|
@ -76,15 +76,7 @@ class AppLifecycleListener with WidgetsBindingObserver, Diagnosticable {
|
|||||||
this.onStateChange,
|
this.onStateChange,
|
||||||
}) : binding = binding ?? WidgetsBinding.instance,
|
}) : binding = binding ?? WidgetsBinding.instance,
|
||||||
_lifecycleState = (binding ?? WidgetsBinding.instance).lifecycleState {
|
_lifecycleState = (binding ?? WidgetsBinding.instance).lifecycleState {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'AppLifecycleListener', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$AppLifecycleListener',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
this.binding.addObserver(this);
|
this.binding.addObserver(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,11 +178,7 @@ class AppLifecycleListener with WidgetsBindingObserver, Diagnosticable {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
assert(_debugAssertNotDisposed());
|
assert(_debugAssertNotDisposed());
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
binding.removeObserver(this);
|
binding.removeObserver(this);
|
||||||
assert(() {
|
assert(() {
|
||||||
_debugDisposed = true;
|
_debugDisposed = true;
|
||||||
|
@ -29,8 +29,6 @@ const TextStyle _kTextStyle = TextStyle(
|
|||||||
height: 1.0,
|
height: 1.0,
|
||||||
);
|
);
|
||||||
|
|
||||||
const String _flutterWidgetsLibrary = 'package:flutter/widgets.dart';
|
|
||||||
|
|
||||||
/// Where to show a [Banner].
|
/// Where to show a [Banner].
|
||||||
///
|
///
|
||||||
/// The start and end locations are relative to the ambient [Directionality]
|
/// The start and end locations are relative to the ambient [Directionality]
|
||||||
@ -71,15 +69,7 @@ class BannerPainter extends CustomPainter {
|
|||||||
this.textStyle = _kTextStyle,
|
this.textStyle = _kTextStyle,
|
||||||
this.shadow = _kShadow,
|
this.shadow = _kShadow,
|
||||||
}) : super(repaint: PaintingBinding.instance.systemFonts) {
|
}) : super(repaint: PaintingBinding.instance.systemFonts) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'BannerPainter', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterWidgetsLibrary,
|
|
||||||
className: '$BannerPainter',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The message to show in the banner.
|
/// The message to show in the banner.
|
||||||
@ -138,11 +128,7 @@ class BannerPainter extends CustomPainter {
|
|||||||
///
|
///
|
||||||
/// After calling this method, this object is no longer usable.
|
/// After calling this method, this object is no longer usable.
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_textPainter?.dispose();
|
_textPainter?.dispose();
|
||||||
_textPainter = null;
|
_textPainter = null;
|
||||||
}
|
}
|
||||||
|
@ -34,15 +34,7 @@ class DisposableBuildContext<T extends State> {
|
|||||||
_state.mounted,
|
_state.mounted,
|
||||||
'A DisposableBuildContext was given a BuildContext for an Element that is not mounted.',
|
'A DisposableBuildContext was given a BuildContext for an Element that is not mounted.',
|
||||||
) {
|
) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'DisposableBuildContext', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$DisposableBuildContext',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
T? _state;
|
T? _state;
|
||||||
@ -77,11 +69,7 @@ class DisposableBuildContext<T extends State> {
|
|||||||
/// Creators of this object must call [dispose] when their [Element] is
|
/// Creators of this object must call [dispose] when their [Element] is
|
||||||
/// unmounted, i.e. when [State.dispose] is called.
|
/// unmounted, i.e. when [State.dispose] is called.
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_state = null;
|
_state = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -510,15 +510,7 @@ class _DraggableSheetExtent {
|
|||||||
availablePixels = double.infinity,
|
availablePixels = double.infinity,
|
||||||
hasDragged = hasDragged ?? false,
|
hasDragged = hasDragged ?? false,
|
||||||
hasChanged = hasChanged ?? false {
|
hasChanged = hasChanged ?? false {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_DraggableSheetExtent', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_DraggableSheetExtent',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
VoidCallback? _cancelActivity;
|
VoidCallback? _cancelActivity;
|
||||||
@ -615,9 +607,7 @@ class _DraggableSheetExtent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_currentSize.dispose();
|
_currentSize.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2062,15 +2062,7 @@ class FocusManager with DiagnosticableTreeMixin, ChangeNotifier {
|
|||||||
// value, and ChangeNotifier requires using VoidCallback.
|
// value, and ChangeNotifier requires using VoidCallback.
|
||||||
class _HighlightModeManager {
|
class _HighlightModeManager {
|
||||||
_HighlightModeManager() {
|
_HighlightModeManager() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_HighlightModeManager', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_HighlightModeManager',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If null, no interactions have occurred yet and the default highlight mode for the current
|
// If null, no interactions have occurred yet and the default highlight mode for the current
|
||||||
@ -2136,9 +2128,7 @@ class _HighlightModeManager {
|
|||||||
|
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
if (ServicesBinding.instance.keyEventManager.keyMessageHandler == handleKeyMessage) {
|
if (ServicesBinding.instance.keyEventManager.keyMessageHandler == handleKeyMessage) {
|
||||||
GestureBinding.instance.pointerRouter.removeGlobalRoute(handlePointerEvent);
|
GestureBinding.instance.pointerRouter.removeGlobalRoute(handlePointerEvent);
|
||||||
ServicesBinding.instance.keyEventManager.keyMessageHandler = null;
|
ServicesBinding.instance.keyEventManager.keyMessageHandler = null;
|
||||||
|
@ -822,8 +822,6 @@ enum _StateLifecycle {
|
|||||||
/// The signature of [State.setState] functions.
|
/// The signature of [State.setState] functions.
|
||||||
typedef StateSetter = void Function(VoidCallback fn);
|
typedef StateSetter = void Function(VoidCallback fn);
|
||||||
|
|
||||||
const String _flutterWidgetsLibrary = 'package:flutter/widgets.dart';
|
|
||||||
|
|
||||||
/// The logic and internal state for a [StatefulWidget].
|
/// The logic and internal state for a [StatefulWidget].
|
||||||
///
|
///
|
||||||
/// State is information that (1) can be read synchronously when the widget is
|
/// State is information that (1) can be read synchronously when the widget is
|
||||||
@ -1009,13 +1007,7 @@ abstract class State<T extends StatefulWidget> with Diagnosticable {
|
|||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void initState() {
|
void initState() {
|
||||||
assert(_debugLifecycleState == _StateLifecycle.created);
|
assert(_debugLifecycleState == _StateLifecycle.created);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('widgets', 'State', this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterWidgetsLibrary,
|
|
||||||
className: '$State',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Called whenever the widget configuration changes.
|
/// Called whenever the widget configuration changes.
|
||||||
@ -1345,9 +1337,7 @@ abstract class State<T extends StatefulWidget> with Diagnosticable {
|
|||||||
_debugLifecycleState = _StateLifecycle.defunct;
|
_debugLifecycleState = _StateLifecycle.defunct;
|
||||||
return true;
|
return true;
|
||||||
}());
|
}());
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Describes the part of the user interface represented by this widget.
|
/// Describes the part of the user interface represented by this widget.
|
||||||
@ -3513,13 +3503,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
///
|
///
|
||||||
/// Typically called by an override of [Widget.createElement].
|
/// Typically called by an override of [Widget.createElement].
|
||||||
Element(Widget widget) : _widget = widget {
|
Element(Widget widget) : _widget = widget {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('widgets', 'Element', this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterWidgetsLibrary,
|
|
||||||
className: '$Element',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Element? _parent;
|
Element? _parent;
|
||||||
@ -4764,9 +4748,7 @@ abstract class Element extends DiagnosticableTree implements BuildContext {
|
|||||||
assert(_lifecycleState == _ElementLifecycle.inactive);
|
assert(_lifecycleState == _ElementLifecycle.inactive);
|
||||||
assert(_widget != null); // Use the private property to avoid a CastError during hot reload.
|
assert(_widget != null); // Use the private property to avoid a CastError during hot reload.
|
||||||
assert(owner != null);
|
assert(owner != null);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
// Use the private property to avoid a CastError during hot reload.
|
// Use the private property to avoid a CastError during hot reload.
|
||||||
final Key? key = _widget?.key;
|
final Key? key = _widget?.key;
|
||||||
if (key is GlobalKey) {
|
if (key is GlobalKey) {
|
||||||
|
@ -518,15 +518,7 @@ class _HeroFlightManifest {
|
|||||||
// Builds the in-flight hero widget.
|
// Builds the in-flight hero widget.
|
||||||
class _HeroFlight {
|
class _HeroFlight {
|
||||||
_HeroFlight(this.onFlightEnded) {
|
_HeroFlight(this.onFlightEnded) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_HeroFlight', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_HeroFlight',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
_proxyAnimation = ProxyAnimation()..addStatusListener(_handleAnimationUpdate);
|
_proxyAnimation = ProxyAnimation()..addStatusListener(_handleAnimationUpdate);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -633,9 +625,7 @@ class _HeroFlight {
|
|||||||
/// Releases resources.
|
/// Releases resources.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
if (overlayEntry != null) {
|
if (overlayEntry != null) {
|
||||||
overlayEntry!.remove();
|
overlayEntry!.remove();
|
||||||
overlayEntry!.dispose();
|
overlayEntry!.dispose();
|
||||||
@ -824,15 +814,7 @@ class HeroController extends NavigatorObserver {
|
|||||||
/// The [createRectTween] argument is optional. If null, the controller uses a
|
/// The [createRectTween] argument is optional. If null, the controller uses a
|
||||||
/// linear [Tween<Rect>].
|
/// linear [Tween<Rect>].
|
||||||
HeroController({this.createRectTween}) {
|
HeroController({this.createRectTween}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'HeroController', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$HeroController',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Used to create [RectTween]s that interpolate the position of heroes in flight.
|
/// Used to create [RectTween]s that interpolate the position of heroes in flight.
|
||||||
@ -1106,12 +1088,7 @@ class HeroController extends NavigatorObserver {
|
|||||||
/// Releases resources.
|
/// Releases resources.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (final _HeroFlight flight in _flights.values) {
|
for (final _HeroFlight flight in _flights.values) {
|
||||||
flight.dispose();
|
flight.dispose();
|
||||||
}
|
}
|
||||||
|
@ -171,13 +171,7 @@ abstract class Route<T> extends _RoutePlaceholder {
|
|||||||
Route({RouteSettings? settings, bool? requestFocus})
|
Route({RouteSettings? settings, bool? requestFocus})
|
||||||
: _settings = settings ?? const RouteSettings(),
|
: _settings = settings ?? const RouteSettings(),
|
||||||
_requestFocus = requestFocus {
|
_requestFocus = requestFocus {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('widgets', 'Route<T>', this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$Route<$T>',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// When the route state is updated, request focus if the current route is at the top.
|
/// When the route state is updated, request focus if the current route is at the top.
|
||||||
@ -578,9 +572,7 @@ abstract class Route<T> extends _RoutePlaceholder {
|
|||||||
_navigator = null;
|
_navigator = null;
|
||||||
_restorationScopeId.dispose();
|
_restorationScopeId.dispose();
|
||||||
_disposeCompleter.complete();
|
_disposeCompleter.complete();
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Whether this route is the top-most route on the navigator.
|
/// Whether this route is the top-most route on the navigator.
|
||||||
@ -3149,15 +3141,7 @@ class _RouteEntry extends RouteTransitionRecord {
|
|||||||
initialState == _RouteLifecycle.replace,
|
initialState == _RouteLifecycle.replace,
|
||||||
),
|
),
|
||||||
currentState = initialState {
|
currentState = initialState {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_RouteEntry', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_RouteEntry',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
@ -3395,11 +3379,7 @@ class _RouteEntry extends RouteTransitionRecord {
|
|||||||
/// before disposing.
|
/// before disposing.
|
||||||
void forcedDispose() {
|
void forcedDispose() {
|
||||||
assert(currentState.index < _RouteLifecycle.disposed.index);
|
assert(currentState.index < _RouteLifecycle.disposed.index);
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
currentState = _RouteLifecycle.disposed;
|
currentState = _RouteLifecycle.disposed;
|
||||||
route.dispose();
|
route.dispose();
|
||||||
}
|
}
|
||||||
|
@ -618,15 +618,7 @@ class _NestedScrollCoordinator implements ScrollActivityDelegate, ScrollHoldCont
|
|||||||
this._onHasScrolledBodyChanged,
|
this._onHasScrolledBodyChanged,
|
||||||
this._floatHeaderSlivers,
|
this._floatHeaderSlivers,
|
||||||
) {
|
) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_NestedScrollCoordinator', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_NestedScrollCoordinator',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final double initialScrollOffset = _parent?.initialScrollOffset ?? 0.0;
|
final double initialScrollOffset = _parent?.initialScrollOffset ?? 0.0;
|
||||||
_outerController = _NestedScrollController(
|
_outerController = _NestedScrollController(
|
||||||
this,
|
this,
|
||||||
@ -1136,9 +1128,7 @@ class _NestedScrollCoordinator implements ScrollActivityDelegate, ScrollHoldCont
|
|||||||
|
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_currentDrag?.dispose();
|
_currentDrag?.dispose();
|
||||||
_currentDrag = null;
|
_currentDrag = null;
|
||||||
_outerController.dispose();
|
_outerController.dispose();
|
||||||
|
@ -27,8 +27,6 @@ import 'framework.dart';
|
|||||||
import 'lookup_boundary.dart';
|
import 'lookup_boundary.dart';
|
||||||
import 'ticker_provider.dart';
|
import 'ticker_provider.dart';
|
||||||
|
|
||||||
const String _flutterWidgetsLibrary = 'package:flutter/widgets.dart';
|
|
||||||
|
|
||||||
// Examples can assume:
|
// Examples can assume:
|
||||||
// late BuildContext context;
|
// late BuildContext context;
|
||||||
|
|
||||||
@ -98,9 +96,7 @@ class OverlayEntry implements Listenable {
|
|||||||
this.canSizeOverlay = false,
|
this.canSizeOverlay = false,
|
||||||
}) : _opaque = opaque,
|
}) : _opaque = opaque,
|
||||||
_maintainState = maintainState {
|
_maintainState = maintainState {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchCreated('widgets', 'OverlayEntry', this));
|
||||||
_maybeDispatchObjectCreation();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// This entry will include the widget built by this builder in the overlay at
|
/// This entry will include the widget built by this builder in the overlay at
|
||||||
@ -180,19 +176,6 @@ class OverlayEntry implements Listenable {
|
|||||||
ValueNotifier<_OverlayEntryWidgetState?>? _overlayEntryStateNotifier =
|
ValueNotifier<_OverlayEntryWidgetState?>? _overlayEntryStateNotifier =
|
||||||
ValueNotifier<_OverlayEntryWidgetState?>(null);
|
ValueNotifier<_OverlayEntryWidgetState?>(null);
|
||||||
|
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
/// Dispatches event of object creation to [FlutterMemoryAllocations.instance].
|
|
||||||
void _maybeDispatchObjectCreation() {
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: _flutterWidgetsLibrary,
|
|
||||||
className: '$OverlayEntry',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void addListener(VoidCallback listener) {
|
void addListener(VoidCallback listener) {
|
||||||
assert(!_disposedByOwner);
|
assert(!_disposedByOwner);
|
||||||
@ -272,9 +255,7 @@ class OverlayEntry implements Listenable {
|
|||||||
_overlay == null,
|
_overlay == null,
|
||||||
'An OverlayEntry must first be removed from the Overlay before dispose is called.',
|
'An OverlayEntry must first be removed from the Overlay before dispose is called.',
|
||||||
);
|
);
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_disposedByOwner = true;
|
_disposedByOwner = true;
|
||||||
if (!mounted) {
|
if (!mounted) {
|
||||||
// If we're still mounted when disposed, then this will be disposed in
|
// If we're still mounted when disposed, then this will be disposed in
|
||||||
|
@ -1398,15 +1398,7 @@ class _DragInfo extends Drag {
|
|||||||
this.proxyDecorator,
|
this.proxyDecorator,
|
||||||
required this.tickerProvider,
|
required this.tickerProvider,
|
||||||
}) {
|
}) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_DragInfo', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_DragInfo',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
final RenderBox itemRenderBox = item.context.findRenderObject()! as RenderBox;
|
final RenderBox itemRenderBox = item.context.findRenderObject()! as RenderBox;
|
||||||
listState = item._listState;
|
listState = item._listState;
|
||||||
index = item.index;
|
index = item.index;
|
||||||
@ -1449,9 +1441,7 @@ class _DragInfo extends Drag {
|
|||||||
late Offset _rawDragPosition;
|
late Offset _rawDragPosition;
|
||||||
|
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_proxyAnimation?.dispose();
|
_proxyAnimation?.dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,15 +67,7 @@ abstract class ScrollActivityDelegate {
|
|||||||
abstract class ScrollActivity {
|
abstract class ScrollActivity {
|
||||||
/// Initializes [delegate] for subclasses.
|
/// Initializes [delegate] for subclasses.
|
||||||
ScrollActivity(this._delegate) {
|
ScrollActivity(this._delegate) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'ScrollActivity', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$ScrollActivity',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The delegate that this activity will use to actuate the scroll view.
|
/// The delegate that this activity will use to actuate the scroll view.
|
||||||
@ -172,12 +164,7 @@ abstract class ScrollActivity {
|
|||||||
/// Called when the scroll view stops performing this activity.
|
/// Called when the scroll view stops performing this activity.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
|
|
||||||
_isDisposed = true;
|
_isDisposed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -285,15 +272,7 @@ class ScrollDragController implements Drag {
|
|||||||
_lastNonStationaryTimestamp = details.sourceTimeStamp,
|
_lastNonStationaryTimestamp = details.sourceTimeStamp,
|
||||||
_kind = details.kind,
|
_kind = details.kind,
|
||||||
_offsetSinceLastStop = motionStartDistanceThreshold == null ? null : 0.0 {
|
_offsetSinceLastStop = motionStartDistanceThreshold == null ? null : 0.0 {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'ScrollDragController', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$ScrollDragController',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// The object that will actuate the scroll view as the user drags.
|
/// The object that will actuate the scroll view as the user drags.
|
||||||
@ -470,11 +449,7 @@ class ScrollDragController implements Drag {
|
|||||||
/// Called by the delegate when it is no longer sending events to this object.
|
/// Called by the delegate when it is no longer sending events to this object.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_lastDetails = null;
|
_lastDetails = null;
|
||||||
onDragCanceled?.call();
|
onDragCanceled?.call();
|
||||||
}
|
}
|
||||||
|
@ -348,15 +348,7 @@ class TextSelectionOverlay {
|
|||||||
required TextMagnifierConfiguration magnifierConfiguration,
|
required TextMagnifierConfiguration magnifierConfiguration,
|
||||||
}) : _handlesVisible = handlesVisible,
|
}) : _handlesVisible = handlesVisible,
|
||||||
_value = value {
|
_value = value {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'TextSelectionOverlay', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$TextSelectionOverlay',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
renderObject.selectionStartInViewport.addListener(_updateTextSelectionOverlayVisibilities);
|
renderObject.selectionStartInViewport.addListener(_updateTextSelectionOverlayVisibilities);
|
||||||
renderObject.selectionEndInViewport.addListener(_updateTextSelectionOverlayVisibilities);
|
renderObject.selectionEndInViewport.addListener(_updateTextSelectionOverlayVisibilities);
|
||||||
_updateTextSelectionOverlayVisibilities();
|
_updateTextSelectionOverlayVisibilities();
|
||||||
@ -607,11 +599,7 @@ class TextSelectionOverlay {
|
|||||||
|
|
||||||
/// {@macro flutter.widgets.SelectionOverlay.dispose}
|
/// {@macro flutter.widgets.SelectionOverlay.dispose}
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
_selectionOverlay.dispose();
|
_selectionOverlay.dispose();
|
||||||
renderObject.selectionStartInViewport.removeListener(_updateTextSelectionOverlayVisibilities);
|
renderObject.selectionStartInViewport.removeListener(_updateTextSelectionOverlayVisibilities);
|
||||||
renderObject.selectionEndInViewport.removeListener(_updateTextSelectionOverlayVisibilities);
|
renderObject.selectionEndInViewport.removeListener(_updateTextSelectionOverlayVisibilities);
|
||||||
@ -1050,15 +1038,7 @@ class SelectionOverlay {
|
|||||||
_selectionEndpoints = selectionEndpoints,
|
_selectionEndpoints = selectionEndpoints,
|
||||||
_toolbarLocation = toolbarLocation,
|
_toolbarLocation = toolbarLocation,
|
||||||
assert(debugCheckHasOverlay(context)) {
|
assert(debugCheckHasOverlay(context)) {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', 'SelectionOverlay', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$SelectionOverlay',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// {@macro flutter.widgets.SelectionOverlay.context}
|
/// {@macro flutter.widgets.SelectionOverlay.context}
|
||||||
@ -1619,11 +1599,7 @@ class SelectionOverlay {
|
|||||||
/// Disposes this object and release resources.
|
/// Disposes this object and release resources.
|
||||||
/// {@endtemplate}
|
/// {@endtemplate}
|
||||||
void dispose() {
|
void dispose() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
hide();
|
hide();
|
||||||
_magnifierInfo.dispose();
|
_magnifierInfo.dispose();
|
||||||
}
|
}
|
||||||
|
@ -357,15 +357,7 @@ class _ScreenshotContainerLayer extends OffsetLayer {
|
|||||||
/// a screenshot.
|
/// a screenshot.
|
||||||
class _ScreenshotData {
|
class _ScreenshotData {
|
||||||
_ScreenshotData({required this.target}) : containerLayer = _ScreenshotContainerLayer() {
|
_ScreenshotData({required this.target}) : containerLayer = _ScreenshotContainerLayer() {
|
||||||
// TODO(polina-c): stop duplicating code across disposables
|
assert(debugMaybeDispatchCreated('widgets', '_ScreenshotData', this));
|
||||||
// https://github.com/flutter/flutter/issues/137435
|
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
|
||||||
library: 'package:flutter/widgets.dart',
|
|
||||||
className: '$_ScreenshotData',
|
|
||||||
object: this,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Target to take a screenshot of.
|
/// Target to take a screenshot of.
|
||||||
@ -407,9 +399,7 @@ class _ScreenshotData {
|
|||||||
/// Releases allocated resources.
|
/// Releases allocated resources.
|
||||||
@mustCallSuper
|
@mustCallSuper
|
||||||
void dispose() {
|
void dispose() {
|
||||||
if (kFlutterMemoryAllocationsEnabled) {
|
assert(debugMaybeDispatchDisposed(this));
|
||||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
|
||||||
}
|
|
||||||
containerLayer.dispose();
|
containerLayer.dispose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user