leak tracking setup
This commit is contained in:
parent
8de8d26756
commit
3a63533dd9
15 changed files with 45 additions and 30 deletions
|
@ -13,6 +13,7 @@ import 'package:aves/utils/time_utils.dart';
|
|||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:aves_utils/aves_utils.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
enum EntryDataType { basic, aspectRatio, catalog, address, references }
|
||||
|
||||
|
@ -72,7 +73,7 @@ class AvesEntry with AvesEntryBase {
|
|||
this.stackedEntries,
|
||||
}) : id = id ?? 0 {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$AvesEntry',
|
||||
object: this,
|
||||
|
@ -188,7 +189,7 @@ class AvesEntry with AvesEntryBase {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
visualChangeNotifier.dispose();
|
||||
metadataChangeNotifier.dispose();
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:aves/ref/mime_types.dart';
|
|||
import 'package:aves/services/common/services.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class MultiPageInfo {
|
||||
final AvesEntry mainEntry;
|
||||
|
@ -18,7 +19,7 @@ class MultiPageInfo {
|
|||
required List<SinglePageInfo> pages,
|
||||
}) : _pages = pages {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$MultiPageInfo',
|
||||
object: this,
|
||||
|
@ -44,7 +45,7 @@ class MultiPageInfo {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_transientEntries.forEach((entry) => entry.dispose());
|
||||
}
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class AnalysisController {
|
||||
final bool canStartService, force;
|
||||
|
@ -15,7 +16,7 @@ class AnalysisController {
|
|||
this.progressOffset = 0,
|
||||
}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$AnalysisController',
|
||||
object: this,
|
||||
|
@ -25,7 +26,7 @@ class AnalysisController {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_stopSignal.dispose();
|
||||
}
|
||||
|
|
|
@ -30,6 +30,7 @@ import 'package:aves_model/aves_model.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:event_bus/event_bus.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
enum SourceScope { none, album, full }
|
||||
|
||||
|
@ -64,7 +65,7 @@ mixin SourceBase {
|
|||
abstract class CollectionSource with SourceBase, AlbumMixin, CountryMixin, PlaceMixin, StateMixin, LocationMixin, TagMixin, TrashMixin {
|
||||
CollectionSource() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$CollectionSource',
|
||||
object: this,
|
||||
|
@ -88,7 +89,7 @@ abstract class CollectionSource with SourceBase, AlbumMixin, CountryMixin, Place
|
|||
@mustCallSuper
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_rawEntries.forEach((v) => v.dispose());
|
||||
}
|
||||
|
|
|
@ -13,6 +13,7 @@ import 'package:aves_model/aves_model.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
import 'package:permission_handler/permission_handler.dart';
|
||||
|
||||
class AnalysisService {
|
||||
|
@ -99,7 +100,7 @@ class Analyzer with WidgetsBindingObserver {
|
|||
Analyzer() {
|
||||
debugPrint('$runtimeType create');
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$Analyzer',
|
||||
object: this,
|
||||
|
@ -113,7 +114,7 @@ class Analyzer with WidgetsBindingObserver {
|
|||
void dispose() {
|
||||
debugPrint('$runtimeType dispose');
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_stopUpdateTimer();
|
||||
_controller?.dispose();
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:aves/widgets/common/search/route.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
abstract class AvesSearchDelegate extends SearchDelegate {
|
||||
|
@ -21,7 +22,7 @@ abstract class AvesSearchDelegate extends SearchDelegate {
|
|||
required super.searchFieldStyle,
|
||||
}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$AvesSearchDelegate',
|
||||
object: this,
|
||||
|
@ -137,7 +138,7 @@ abstract class AvesSearchDelegate extends SearchDelegate {
|
|||
@mustCallSuper
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
currentBodyNotifier.dispose();
|
||||
queryTextController.dispose();
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:aves/model/settings/settings.dart';
|
|||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/scheduler.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class TileExtentController {
|
||||
final String settingsRouteKey;
|
||||
|
@ -28,7 +29,7 @@ class TileExtentController {
|
|||
required this.horizontalPadding,
|
||||
}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$TileExtentController',
|
||||
object: this,
|
||||
|
@ -42,7 +43,7 @@ class TileExtentController {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_subscriptions
|
||||
..forEach((sub) => sub.cancel())
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:aves/widgets/editor/transform/crop_region.dart';
|
|||
import 'package:aves/widgets/editor/transform/transformation.dart';
|
||||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class TransformController {
|
||||
ValueNotifier<CropAspectRatio> aspectRatioNotifier = ValueNotifier(CropAspectRatio.free);
|
||||
|
@ -34,7 +35,7 @@ class TransformController {
|
|||
|
||||
TransformController(this.displaySize) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$TransformController',
|
||||
object: this,
|
||||
|
@ -46,7 +47,7 @@ class TransformController {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
aspectRatioNotifier.dispose();
|
||||
}
|
||||
|
|
|
@ -25,6 +25,7 @@ import 'package:aves_video/aves_video.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
|
||||
class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMixin {
|
||||
|
@ -35,7 +36,7 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
|||
required this.collection,
|
||||
}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$VideoActionDelegate',
|
||||
object: this,
|
||||
|
@ -45,7 +46,7 @@ class VideoActionDelegate with FeedbackMixin, PermissionAwareMixin, SizeAwareMix
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
stopOverlayHidingTimer();
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ import 'package:aves_magnifier/aves_magnifier.dart';
|
|||
import 'package:aves_model/aves_model.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class ViewerController with CastMixin {
|
||||
final ValueNotifier<AvesEntry?> entryNotifier = ValueNotifier(null);
|
||||
|
@ -51,7 +52,7 @@ class ViewerController with CastMixin {
|
|||
this.autopilotAnimatedZoom = false,
|
||||
}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$ViewerController',
|
||||
object: this,
|
||||
|
@ -66,7 +67,7 @@ class ViewerController with CastMixin {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
entryNotifier.removeListener(_onEntryChanged);
|
||||
windowService.setHdrColorMode(false);
|
||||
|
|
|
@ -4,6 +4,7 @@ import 'package:aves/model/entry/entry.dart';
|
|||
import 'package:aves/widgets/viewer/multipage/controller.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class MultiPageConductor {
|
||||
final List<MultiPageController> _controllers = [];
|
||||
|
@ -12,7 +13,7 @@ class MultiPageConductor {
|
|||
|
||||
MultiPageConductor() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$MultiPageConductor',
|
||||
object: this,
|
||||
|
@ -22,7 +23,7 @@ class MultiPageConductor {
|
|||
|
||||
Future<void> dispose() async {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
await _disposeAll();
|
||||
_controllers.clear();
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:aves/model/entry/entry.dart';
|
|||
import 'package:aves/model/entry/extensions/multipage.dart';
|
||||
import 'package:aves/model/multipage.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class MultiPageController {
|
||||
final AvesEntry entry;
|
||||
|
@ -25,7 +26,7 @@ class MultiPageController {
|
|||
|
||||
MultiPageController(this.entry) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$MultiPageController',
|
||||
object: this,
|
||||
|
@ -48,7 +49,7 @@ class MultiPageController {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_info?.dispose();
|
||||
_disposed = true;
|
||||
|
|
|
@ -10,6 +10,7 @@ import 'package:aves_model/aves_model.dart';
|
|||
import 'package:aves_video/aves_video.dart';
|
||||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class VideoConductor {
|
||||
final CollectionLens? _collection;
|
||||
|
@ -21,7 +22,7 @@ class VideoConductor {
|
|||
|
||||
VideoConductor({CollectionLens? collection}) : _collection = collection {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$VideoConductor',
|
||||
object: this,
|
||||
|
@ -31,7 +32,7 @@ class VideoConductor {
|
|||
|
||||
Future<void> dispose() async {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_subscriptions
|
||||
..forEach((sub) => sub.cancel())
|
||||
|
|
|
@ -5,6 +5,7 @@ import 'package:aves_magnifier/aves_magnifier.dart';
|
|||
import 'package:collection/collection.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/rendering.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class ViewStateConductor {
|
||||
final List<ViewStateController> _controllers = [];
|
||||
|
@ -14,7 +15,7 @@ class ViewStateConductor {
|
|||
|
||||
ViewStateConductor() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$ViewStateConductor',
|
||||
object: this,
|
||||
|
@ -24,7 +25,7 @@ class ViewStateConductor {
|
|||
|
||||
Future<void> dispose() async {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
_controllers.forEach((v) => v.dispose());
|
||||
_controllers.clear();
|
||||
|
|
|
@ -3,6 +3,7 @@ import 'package:aves/model/viewer/view_state.dart';
|
|||
import 'package:aves/widgets/viewer/view/histogram.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:leak_tracker/leak_tracker.dart';
|
||||
|
||||
class ViewStateController with HistogramMixin {
|
||||
final AvesEntry entry;
|
||||
|
@ -16,7 +17,7 @@ class ViewStateController with HistogramMixin {
|
|||
required this.viewStateNotifier,
|
||||
}) {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectCreated(
|
||||
LeakTracking.dispatchObjectCreated(
|
||||
library: 'aves',
|
||||
className: '$ViewStateController',
|
||||
object: this,
|
||||
|
@ -26,7 +27,7 @@ class ViewStateController with HistogramMixin {
|
|||
|
||||
void dispose() {
|
||||
if (kFlutterMemoryAllocationsEnabled) {
|
||||
FlutterMemoryAllocations.instance.dispatchObjectDisposed(object: this);
|
||||
LeakTracking.dispatchObjectDisposed(object: this);
|
||||
}
|
||||
viewStateNotifier.dispose();
|
||||
fullImageNotifier.dispose();
|
||||
|
|
Loading…
Reference in a new issue