Unverified Commit 3a51bcb5 authored by Jonah Williams's avatar Jonah Williams Committed by GitHub

[flutter_tools] delete code related to reload method (#67279)

This functionality ultimately became the single widget reload optimization, which did not require a separate service protocol.
parent 21bb29cc
...@@ -108,15 +108,9 @@ The `restart()` restarts the given application. It returns a Map of `{ int code, ...@@ -108,15 +108,9 @@ The `restart()` restarts the given application. It returns a Map of `{ int code,
- `pause`: optional; when doing a hot restart the isolate should enter a paused mode - `pause`: optional; when doing a hot restart the isolate should enter a paused mode
- `debounce`: optional; whether to automatically debounce multiple requests sent in quick succession (this may introduce a short delay in processing the request) - `debounce`: optional; whether to automatically debounce multiple requests sent in quick succession (this may introduce a short delay in processing the request)
#### app.reloadMethod #### app.reloadMethod (Removed)
Performs a limited hot restart which does not sync assets and only marks elements as dirty, instead of reassembling the full application. A `code` of `0` indicates success, and non-zero indicates a failure. This functionality was deprecated and removed after Flutter version 1.23.0
- `appId`: the id of a previously started app; this is required.
- `library`: the absolute file URI of the library to be updated; this is required.
- `class`: the name of the StatelessWidget that was updated, or the StatefulWidget
corresponding to the updated State class; this is required.
- `debounce`: optional; whether to automatically debounce multiple requests sent in quick succession (this may introduce a short delay in processing the request)
#### app.callServiceExtension #### app.callServiceExtension
......
...@@ -423,7 +423,6 @@ typedef _RunOrAttach = Future<void> Function({ ...@@ -423,7 +423,6 @@ typedef _RunOrAttach = Future<void> Function({
class AppDomain extends Domain { class AppDomain extends Domain {
AppDomain(Daemon daemon) : super(daemon, 'app') { AppDomain(Daemon daemon) : super(daemon, 'app') {
registerHandler('restart', restart); registerHandler('restart', restart);
registerHandler('reloadMethod', reloadMethod);
registerHandler('callServiceExtension', callServiceExtension); registerHandler('callServiceExtension', callServiceExtension);
registerHandler('stop', stop); registerHandler('stop', stop);
registerHandler('detach', detach); registerHandler('detach', detach);
...@@ -638,28 +637,6 @@ class AppDomain extends Domain { ...@@ -638,28 +637,6 @@ class AppDomain extends Domain {
); );
} }
Future<OperationResult> reloadMethod(Map<String, dynamic> args) async {
final String appId = _getStringArg(args, 'appId', required: true);
final String classId = _getStringArg(args, 'class', required: true);
final String libraryId = _getStringArg(args, 'library', required: true);
final bool debounce = _getBoolArg(args, 'debounce') ?? false;
final AppInstance app = _getApp(appId);
if (app == null) {
throw "app '$appId' not found";
}
return _queueAndDebounceReloadAction(
app,
OperationType.reloadMethod,
debounce,
null,
() {
return app.reloadMethod(classId: classId, libraryId: libraryId);
},
);
}
/// Debounce and queue reload actions. /// Debounce and queue reload actions.
/// ///
/// Only one reload action will run at a time. Actions requested in quick /// Only one reload action will run at a time. Actions requested in quick
...@@ -1094,10 +1071,6 @@ class AppInstance { ...@@ -1094,10 +1071,6 @@ class AppInstance {
return runner.restart(fullRestart: fullRestart, pause: pause, reason: reason); return runner.restart(fullRestart: fullRestart, pause: pause, reason: reason);
} }
Future<OperationResult> reloadMethod({ String classId, String libraryId }) {
return runner.reloadMethod(classId: classId, libraryId: libraryId);
}
Future<void> stop() => runner.exit(); Future<void> stop() => runner.exit();
Future<void> detach() => runner.detach(); Future<void> detach() => runner.detach();
...@@ -1353,7 +1326,6 @@ class LaunchMode { ...@@ -1353,7 +1326,6 @@ class LaunchMode {
} }
enum OperationType { enum OperationType {
reloadMethod,
reload, reload,
restart restart
} }
......
...@@ -210,7 +210,6 @@ class FlutterDevice { ...@@ -210,7 +210,6 @@ class FlutterDevice {
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
int hostVmServicePort, int hostVmServicePort,
...@@ -259,7 +258,6 @@ class FlutterDevice { ...@@ -259,7 +258,6 @@ class FlutterDevice {
reloadSources: reloadSources, reloadSources: reloadSources,
restart: restart, restart: restart,
compileExpression: compileExpression, compileExpression: compileExpression,
reloadMethod: reloadMethod,
getSkSLMethod: getSkSLMethod, getSkSLMethod: getSkSLMethod,
printStructuredErrorLogMethod: printStructuredErrorLogMethod, printStructuredErrorLogMethod: printStructuredErrorLogMethod,
device: device, device: device,
...@@ -951,22 +949,6 @@ abstract class ResidentRunner { ...@@ -951,22 +949,6 @@ abstract class ResidentRunner {
return sharedSkSlWriter(device, data); return sharedSkSlWriter(device, data);
} }
/// The resident runner API for interaction with the reloadMethod vmservice
/// request.
///
/// This API should only be called for UI only-changes spanning a single
/// library/Widget.
///
/// The value [classId] should be the identifier of the StatelessWidget that
/// was invalidated, or the StatefulWidget for the corresponding State class
/// that was invalidated. This must be provided.
///
/// The value [libraryId] should be the absolute file URI for the containing
/// library of the widget that was invalidated. This must be provided.
Future<OperationResult> reloadMethod({ String classId, String libraryId }) {
throw UnsupportedError('Method is not supported.');
}
@protected @protected
void writeVmserviceFile() { void writeVmserviceFile() {
if (debuggingOptions.vmserviceOutFile != null) { if (debuggingOptions.vmserviceOutFile != null) {
...@@ -1259,7 +1241,6 @@ abstract class ResidentRunner { ...@@ -1259,7 +1241,6 @@ abstract class ResidentRunner {
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
}) async { }) async {
if (!debuggingOptions.debuggingEnabled) { if (!debuggingOptions.debuggingEnabled) {
...@@ -1275,7 +1256,6 @@ abstract class ResidentRunner { ...@@ -1275,7 +1256,6 @@ abstract class ResidentRunner {
disableDds: debuggingOptions.disableDds, disableDds: debuggingOptions.disableDds,
ddsPort: debuggingOptions.ddsPort, ddsPort: debuggingOptions.ddsPort,
hostVmServicePort: debuggingOptions.hostVmServicePort, hostVmServicePort: debuggingOptions.hostVmServicePort,
reloadMethod: reloadMethod,
getSkSLMethod: getSkSLMethod, getSkSLMethod: getSkSLMethod,
printStructuredErrorLogMethod: printStructuredErrorLog, printStructuredErrorLogMethod: printStructuredErrorLog,
ipv6: ipv6, ipv6: ipv6,
......
...@@ -167,19 +167,6 @@ class HotRunner extends ResidentRunner { ...@@ -167,19 +167,6 @@ class HotRunner extends ResidentRunner {
throw 'Failed to compile $expression'; throw 'Failed to compile $expression';
} }
@override
Future<OperationResult> reloadMethod({ String libraryId, String classId }) async {
final OperationResult result = await restart(pause: false);
if (!result.isOk) {
throw vm_service.RPCError(
'Unable to reload sources',
RPCErrorCodes.kInternalError,
'',
);
}
return result;
}
// Returns the exit code of the flutter tool process, like [run]. // Returns the exit code of the flutter tool process, like [run].
@override @override
Future<int> attach({ Future<int> attach({
...@@ -192,7 +179,6 @@ class HotRunner extends ResidentRunner { ...@@ -192,7 +179,6 @@ class HotRunner extends ResidentRunner {
reloadSources: _reloadSourcesService, reloadSources: _reloadSourcesService,
restart: _restartService, restart: _restartService,
compileExpression: _compileExpressionService, compileExpression: _compileExpressionService,
reloadMethod: reloadMethod,
getSkSLMethod: writeSkSL, getSkSLMethod: writeSkSL,
); );
// Catches all exceptions, non-Exception objects are rethrown. // Catches all exceptions, non-Exception objects are rethrown.
......
...@@ -79,12 +79,6 @@ typedef CompileExpression = Future<String> Function( ...@@ -79,12 +79,6 @@ typedef CompileExpression = Future<String> Function(
bool isStatic, bool isStatic,
); );
typedef ReloadMethod = Future<void> Function({
String classId,
String libraryId,
});
/// A method that pulls an SkSL shader from the device and writes it to a file. /// A method that pulls an SkSL shader from the device and writes it to a file.
/// ///
/// The name of the file returned as a result. /// The name of the file returned as a result.
...@@ -147,7 +141,6 @@ typedef VMServiceConnector = Future<vm_service.VmService> Function(Uri httpUri, ...@@ -147,7 +141,6 @@ typedef VMServiceConnector = Future<vm_service.VmService> Function(Uri httpUri,
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression, io.CompressionOptions compression,
...@@ -174,7 +167,6 @@ vm_service.VmService setUpVmService( ...@@ -174,7 +167,6 @@ vm_service.VmService setUpVmService(
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
Device device, Device device,
ReloadMethod reloadMethod,
GetSkSLMethod skSLMethod, GetSkSLMethod skSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
vm_service.VmService vmService vm_service.VmService vmService
...@@ -196,32 +188,6 @@ vm_service.VmService setUpVmService( ...@@ -196,32 +188,6 @@ vm_service.VmService setUpVmService(
vmService.registerService('reloadSources', 'Flutter Tools'); vmService.registerService('reloadSources', 'Flutter Tools');
} }
if (reloadMethod != null) {
// Register a special method for hot UI. while this is implemented
// currently in the same way as hot reload, it leaves the tool free
// to change to a more efficient implementation in the future.
//
// `library` should be the file URI of the updated code.
// `class` should be the name of the Widget subclass to be marked dirty. For example,
// if the build method of a StatelessWidget is updated, this is the name of class.
// If the build method of a StatefulWidget is updated, then this is the name
// of the Widget class that created the State object.
vmService.registerServiceCallback('reloadMethod', (Map<String, dynamic> params) async {
final String libraryId = _validateRpcStringParam('reloadMethod', params, 'library');
final String classId = _validateRpcStringParam('reloadMethod', params, 'class');
globals.printTrace('reloadMethod not yet supported, falling back to hot reload');
await reloadMethod(libraryId: libraryId, classId: classId);
return <String, dynamic>{
'result': <String, Object>{
'type': 'Success',
}
};
});
vmService.registerService('reloadMethod', 'Flutter Tools');
}
if (restart != null) { if (restart != null) {
vmService.registerServiceCallback('hotRestart', (Map<String, dynamic> params) async { vmService.registerServiceCallback('hotRestart', (Map<String, dynamic> params) async {
final bool pause = _validateRpcBoolParam('compileExpression', params, 'pause'); final bool pause = _validateRpcBoolParam('compileExpression', params, 'pause');
...@@ -318,7 +284,6 @@ Future<vm_service.VmService> connectToVmService( ...@@ -318,7 +284,6 @@ Future<vm_service.VmService> connectToVmService(
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression = io.CompressionOptions.compressionDefault, io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
...@@ -331,7 +296,6 @@ Future<vm_service.VmService> connectToVmService( ...@@ -331,7 +296,6 @@ Future<vm_service.VmService> connectToVmService(
compileExpression: compileExpression, compileExpression: compileExpression,
compression: compression, compression: compression,
device: device, device: device,
reloadMethod: reloadMethod,
getSkSLMethod: getSkSLMethod, getSkSLMethod: getSkSLMethod,
printStructuredErrorLogMethod: printStructuredErrorLogMethod, printStructuredErrorLogMethod: printStructuredErrorLogMethod,
); );
...@@ -342,7 +306,6 @@ Future<vm_service.VmService> _connect( ...@@ -342,7 +306,6 @@ Future<vm_service.VmService> _connect(
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression = io.CompressionOptions.compressionDefault, io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
...@@ -364,7 +327,6 @@ Future<vm_service.VmService> _connect( ...@@ -364,7 +327,6 @@ Future<vm_service.VmService> _connect(
restart, restart,
compileExpression, compileExpression,
device, device,
reloadMethod,
getSkSLMethod, getSkSLMethod,
printStructuredErrorLogMethod, printStructuredErrorLogMethod,
delegateService, delegateService,
......
...@@ -735,7 +735,6 @@ VMServiceConnector getFakeVmServiceFactory({ ...@@ -735,7 +735,6 @@ VMServiceConnector getFakeVmServiceFactory({
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
CompressionOptions compression, CompressionOptions compression,
......
...@@ -134,7 +134,6 @@ class TestFlutterDevice extends FlutterDevice { ...@@ -134,7 +134,6 @@ class TestFlutterDevice extends FlutterDevice {
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
bool disableDds = false, bool disableDds = false,
......
...@@ -573,7 +573,6 @@ class TestFlutterDevice extends FlutterDevice { ...@@ -573,7 +573,6 @@ class TestFlutterDevice extends FlutterDevice {
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
bool disableServiceAuthCodes = false, bool disableServiceAuthCodes = false,
......
...@@ -2347,7 +2347,6 @@ void main() { ...@@ -2347,7 +2347,6 @@ void main() {
ReloadSources reloadSources, ReloadSources reloadSources,
Restart restart, Restart restart,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression, io.CompressionOptions compression,
...@@ -2415,7 +2414,6 @@ class FakeFlutterDevice extends FlutterDevice { ...@@ -2415,7 +2414,6 @@ class FakeFlutterDevice extends FlutterDevice {
bool disableServiceAuthCodes = false, bool disableServiceAuthCodes = false,
bool ipv6 = false, bool ipv6 = false,
CompileExpression compileExpression, CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod, GetSkSLMethod getSkSLMethod,
int hostVmServicePort, int hostVmServicePort,
int ddsPort, int ddsPort,
......
...@@ -104,7 +104,6 @@ void main() { ...@@ -104,7 +104,6 @@ void main() {
null, null,
null, null,
null, null,
null,
mockVMService, mockVMService,
); );
...@@ -113,26 +112,6 @@ void main() { ...@@ -113,26 +112,6 @@ void main() {
Logger: () => BufferLogger.test() Logger: () => BufferLogger.test()
}); });
testUsingContext('VmService registers reloadMethod', () async {
Future<void> reloadMethod({ String classId, String libraryId,}) async {}
final MockVMService mockVMService = MockVMService();
setUpVmService(
null,
null,
null,
null,
reloadMethod,
null,
null,
mockVMService,
);
verify(mockVMService.registerService('reloadMethod', 'Flutter Tools')).called(1);
}, overrides: <Type, Generator>{
Logger: () => BufferLogger.test()
});
testUsingContext('VmService registers flutterMemoryInfo service', () async { testUsingContext('VmService registers flutterMemoryInfo service', () async {
final MockDevice mockDevice = MockDevice(); final MockDevice mockDevice = MockDevice();
...@@ -144,7 +123,6 @@ void main() { ...@@ -144,7 +123,6 @@ void main() {
mockDevice, mockDevice,
null, null,
null, null,
null,
mockVMService, mockVMService,
); );
...@@ -160,7 +138,6 @@ void main() { ...@@ -160,7 +138,6 @@ void main() {
null, null,
null, null,
null, null,
null,
() async => 'hello', () async => 'hello',
null, null,
mockVMService, mockVMService,
...@@ -182,7 +159,6 @@ void main() { ...@@ -182,7 +159,6 @@ void main() {
null, null,
null, null,
null, null,
null,
(vm_service.Event event) async => 'hello', (vm_service.Event event) async => 'hello',
mockVMService, mockVMService,
); );
...@@ -200,7 +176,6 @@ void main() { ...@@ -200,7 +176,6 @@ void main() {
null, null,
null, null,
null, null,
null,
mockVMService, mockVMService,
); );
......
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