Skip to content

Commit a205adc

Browse files
authored
Added flag to disable the dart profiler on iOS (flutter#33907)
1 parent 3507338 commit a205adc

File tree

3 files changed

+17
-0
lines changed

3 files changed

+17
-0
lines changed

shell/platform/darwin/ios/framework/Source/FlutterDartProject.mm

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,12 @@
173173
settings.trace_systrace = enableTraceSystrace.boolValue;
174174
}
175175

176+
NSNumber* enableDartProfiling = [mainBundle objectForInfoDictionaryKey:@"FLTEnableDartProfiling"];
177+
// Change the default only if the option is present.
178+
if (enableDartProfiling != nil) {
179+
settings.enable_dart_profiling = enableDartProfiling.boolValue;
180+
}
181+
176182
// Leak Dart VM settings, set whether leave or clean up the VM after the last shell shuts down.
177183
NSNumber* leakDartVM = [mainBundle objectForInfoDictionaryKey:@"FLTLeakDartVM"];
178184
// It will change the default leak_vm value in settings only if the key exists.

shell/platform/darwin/ios/framework/Source/FlutterDartProjectTest.mm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,15 @@ - (void)testEnableTraceSystraceSettingIsCorrectlyParsed {
8080
XCTAssertEqual(settings.trace_systrace, NO);
8181
}
8282

83+
- (void)testEnableDartProflingSettingIsCorrectlyParsed {
84+
NSBundle* mainBundle = [NSBundle mainBundle];
85+
NSNumber* enableTraceSystrace = [mainBundle objectForInfoDictionaryKey:@"FLTEnableDartProfiling"];
86+
XCTAssertNotNil(enableTraceSystrace);
87+
XCTAssertEqual(enableTraceSystrace.boolValue, NO);
88+
auto settings = FLTDefaultSettingsForBundle();
89+
XCTAssertEqual(settings.trace_systrace, NO);
90+
}
91+
8392
- (void)testEmptySettingsAreCorrect {
8493
XCTAssertFalse([FlutterDartProject allowsArbitraryLoads:[[NSDictionary alloc] init]]);
8594
XCTAssertEqualObjects(@"", [FlutterDartProject domainNetworkPolicy:[[NSDictionary alloc] init]]);

testing/ios/IosUnitTests/App/Info.plist

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@
5050
<false/>
5151
<key>FLTTraceSystrace</key>
5252
<false/>
53+
<key>FLTEnableDartProfiling</key>
54+
<false/>
5355
<key>UIRequiredDeviceCapabilities</key>
5456
<array>
5557
<string>armv7</string>

0 commit comments

Comments
 (0)