forked from dart-lang/webdev
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp_debug_services.dart
34 lines (27 loc) · 1.23 KB
/
app_debug_services.dart
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
import 'package:dwds/src/dwds_vm_client.dart';
import 'package:dwds/src/events.dart';
import 'package:dwds/src/services/chrome_proxy_service.dart'
show ChromeProxyService;
import 'package:dwds/src/services/debug_service.dart';
/// A container for all the services required for debugging an application.
class AppDebugServices {
final DebugService debugService;
final DwdsVmClient dwdsVmClient;
final DwdsStats dwdsStats;
ChromeProxyService get chromeProxyService =>
debugService.chromeProxyService as ChromeProxyService;
/// Null until [close] is called.
///
/// All subsequent calls to [close] will return this future.
Future<void>? _closed;
/// The instance ID for the currently connected application, if there is one.
///
/// We only allow a given app to be debugged in a single tab at a time.
String? connectedInstanceId;
AppDebugServices(this.debugService, this.dwdsVmClient, this.dwdsStats);
Future<void> close() =>
_closed ??= Future.wait([debugService.close(), dwdsVmClient.close()]);
}