Skip to content

Commit f753f9a

Browse files
authored
Tidy up some nits in ServiceConnectionManager (#9311)
1 parent 600d835 commit f753f9a

File tree

1 file changed

+12
-23
lines changed

1 file changed

+12
-23
lines changed

packages/devtools_app/lib/src/service/service_manager.dart

Lines changed: 12 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ const defaultRefreshRate = 60.0;
3636

3737
class ServiceConnectionManager {
3838
ServiceConnectionManager() {
39-
serviceManager = ServiceManager()
39+
_serviceManager = ServiceManager()
4040
..registerLifecycleCallback(
4141
ServiceManagerLifecycle.beforeOpenVmService,
4242
_beforeOpenVmService,
@@ -61,7 +61,8 @@ class ServiceConnectionManager {
6161
);
6262
}
6363

64-
late final ServiceManager<VmServiceWrapper> serviceManager;
64+
ServiceManager<VmServiceWrapper> get serviceManager => _serviceManager;
65+
late final ServiceManager<VmServiceWrapper> _serviceManager;
6566

6667
final vmFlagManager = VmFlagManager();
6768

@@ -72,8 +73,7 @@ class ServiceConnectionManager {
7273
InspectorServiceBase? get inspectorService => _inspectorService;
7374
InspectorServiceBase? _inspectorService;
7475

75-
ErrorBadgeManager get errorBadgeManager => _errorBadgeManager;
76-
final _errorBadgeManager = ErrorBadgeManager();
76+
final errorBadgeManager = ErrorBadgeManager();
7777

7878
VmServiceTrafficLogger? serviceTrafficLogger;
7979

@@ -189,7 +189,7 @@ class ServiceConnectionManager {
189189
/// Returns the view id for the selected isolate's 'FlutterView'.
190190
///
191191
/// Throws an Exception if no 'FlutterView' is present in this isolate.
192-
Future<String> get flutterViewId async {
192+
Future<String> get _flutterViewId async {
193193
final flutterViewListResponse = await serviceManager
194194
.callServiceExtensionOnMainIsolate(registrations.flutterListViews);
195195
final views = (flutterViewListResponse.json!['views'] as List)
@@ -210,8 +210,8 @@ class ServiceConnectionManager {
210210
return flutterView['id'] as String;
211211
}
212212

213-
/// Flutter engine returns estimate how much memory is used by layer/picture raster
214-
/// cache entries in bytes.
213+
/// Flutter engine returns estimate how much memory is used by layer/picture
214+
/// raster cache entries in bytes.
215215
///
216216
/// Call to returns JSON payload 'EstimateRasterCacheMemory' with two entries:
217217
/// layerBytes - layer raster cache entries in bytes
@@ -222,28 +222,17 @@ class ServiceConnectionManager {
222222
return null;
223223
}
224224

225-
final viewId = await flutterViewId;
225+
final viewId = await _flutterViewId;
226226

227227
return await serviceManager.callServiceExtensionOnMainIsolate(
228228
registrations.flutterEngineEstimateRasterCache,
229229
args: {'viewId': viewId},
230230
);
231231
}
232232

233-
Future<Response?> get renderFrameWithRasterStats async {
234-
if (serviceManager.connectedApp == null ||
235-
!await serviceManager.connectedApp!.isFlutterApp) {
236-
return null;
237-
}
238-
239-
final viewId = await flutterViewId;
240-
241-
return await serviceManager.callServiceExtensionOnMainIsolate(
242-
registrations.renderFrameWithRasterStats,
243-
args: {'viewId': viewId},
244-
);
245-
}
246-
233+
/// Returns the Flutter refresh rate.
234+
///
235+
/// If not connected to a Flutter app, returns `null`.
247236
Future<double?> get queryDisplayRefreshRate async {
248237
if (serviceManager.connectedApp == null ||
249238
!await serviceManager.connectedApp!.isFlutterApp) {
@@ -252,7 +241,7 @@ class ServiceConnectionManager {
252241

253242
const unknownRefreshRate = 0.0;
254243

255-
final viewId = await flutterViewId;
244+
final viewId = await _flutterViewId;
256245
final displayRefreshRateResponse = await serviceManager
257246
.callServiceExtensionOnMainIsolate(
258247
registrations.displayRefreshRate,

0 commit comments

Comments
 (0)