Revert "[mob][photos] Revert back to FlutterIsolate"

This reverts commit c4a6011621.
This commit is contained in:
laurenspriem 2024-05-23 16:35:45 +05:30
parent 63653411b8
commit cc8e345a17
4 changed files with 15 additions and 15 deletions

View file

@ -7,8 +7,8 @@ import "dart:typed_data" show Uint8List, Float32List, ByteData;
import "dart:ui" show Image; import "dart:ui" show Image;
import "package:computer/computer.dart"; import "package:computer/computer.dart";
import "package:dart_ui_isolate/dart_ui_isolate.dart";
import "package:flutter/foundation.dart" show debugPrint, kDebugMode; import "package:flutter/foundation.dart" show debugPrint, kDebugMode;
import "package:flutter_isolate/flutter_isolate.dart";
import "package:logging/logging.dart"; import "package:logging/logging.dart";
import "package:onnxruntime/onnxruntime.dart"; import "package:onnxruntime/onnxruntime.dart";
import "package:package_info_plus/package_info_plus.dart"; import "package:package_info_plus/package_info_plus.dart";
@ -69,7 +69,7 @@ class FaceMlService {
final Duration _inactivityDuration = const Duration(seconds: 120); final Duration _inactivityDuration = const Duration(seconds: 120);
int _activeTasks = 0; int _activeTasks = 0;
final _initLockIsolate = Lock(); final _initLockIsolate = Lock();
late FlutterIsolate _isolate; late DartUiIsolate _isolate;
late ReceivePort _receivePort = ReceivePort(); late ReceivePort _receivePort = ReceivePort();
late SendPort _mainSendPort; late SendPort _mainSendPort;
@ -224,7 +224,7 @@ class FaceMlService {
_receivePort = ReceivePort(); _receivePort = ReceivePort();
try { try {
_isolate = await FlutterIsolate.spawn( _isolate = await DartUiIsolate.spawn(
_isolateMain, _isolateMain,
_receivePort.sendPort, _receivePort.sendPort,
); );

View file

@ -4,7 +4,7 @@ import 'dart:isolate';
import 'dart:typed_data' show Float32List, Uint8List; import 'dart:typed_data' show Float32List, Uint8List;
import 'dart:ui'; import 'dart:ui';
import "package:flutter_isolate/flutter_isolate.dart"; import "package:dart_ui_isolate/dart_ui_isolate.dart";
import "package:logging/logging.dart"; import "package:logging/logging.dart";
import "package:photos/face/model/box.dart"; import "package:photos/face/model/box.dart";
import "package:photos/face/model/dimension.dart"; import "package:photos/face/model/dimension.dart";
@ -45,7 +45,7 @@ class ImageMlIsolate {
final _initLock = Lock(); final _initLock = Lock();
final _functionLock = Lock(); final _functionLock = Lock();
late FlutterIsolate _isolate; late DartUiIsolate _isolate;
late ReceivePort _receivePort = ReceivePort(); late ReceivePort _receivePort = ReceivePort();
late SendPort _mainSendPort; late SendPort _mainSendPort;
@ -69,7 +69,7 @@ class ImageMlIsolate {
_receivePort = ReceivePort(); _receivePort = ReceivePort();
try { try {
_isolate = await FlutterIsolate.spawn( _isolate = await DartUiIsolate.spawn(
_isolateMain, _isolateMain,
_receivePort.sendPort, _receivePort.sendPort,
); );

View file

@ -363,6 +363,14 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "2.3.2" version: "2.3.2"
dart_ui_isolate:
dependency: "direct main"
description:
name: dart_ui_isolate
sha256: bd531558002a00de0ac7dd73c84887dd01e652bd254d3098d7763881535196d7
url: "https://pub.dev"
source: hosted
version: "1.1.1"
dbus: dbus:
dependency: transitive dependency: transitive
description: description:
@ -707,14 +715,6 @@ packages:
url: "https://pub.dev" url: "https://pub.dev"
source: hosted source: hosted
version: "5.8.0" version: "5.8.0"
flutter_isolate:
dependency: "direct main"
description:
name: flutter_isolate
sha256: "994ddec596da4ca12ca52154fd59404077584643eb7e3f1008a55fda9fe0b76b"
url: "https://pub.dev"
source: hosted
version: "2.0.4"
flutter_launcher_icons: flutter_launcher_icons:
dependency: "direct main" dependency: "direct main"
description: description:

View file

@ -40,6 +40,7 @@ dependencies:
cross_file: ^0.3.3 cross_file: ^0.3.3
crypto: ^3.0.2 crypto: ^3.0.2
cupertino_icons: ^1.0.0 cupertino_icons: ^1.0.0
dart_ui_isolate: ^1.1.1
defer_pointer: ^0.0.2 defer_pointer: ^0.0.2
device_info_plus: ^9.0.3 device_info_plus: ^9.0.3
dio: ^4.0.6 dio: ^4.0.6
@ -78,7 +79,6 @@ dependencies:
flutter_email_sender: ^5.2.0 flutter_email_sender: ^5.2.0
flutter_image_compress: ^1.1.0 flutter_image_compress: ^1.1.0
flutter_inappwebview: ^5.8.0 flutter_inappwebview: ^5.8.0
flutter_isolate: ^2.0.4
flutter_launcher_icons: ^0.13.1 flutter_launcher_icons: ^0.13.1
flutter_local_notifications: ^17.0.0 flutter_local_notifications: ^17.0.0
flutter_localizations: flutter_localizations: