Added flag to disable the dart profiler on iOS (flutter/engine#33907)

This commit is contained in:
gaaclarke
2022-06-08 12:28:04 -07:00
committed by GitHub
parent ea85c956ca
commit 166029f3a1
3 changed files with 17 additions and 0 deletions

View File

@@ -173,6 +173,12 @@ flutter::Settings FLTDefaultSettingsForBundle(NSBundle* bundle) {
settings.trace_systrace = enableTraceSystrace.boolValue;
}
NSNumber* enableDartProfiling = [mainBundle objectForInfoDictionaryKey:@"FLTEnableDartProfiling"];
// Change the default only if the option is present.
if (enableDartProfiling != nil) {
settings.enable_dart_profiling = enableDartProfiling.boolValue;
}
// Leak Dart VM settings, set whether leave or clean up the VM after the last shell shuts down.
NSNumber* leakDartVM = [mainBundle objectForInfoDictionaryKey:@"FLTLeakDartVM"];
// It will change the default leak_vm value in settings only if the key exists.

View File

@@ -80,6 +80,15 @@ FLUTTER_ASSERT_ARC
XCTAssertEqual(settings.trace_systrace, NO);
}
- (void)testEnableDartProflingSettingIsCorrectlyParsed {
NSBundle* mainBundle = [NSBundle mainBundle];
NSNumber* enableTraceSystrace = [mainBundle objectForInfoDictionaryKey:@"FLTEnableDartProfiling"];
XCTAssertNotNil(enableTraceSystrace);
XCTAssertEqual(enableTraceSystrace.boolValue, NO);
auto settings = FLTDefaultSettingsForBundle();
XCTAssertEqual(settings.trace_systrace, NO);
}
- (void)testEmptySettingsAreCorrect {
XCTAssertFalse([FlutterDartProject allowsArbitraryLoads:[[NSDictionary alloc] init]]);
XCTAssertEqualObjects(@"", [FlutterDartProject domainNetworkPolicy:[[NSDictionary alloc] init]]);

View File

@@ -50,6 +50,8 @@
<false/>
<key>FLTTraceSystrace</key>
<false/>
<key>FLTEnableDartProfiling</key>
<false/>
<key>UIRequiredDeviceCapabilities</key>
<array>
<string>armv7</string>