Commit b7ababe6 authored by Todd Volkert's avatar Todd Volkert Committed by GitHub

Remove unused DevFsProgressReporter (#11249)

Discovered dead code during review of #10791
parent 5756d629
...@@ -16,8 +16,6 @@ import 'dart/package_map.dart'; ...@@ -16,8 +16,6 @@ import 'dart/package_map.dart';
import 'globals.dart'; import 'globals.dart';
import 'vmservice.dart'; import 'vmservice.dart';
typedef void DevFSProgressReporter(int progress, int max);
class DevFSConfig { class DevFSConfig {
/// Should DevFS assume that symlink targets are stable? /// Should DevFS assume that symlink targets are stable?
bool cacheSymlinks = false; bool cacheSymlinks = false;
...@@ -240,23 +238,18 @@ class _DevFSHttpWriter { ...@@ -240,23 +238,18 @@ class _DevFSHttpWriter {
Map<Uri, DevFSContent> _outstanding; Map<Uri, DevFSContent> _outstanding;
Completer<Null> _completer; Completer<Null> _completer;
HttpClient _client; HttpClient _client;
int _done;
int _max;
Future<Null> write(Map<Uri, DevFSContent> entries, Future<Null> write(Map<Uri, DevFSContent> entries) async {
{DevFSProgressReporter progressReporter}) async {
_client = new HttpClient(); _client = new HttpClient();
_client.maxConnectionsPerHost = kMaxInFlight; _client.maxConnectionsPerHost = kMaxInFlight;
_completer = new Completer<Null>(); _completer = new Completer<Null>();
_outstanding = new Map<Uri, DevFSContent>.from(entries); _outstanding = new Map<Uri, DevFSContent>.from(entries);
_done = 0; _scheduleWrites();
_max = _outstanding.length;
_scheduleWrites(progressReporter);
await _completer.future; await _completer.future;
_client.close(); _client.close();
} }
void _scheduleWrites(DevFSProgressReporter progressReporter) { void _scheduleWrites() {
while (_inFlight < kMaxInFlight) { while (_inFlight < kMaxInFlight) {
if (_outstanding.isEmpty) { if (_outstanding.isEmpty) {
// Finished. // Finished.
...@@ -264,15 +257,14 @@ class _DevFSHttpWriter { ...@@ -264,15 +257,14 @@ class _DevFSHttpWriter {
} }
final Uri deviceUri = _outstanding.keys.first; final Uri deviceUri = _outstanding.keys.first;
final DevFSContent content = _outstanding.remove(deviceUri); final DevFSContent content = _outstanding.remove(deviceUri);
_scheduleWrite(deviceUri, content, progressReporter); _scheduleWrite(deviceUri, content);
_inFlight++; _inFlight++;
} }
} }
Future<Null> _scheduleWrite( Future<Null> _scheduleWrite(
Uri deviceUri, Uri deviceUri,
DevFSContent content, DevFSContent content, [
DevFSProgressReporter progressReporter, [
int retry = 0, int retry = 0,
]) async { ]) async {
try { try {
...@@ -293,21 +285,17 @@ class _DevFSHttpWriter { ...@@ -293,21 +285,17 @@ class _DevFSHttpWriter {
} catch (e) { } catch (e) {
if (retry < kMaxRetries) { if (retry < kMaxRetries) {
printTrace('Retrying writing "$deviceUri" to DevFS due to error: $e'); printTrace('Retrying writing "$deviceUri" to DevFS due to error: $e');
_scheduleWrite(deviceUri, content, progressReporter, retry + 1); _scheduleWrite(deviceUri, content, retry + 1);
return; return;
} else { } else {
printError('Error writing "$deviceUri" to DevFS: $e'); printError('Error writing "$deviceUri" to DevFS: $e');
} }
} }
if (progressReporter != null) {
_done++;
progressReporter(_done, _max);
}
_inFlight--; _inFlight--;
if ((_outstanding.isEmpty) && (_inFlight == 0)) { if ((_outstanding.isEmpty) && (_inFlight == 0)) {
_completer.complete(null); _completer.complete(null);
} else { } else {
_scheduleWrites(progressReporter); _scheduleWrites();
} }
} }
} }
...@@ -372,10 +360,11 @@ class DevFS { ...@@ -372,10 +360,11 @@ class DevFS {
} }
/// Update files on the device and return the number of bytes sync'd /// Update files on the device and return the number of bytes sync'd
Future<int> update({ DevFSProgressReporter progressReporter, Future<int> update({
AssetBundle bundle, AssetBundle bundle,
bool bundleDirty: false, bool bundleDirty: false,
Set<String> fileFilter}) async { Set<String> fileFilter,
}) async {
// Mark all entries as possibly deleted. // Mark all entries as possibly deleted.
for (DevFSContent content in _entries.values) { for (DevFSContent content in _entries.values) {
content._exists = false; content._exists = false;
...@@ -440,8 +429,7 @@ class DevFS { ...@@ -440,8 +429,7 @@ class DevFS {
printTrace('Updating files'); printTrace('Updating files');
if (_httpWriter != null) { if (_httpWriter != null) {
try { try {
await _httpWriter.write(dirtyEntries, await _httpWriter.write(dirtyEntries);
progressReporter: progressReporter);
} on SocketException catch (socketException, stackTrace) { } on SocketException catch (socketException, stackTrace) {
printTrace("DevFS sync failed. Lost connection to device: $socketException"); printTrace("DevFS sync failed. Lost connection to device: $socketException");
throw new DevFSException('Lost connection to device.', socketException, stackTrace); throw new DevFSException('Lost connection to device.', socketException, stackTrace);
...@@ -457,17 +445,6 @@ class DevFS { ...@@ -457,17 +445,6 @@ class DevFS {
if (operation != null) if (operation != null)
_pendingOperations.add(operation); _pendingOperations.add(operation);
}); });
if (progressReporter != null) {
final int max = _pendingOperations.length;
int complete = 0;
_pendingOperations.forEach((Future<dynamic> f) => f.whenComplete(() {
// TODO(ianh): If one of the pending operations fail, we'll keep
// calling progressReporter long after update() has completed its
// future, assuming that doesn't crash the app.
complete += 1;
progressReporter(complete, max);
}));
}
await Future.wait(_pendingOperations, eagerError: true); await Future.wait(_pendingOperations, eagerError: true);
_pendingOperations.clear(); _pendingOperations.clear();
} }
......
...@@ -314,7 +314,6 @@ class FlutterDevice { ...@@ -314,7 +314,6 @@ class FlutterDevice {
} }
Future<bool> updateDevFS({ Future<bool> updateDevFS({
DevFSProgressReporter progressReporter,
AssetBundle bundle, AssetBundle bundle,
bool bundleDirty: false, bool bundleDirty: false,
Set<String> fileFilter Set<String> fileFilter
...@@ -326,7 +325,6 @@ class FlutterDevice { ...@@ -326,7 +325,6 @@ class FlutterDevice {
int bytes = 0; int bytes = 0;
try { try {
bytes = await devFS.update( bytes = await devFS.update(
progressReporter: progressReporter,
bundle: bundle, bundle: bundle,
bundleDirty: bundleDirty, bundleDirty: bundleDirty,
fileFilter: fileFilter fileFilter: fileFilter
......
...@@ -12,7 +12,6 @@ import 'base/logger.dart'; ...@@ -12,7 +12,6 @@ import 'base/logger.dart';
import 'base/utils.dart'; import 'base/utils.dart';
import 'build_info.dart'; import 'build_info.dart';
import 'dart/dependencies.dart'; import 'dart/dependencies.dart';
import 'devfs.dart';
import 'device.dart'; import 'device.dart';
import 'globals.dart'; import 'globals.dart';
import 'resident_runner.dart'; import 'resident_runner.dart';
...@@ -223,7 +222,7 @@ class HotRunner extends ResidentRunner { ...@@ -223,7 +222,7 @@ class HotRunner extends ResidentRunner {
return devFSUris; return devFSUris;
} }
Future<bool> _updateDevFS({ DevFSProgressReporter progressReporter }) async { Future<bool> _updateDevFS() async {
if (!_refreshDartDependencies()) { if (!_refreshDartDependencies()) {
// Did not update DevFS because of a Dart source error. // Did not update DevFS because of a Dart source error.
return false; return false;
...@@ -238,7 +237,6 @@ class HotRunner extends ResidentRunner { ...@@ -238,7 +237,6 @@ class HotRunner extends ResidentRunner {
for (FlutterDevice device in flutterDevices) { for (FlutterDevice device in flutterDevices) {
final bool result = await device.updateDevFS( final bool result = await device.updateDevFS(
progressReporter: progressReporter,
bundle: assetBundle, bundle: assetBundle,
bundleDirty: rebuildBundle, bundleDirty: rebuildBundle,
fileFilter: _dartDependencies, fileFilter: _dartDependencies,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment