Skip to content

Instantly share code, notes, and snippets.

@liyuqian
Created September 16, 2020 21:12
Show Gist options
  • Save liyuqian/a61dfe302f0cb5e24c25ce5cf925fc46 to your computer and use it in GitHub Desktop.
Save liyuqian/a61dfe302f0cb5e24c25ce5cf925fc46 to your computer and use it in GitHub Desktop.
raster cache memory service protocol test
diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart
index 9008f0389b..a4fb521e6e 100644
--- a/packages/flutter_tools/lib/src/resident_runner.dart
+++ b/packages/flutter_tools/lib/src/resident_runner.dart
@@ -961,6 +961,13 @@ abstract class ResidentRunner {
final List<FlutterView> views = await flutterDevices
.first
.vmService.getFlutterViews();
+
+ final Map<String, Object> memoryData = await flutterDevices.first.vmService.estimateRasterCacheMemory(
+ viewId: views.first.id,
+ );
+ print('estimateRasterCacheMemory data: $memoryData');
+
+
final Map<String, Object> data = await flutterDevices.first.vmService.getSkSLs(
viewId: views.first.id,
);
diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart
index 36c0172ed9..5acb64583a 100644
--- a/packages/flutter_tools/lib/src/vmservice.dart
+++ b/packages/flutter_tools/lib/src/vmservice.dart
@@ -477,6 +477,18 @@ extension FlutterVmService on vm_service.VmService {
return response.json['SkSLs'] as Map<String, Object>;
}
+ Future<Map<String, Object>> estimateRasterCacheMemory({
+ @required String viewId,
+ }) async {
+ final vm_service.Response response = await callMethod(
+ '_flutter.estimateRasterCacheMemory',
+ args: <String, String>{
+ 'viewId': viewId,
+ },
+ );
+ return response.json;
+ }
+
/// Flush all tasks on the UI thead for an attached Flutter view.
///
/// This method is currently used only for benchmarking.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment