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,
- `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)
#### 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.
- `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)
This functionality was deprecated and removed after Flutter version 1.23.0
#### app.callServiceExtension
......
......@@ -423,7 +423,6 @@ typedef _RunOrAttach = Future<void> Function({
class AppDomain extends Domain {
AppDomain(Daemon daemon) : super(daemon, 'app') {
registerHandler('restart', restart);
registerHandler('reloadMethod', reloadMethod);
registerHandler('callServiceExtension', callServiceExtension);
registerHandler('stop', stop);
registerHandler('detach', detach);
......@@ -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.
///
/// Only one reload action will run at a time. Actions requested in quick
......@@ -1094,10 +1071,6 @@ class AppInstance {
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> detach() => runner.detach();
......@@ -1353,7 +1326,6 @@ class LaunchMode {
}
enum OperationType {
reloadMethod,
reload,
restart
}
......
......@@ -210,7 +210,6 @@ class FlutterDevice {
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
int hostVmServicePort,
......@@ -259,7 +258,6 @@ class FlutterDevice {
reloadSources: reloadSources,
restart: restart,
compileExpression: compileExpression,
reloadMethod: reloadMethod,
getSkSLMethod: getSkSLMethod,
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
device: device,
......@@ -951,22 +949,6 @@ abstract class ResidentRunner {
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
void writeVmserviceFile() {
if (debuggingOptions.vmserviceOutFile != null) {
......@@ -1259,7 +1241,6 @@ abstract class ResidentRunner {
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
}) async {
if (!debuggingOptions.debuggingEnabled) {
......@@ -1275,7 +1256,6 @@ abstract class ResidentRunner {
disableDds: debuggingOptions.disableDds,
ddsPort: debuggingOptions.ddsPort,
hostVmServicePort: debuggingOptions.hostVmServicePort,
reloadMethod: reloadMethod,
getSkSLMethod: getSkSLMethod,
printStructuredErrorLogMethod: printStructuredErrorLog,
ipv6: ipv6,
......
......@@ -167,19 +167,6 @@ class HotRunner extends ResidentRunner {
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].
@override
Future<int> attach({
......@@ -192,7 +179,6 @@ class HotRunner extends ResidentRunner {
reloadSources: _reloadSourcesService,
restart: _restartService,
compileExpression: _compileExpressionService,
reloadMethod: reloadMethod,
getSkSLMethod: writeSkSL,
);
// Catches all exceptions, non-Exception objects are rethrown.
......
......@@ -79,12 +79,6 @@ typedef CompileExpression = Future<String> Function(
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.
///
/// The name of the file returned as a result.
......@@ -147,7 +141,6 @@ typedef VMServiceConnector = Future<vm_service.VmService> Function(Uri httpUri,
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression,
......@@ -174,7 +167,6 @@ vm_service.VmService setUpVmService(
Restart restart,
CompileExpression compileExpression,
Device device,
ReloadMethod reloadMethod,
GetSkSLMethod skSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
vm_service.VmService vmService
......@@ -196,32 +188,6 @@ vm_service.VmService setUpVmService(
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) {
vmService.registerServiceCallback('hotRestart', (Map<String, dynamic> params) async {
final bool pause = _validateRpcBoolParam('compileExpression', params, 'pause');
......@@ -318,7 +284,6 @@ Future<vm_service.VmService> connectToVmService(
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
......@@ -331,7 +296,6 @@ Future<vm_service.VmService> connectToVmService(
compileExpression: compileExpression,
compression: compression,
device: device,
reloadMethod: reloadMethod,
getSkSLMethod: getSkSLMethod,
printStructuredErrorLogMethod: printStructuredErrorLogMethod,
);
......@@ -342,7 +306,6 @@ Future<vm_service.VmService> _connect(
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression = io.CompressionOptions.compressionDefault,
......@@ -364,7 +327,6 @@ Future<vm_service.VmService> _connect(
restart,
compileExpression,
device,
reloadMethod,
getSkSLMethod,
printStructuredErrorLogMethod,
delegateService,
......
......@@ -735,7 +735,6 @@ VMServiceConnector getFakeVmServiceFactory({
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
CompressionOptions compression,
......
......@@ -134,7 +134,6 @@ class TestFlutterDevice extends FlutterDevice {
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
bool disableDds = false,
......
......@@ -573,7 +573,6 @@ class TestFlutterDevice extends FlutterDevice {
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
bool disableServiceAuthCodes = false,
......
......@@ -2347,7 +2347,6 @@ void main() {
ReloadSources reloadSources,
Restart restart,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
PrintStructuredErrorLogMethod printStructuredErrorLogMethod,
io.CompressionOptions compression,
......@@ -2415,7 +2414,6 @@ class FakeFlutterDevice extends FlutterDevice {
bool disableServiceAuthCodes = false,
bool ipv6 = false,
CompileExpression compileExpression,
ReloadMethod reloadMethod,
GetSkSLMethod getSkSLMethod,
int hostVmServicePort,
int ddsPort,
......
......@@ -104,7 +104,6 @@ void main() {
null,
null,
null,
null,
mockVMService,
);
......@@ -113,26 +112,6 @@ void main() {
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 {
final MockDevice mockDevice = MockDevice();
......@@ -144,7 +123,6 @@ void main() {
mockDevice,
null,
null,
null,
mockVMService,
);
......@@ -160,7 +138,6 @@ void main() {
null,
null,
null,
null,
() async => 'hello',
null,
mockVMService,
......@@ -182,7 +159,6 @@ void main() {
null,
null,
null,
null,
(vm_service.Event event) async => 'hello',
mockVMService,
);
......@@ -200,7 +176,6 @@ void main() {
null,
null,
null,
null,
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