GN: Enable ARC for Mac and iOS in rtc_* templates
Remove all uses of retain/release and NSAutoreleasePool. This makes transformation to Bazel easier. This CL subsumes https://codereview.webrtc.org/2778163002 and depends on https://codereview.webrtc.org/2784483002/ BUG=webrtc:6412 Review-Url: https://codereview.webrtc.org/2781713004 Cr-Commit-Position: refs/heads/master@{#17780}
This commit is contained in:
@ -36,10 +36,10 @@ TestBlock functionToBlock(void(*function)()) {
|
||||
}
|
||||
|
||||
- (void)runAllTests:(TestBlock)testBlock {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
testBlock();
|
||||
running_ = NO;
|
||||
[pool release];
|
||||
@autoreleasepool {
|
||||
testBlock();
|
||||
running_ = NO;
|
||||
}
|
||||
}
|
||||
|
||||
- (BOOL)running {
|
||||
@ -51,24 +51,23 @@ namespace webrtc {
|
||||
namespace test {
|
||||
|
||||
void RunTest(void(*test)()) {
|
||||
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
|
||||
[NSApplication sharedApplication];
|
||||
@autoreleasepool {
|
||||
[NSApplication sharedApplication];
|
||||
|
||||
// Convert the function pointer to an Objective-C block and call on a
|
||||
// separate thread, to avoid blocking the main thread.
|
||||
TestRunner *testRunner = [[TestRunner alloc] init];
|
||||
TestBlock testBlock = functionToBlock(test);
|
||||
[NSThread detachNewThreadSelector:@selector(runAllTests:)
|
||||
toTarget:testRunner
|
||||
withObject:testBlock];
|
||||
// Convert the function pointer to an Objective-C block and call on a
|
||||
// separate thread, to avoid blocking the main thread.
|
||||
TestRunner *testRunner = [[TestRunner alloc] init];
|
||||
TestBlock testBlock = functionToBlock(test);
|
||||
[NSThread detachNewThreadSelector:@selector(runAllTests:)
|
||||
toTarget:testRunner
|
||||
withObject:testBlock];
|
||||
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
while ([testRunner running] &&
|
||||
[runLoop runMode:NSDefaultRunLoopMode
|
||||
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]);
|
||||
NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
|
||||
while ([testRunner running] &&
|
||||
[runLoop runMode:NSDefaultRunLoopMode
|
||||
beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]);
|
||||
}
|
||||
|
||||
[testRunner release];
|
||||
[pool release];
|
||||
}
|
||||
|
||||
} // namespace test
|
||||
|
||||
Reference in New Issue
Block a user