iOS: Eliminate strong retain loop in Scenario tests (flutter/engine#56249)
`FlutterViewControllerTest testDrawLayer` created a callback which strongly referenced itself in its own body as part of an asynchronous recursive loop. The recursion was unnecessary and the test consistently passes, even if run on repeat > 100 times without it. Now that there's only one call, eliminates the unnecessary local and inlines it into the `dispatch_after` call. This was originally introduced in https://github.com/flutter/engine/pull/50072. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
This commit is contained in:
parent
2bc2d9e328
commit
a4bb83e6e8
@ -91,9 +91,7 @@ FLUTTER_ASSERT_ARC
|
||||
[rootVC presentViewController:self.flutterViewController animated:NO completion:nil];
|
||||
|
||||
CGColorSpaceRef color_space = CGColorSpaceCreateDeviceRGB();
|
||||
|
||||
__block dispatch_block_t callback;
|
||||
callback = ^{
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC), dispatch_get_main_queue(), ^{
|
||||
size_t width = 300u;
|
||||
CGContextRef context =
|
||||
CGBitmapContextCreate(nil, width, width, 8, 4 * width, color_space,
|
||||
@ -104,14 +102,8 @@ FLUTTER_ASSERT_ARC
|
||||
[imageRendered fulfill];
|
||||
return;
|
||||
}
|
||||
|
||||
CGContextRelease(context);
|
||||
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC), dispatch_get_main_queue(),
|
||||
callback);
|
||||
};
|
||||
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, NSEC_PER_SEC), dispatch_get_main_queue(),
|
||||
callback);
|
||||
});
|
||||
|
||||
[self waitForExpectationsWithTimeout:30.0 handler:nil];
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user