Skip to content

Commit 619121b

Browse files
authored
Enable caching of CPU samples collected at application startup (flutter#89600)
1 parent cec1457 commit 619121b

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

packages/flutter_tools/lib/src/base/dds.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ Future<dds.DartDevelopmentService> Function(
1717
bool enableAuthCodes,
1818
bool ipv6,
1919
Uri? serviceUri,
20+
List<String> cachedUserTags,
2021
}) ddsLauncherCallback = dds.DartDevelopmentService.startDartDevelopmentService;
2122

2223
/// Helper class to launch a [dds.DartDevelopmentService]. Allows for us to
@@ -52,6 +53,8 @@ class DartDevelopmentService {
5253
serviceUri: ddsUri,
5354
enableAuthCodes: disableServiceAuthCodes != true,
5455
ipv6: ipv6 == true,
56+
// Enables caching of CPU samples collected during application startup.
57+
cachedUserTags: const <String>['AppStartUp'],
5558
);
5659
unawaited(_ddsInstance?.done.whenComplete(() {
5760
if (!_completer.isCompleted) {

packages/flutter_tools/test/general.shard/resident_runner_test.dart

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1806,11 +1806,12 @@ void main() {
18061806
fakeVmServiceHost = FakeVmServiceHost(requests: <VmServiceExpectation>[]);
18071807
final FakeDevice device = FakeDevice()
18081808
..dds = DartDevelopmentService();
1809-
ddsLauncherCallback = (Uri uri, {bool enableAuthCodes, bool ipv6, Uri serviceUri}) {
1809+
ddsLauncherCallback = (Uri uri, {bool enableAuthCodes, bool ipv6, Uri serviceUri, List<String> cachedUserTags}) {
18101810
expect(uri, Uri(scheme: 'foo', host: 'bar'));
18111811
expect(enableAuthCodes, isTrue);
18121812
expect(ipv6, isFalse);
18131813
expect(serviceUri, Uri(scheme: 'http', host: '127.0.0.1', port: 0));
1814+
expect(cachedUserTags, <String>['AppStartUp']);
18141815
throw FakeDartDevelopmentServiceException(message:
18151816
'Existing VM service clients prevent DDS from taking control.',
18161817
);
@@ -1853,11 +1854,12 @@ void main() {
18531854
final FakeDevice device = FakeDevice()
18541855
..dds = DartDevelopmentService();
18551856
final Completer<void>done = Completer<void>();
1856-
ddsLauncherCallback = (Uri uri, {bool enableAuthCodes, bool ipv6, Uri serviceUri}) async {
1857+
ddsLauncherCallback = (Uri uri, {bool enableAuthCodes, bool ipv6, Uri serviceUri, List<String> cachedUserTags}) async {
18571858
expect(uri, Uri(scheme: 'foo', host: 'bar'));
18581859
expect(enableAuthCodes, isFalse);
18591860
expect(ipv6, isTrue);
18601861
expect(serviceUri, Uri(scheme: 'http', host: '::1', port: 0));
1862+
expect(cachedUserTags, <String>['AppStartUp']);
18611863
done.complete();
18621864
return null;
18631865
};
@@ -1884,11 +1886,12 @@ void main() {
18841886
// See https://github.com/flutter/flutter/issues/72385 for context.
18851887
final FakeDevice device = FakeDevice()
18861888
..dds = DartDevelopmentService();
1887-
ddsLauncherCallback = (Uri uri, {bool enableAuthCodes, bool ipv6, Uri serviceUri}) {
1889+
ddsLauncherCallback = (Uri uri, {bool enableAuthCodes, bool ipv6, Uri serviceUri, List<String> cachedUserTags}) {
18881890
expect(uri, Uri(scheme: 'foo', host: 'bar'));
18891891
expect(enableAuthCodes, isTrue);
18901892
expect(ipv6, isFalse);
18911893
expect(serviceUri, Uri(scheme: 'http', host: '127.0.0.1', port: 0));
1894+
expect(cachedUserTags, <String>['AppStartUp']);
18921895
throw FakeDartDevelopmentServiceException(message: 'No URI');
18931896
};
18941897
final TestFlutterDevice flutterDevice = TestFlutterDevice(

0 commit comments

Comments
 (0)